info_add.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. <extend name="public/base"/>
  2. <block name="css">
  3. <style>
  4. .van-nav-bar--fixed {z-index:100;}
  5. .van-nav-bar .van-icon,.van-nav-bar__text {color:white;}
  6. .van-step--horizontal .van-step__title {font-size:16px;}
  7. .van-step--horizontal .van-step__icon {font-size:16px;}
  8. .van-step__circle {width:10px;height:10px;}
  9. .van-row {width:100%;}
  10. .btn_search_item{background:#f2f6ff;display:inline-block;border-radius:5px;line-height:35px;height:35px;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;position:relative;font-size:13px;width:100%;color:#666;margin-bottom:10px;}
  11. .btn_search_item.active{color:var(--pink);background:#fff7fa;}
  12. .btn_search_icon{position:absolute;bottom:-3px;right:-3px;font-size:30px;}
  13. .van-uploader__input-wrapper {width:100%;}
  14. </style>
  15. </block>
  16. <block name="body">
  17. <!--头部-->
  18. <van-nav-bar
  19. class="bg-pink"
  20. left-text="返回"
  21. left-arrow
  22. @click-left="onBack"
  23. fixed="true"
  24. >
  25. <template #title>
  26. <span style="color:white;">基本资料(1/2)</span>
  27. </template>
  28. </van-nav-bar>
  29. <div style="width:100%;height:46px;"></div>
  30. <van-steps :active="0">
  31. <van-step>基本资料</van-step>
  32. <van-step>择偶要求</van-step>
  33. </van-steps>
  34. <!--头图-->
  35. <van-uploader :max-count="1" :after-read="uploadHead" style="padding:20px 0;width:100%;">
  36. <van-image width="30%" style="display:block;margin:0 auto;" :src="head_image"></van-image>
  37. <div style="text-align:center;font-size:14px;color:#999;">点击上传头像</div>
  38. </van-uploader>
  39. <!--增空-->
  40. <van-field
  41. v-model="form.realname"
  42. label="真实姓名"
  43. placeholder="请输入真实姓名"
  44. required
  45. ></van-field>
  46. <van-field
  47. v-model="form.mobile"
  48. label="电话"
  49. placeholder="请输入电话号码"
  50. ></van-field>
  51. <van-field name="radio" label="单选框" required>
  52. <template #input>
  53. <van-radio-group v-model="form.sex" direction="horizontal">
  54. <van-radio :name="1">男</van-radio>
  55. <van-radio :name="2">女</van-radio>
  56. </van-radio-group>
  57. </template>
  58. </van-field>
  59. <!--生日-->
  60. <van-field
  61. required
  62. readonly
  63. clickable
  64. :value="form.birthday"
  65. label="生日"
  66. placeholder="点击选择生日"
  67. @click="showBirthday = true"
  68. ></van-field>
  69. <van-popup position="bottom" v-model="showBirthday">
  70. <van-datetime-picker
  71. title="生日"
  72. :value="new Date(form.birthday)"
  73. type="date"
  74. :min-date="minDate"
  75. @confirm="onBirthdayConfirm"
  76. @cancel="showBirthday = false"
  77. ></van-datetime-picker>
  78. </van-popup>
  79. <!--身高-->
  80. <van-field
  81. required
  82. readonly
  83. clickable
  84. :value="form_high"
  85. label="身高"
  86. placeholder="请选择身高(CM)"
  87. @click="showHigh = true"
  88. ></van-field>
  89. <van-popup position="bottom" v-model="showHigh">
  90. <van-picker
  91. title="身高"
  92. show-toolbar
  93. :columns="high"
  94. @confirm="onHighConfirm"
  95. @cancel="showHigh = false"
  96. ></van-picker>
  97. </van-popup>
  98. <!--体重-->
  99. <van-field
  100. required
  101. readonly
  102. clickable
  103. :value="form_weight"
  104. label="体重"
  105. placeholder="请选择体重(KG)"
  106. @click="showWeight = true"
  107. ></van-field>
  108. <van-popup position="bottom" v-model="showWeight">
  109. <van-picker
  110. title="体重"
  111. show-toolbar
  112. :columns="weight"
  113. @confirm="onWeightConfirm"
  114. @cancel="showWeight = false"
  115. ></van-picker>
  116. </van-popup>
  117. <van-field
  118. required
  119. readonly
  120. clickable
  121. :value="form.marry"
  122. label="婚姻状况"
  123. placeholder="请选择婚姻状况"
  124. @click="showMarry = true"
  125. ></van-field>
  126. <van-popup position="bottom" v-model="showMarry">
  127. <van-picker
  128. title="婚姻状况"
  129. show-toolbar
  130. :columns="marry"
  131. @confirm="onMarryConfirm"
  132. @cancel="showMarry = false"
  133. ></van-picker>
  134. </van-popup>
  135. <!--生肖-->
  136. <van-field
  137. required
  138. readonly
  139. clickable
  140. :value="form.animal"
  141. label="生肖"
  142. placeholder="点击选择生肖"
  143. @click="showAnimal = true"
  144. ></van-field>
  145. <van-popup position="bottom" v-model="showAnimal">
  146. <van-picker
  147. title="生肖"
  148. show-toolbar
  149. :columns="animal"
  150. @confirm="onAnimalConfirm"
  151. @cancel="showAnimal = false"
  152. ></van-picker>
  153. </van-popup>
  154. <!--学历-->
  155. <van-field
  156. required
  157. readonly
  158. clickable
  159. :value="form.education"
  160. label="学历"
  161. placeholder="点击选择学历"
  162. @click="showEducation = true"
  163. ></van-field>
  164. <van-popup position="bottom" v-model="showEducation">
  165. <van-picker
  166. title="学历"
  167. show-toolbar
  168. :columns="education"
  169. @confirm="onEducationConfirm"
  170. @cancel="showEducation = false"
  171. ></van-picker>
  172. </van-popup>
  173. <!--年收入-->
  174. <van-field
  175. required
  176. readonly
  177. clickable
  178. :value="form.income"
  179. label="年收入"
  180. placeholder="点击选择年收入"
  181. @click="showIncome = true"
  182. ></van-field>
  183. <van-popup position="bottom" v-model="showIncome">
  184. <van-picker
  185. title="年收入"
  186. show-toolbar
  187. :columns="income"
  188. @confirm="onIncomeConfirm"
  189. @cancel="showIncome = false"
  190. ></van-picker>
  191. </van-popup>
  192. <!--工作单位和职务-->
  193. <van-field
  194. required
  195. v-model="form.company"
  196. label="工作单位"
  197. placeholder="请输入工作单位"
  198. ></van-field>
  199. <van-field
  200. v-model="form.job"
  201. label="职务"
  202. placeholder="请输入职务"
  203. ></van-field>
  204. <!--家庭成员-->
  205. <van-field name="form.family" label="家庭成员">
  206. <template #input>
  207. <van-row :gutter="10">
  208. <van-col span="8" v-for="(item) in family">
  209. <div :class="{btn_search_item:true,active: in_array(item,form.family)}"
  210. @click="selectFamily(item)">
  211. {{item}}
  212. <van-icon v-if="in_array(item,form.family)"
  213. class="iconfont icon-gouxuan-youxiajiaogouxuan btn_search_icon text-pink"></van-icon>
  214. </div>
  215. </van-col>
  216. </van-row>
  217. </template>
  218. </van-field>
  219. <!--籍贯-->
  220. <van-field
  221. v-model="form.native"
  222. label="籍贯"
  223. placeholder="请输入籍贯"
  224. ></van-field>
  225. <van-field
  226. v-model="form.live_place"
  227. label="居住地"
  228. placeholder="请输入居住地"
  229. ></van-field>
  230. <!--民族-->
  231. <van-field
  232. readonly
  233. clickable
  234. :value="form.nation"
  235. label="民族"
  236. placeholder="点击选择民族"
  237. @click="showNation = true"
  238. ></van-field>
  239. <van-popup position="bottom" v-model="showNation">
  240. <van-picker
  241. title="民族"
  242. show-toolbar
  243. :columns="nation"
  244. @confirm="onNationConfirm"
  245. @cancel="showNation = false"
  246. ></van-picker>
  247. </van-popup>
  248. <!--兴趣爱好-->
  249. <van-field
  250. v-model="form.hobby"
  251. autosize
  252. label="兴趣爱好"
  253. type="textarea"
  254. placeholder="请输入兴趣爱好"
  255. ></van-field>
  256. <van-field
  257. v-model="form.comment"
  258. autosize
  259. label="备注"
  260. type="textarea"
  261. placeholder="请输入备注"
  262. ></van-field>
  263. <h3 class="fz16 mb10 pt20 plr12">工作生活</h3>
  264. <!--房车,与父母同住-->
  265. <van-field
  266. readonly
  267. clickable
  268. :value="tinyint[form.have_house]"
  269. label="是否有房"
  270. placeholder="点击选择是否有房"
  271. @click="showHaveHouse = true"
  272. ></van-field>
  273. <van-popup position="bottom" v-model="showHaveHouse">
  274. <van-picker
  275. title="是否有房"
  276. show-toolbar
  277. :columns="tinyint"
  278. @confirm="onHaveHouseConfirm"
  279. @cancel="showHaveHouse = false"
  280. ></van-picker>
  281. </van-popup>
  282. <van-field
  283. readonly
  284. clickable
  285. :value="tinyint[form.have_car]"
  286. label="是否有车"
  287. placeholder="点击选择是否有车"
  288. @click="showHaveCar = true"
  289. ></van-field>
  290. <van-popup position="bottom" v-model="showHaveCar">
  291. <van-picker
  292. title="是否有车"
  293. show-toolbar
  294. :columns="tinyint"
  295. @confirm="onHaveCarConfirm"
  296. @cancel="showHaveCar = false"
  297. ></van-picker>
  298. </van-popup>
  299. <van-field
  300. readonly
  301. clickable
  302. :value="tinyint[form.with_parent_live]"
  303. label="婚后是否愿意与父母同住"
  304. placeholder="点击选择"
  305. @click="showWithParentLive = true"
  306. ></van-field>
  307. <van-popup position="bottom" v-model="showWithParentLive">
  308. <van-picker
  309. title="婚后是否愿意与父母同住"
  310. show-toolbar
  311. :columns="tinyint"
  312. @confirm="onWithParentLiveConfirm"
  313. @cancel="showWithParentLive = false"
  314. ></van-picker>
  315. </van-popup>
  316. <van-field
  317. readonly
  318. clickable
  319. :value="tinyint[form.want_birth]"
  320. label="是否愿意生育"
  321. placeholder="点击选择"
  322. @click="showWantBirth = true"
  323. ></van-field>
  324. <van-popup position="bottom" v-model="showWantBirth">
  325. <van-picker
  326. title="是否愿意生育"
  327. show-toolbar
  328. :columns="tinyint"
  329. @confirm="onWantBirthConfirm"
  330. @cancel="showWantBirth = false"
  331. ></van-picker>
  332. </van-popup>
  333. <!--是否吸烟-->
  334. <van-field
  335. readonly
  336. clickable
  337. :value="form.smoke"
  338. label="是否吸烟"
  339. placeholder="点击选择是否吸烟"
  340. @click="showSmoke = true"
  341. ></van-field>
  342. <van-popup position="bottom" v-model="showSmoke">
  343. <van-picker
  344. title="是否吸烟"
  345. show-toolbar
  346. :columns="smoke"
  347. @confirm="onSmokeConfirm"
  348. @cancel="showSmoke = false"
  349. ></van-picker>
  350. </van-popup>
  351. <!--是否喝酒-->
  352. <van-field
  353. readonly
  354. clickable
  355. :value="form.drink"
  356. label="是否喝酒"
  357. placeholder="点击选择是否喝酒"
  358. @click="showDrink = true"
  359. ></van-field>
  360. <van-popup position="bottom" v-model="showDrink">
  361. <van-picker
  362. title="是否喝酒"
  363. show-toolbar
  364. :columns="drink"
  365. @confirm="onDrinkConfirm"
  366. @cancel="showDrink = false"
  367. ></van-picker>
  368. </van-popup>
  369. <div style="padding:16px;">
  370. <van-button block class="bg-pink" @click="onSubmit">下一步</van-button>
  371. </div>
  372. </block>
  373. <block name="script">
  374. <script>
  375. new Vue({
  376. el: '#app',
  377. data() {
  378. return {
  379. form: {
  380. realname: '',
  381. sex: 0,
  382. mobile: '',
  383. avatar: '',
  384. birthday: '',
  385. animal: '',
  386. high: 0,
  387. weight: 0,
  388. education: '',
  389. company: '',
  390. job: '',
  391. income: '',
  392. nation: '',
  393. hobby: '',
  394. smoke: '',
  395. drink: '',
  396. family: [],
  397. native: '',
  398. live_place: '',
  399. have_house: 0,
  400. want_birth: 1,
  401. have_car: 0,
  402. with_parent_live: 0,
  403. marry: '',
  404. comment: '',
  405. },
  406. showSex: false,
  407. sex: {$sex},
  408. showBirthday: false,
  409. minDate: new Date(1970, 0, 1),
  410. showHigh: false,
  411. high: {$high},
  412. showWeight: false,
  413. weight: {$weight},
  414. showMarry: false,
  415. marry: {$marry},
  416. showEducation: false,
  417. education: {$education},
  418. showIncome: false,
  419. income: {$income},
  420. showNation: false,
  421. nation: {$nation},
  422. showTalentLevel: false,
  423. showSmoke: false,
  424. smoke: {$smoke},
  425. showDrink: false,
  426. drink: {$drink},
  427. family: {$family},
  428. showHaveHouse: false,
  429. showHaveCar: false,
  430. showWithParentLive: false,
  431. tinyint: {$tinyint},
  432. animal: {$animal},
  433. showAnimal: false,
  434. showWantBirth: false,
  435. };
  436. },
  437. methods: {
  438. in_array(search,array){
  439. for(var i in array){
  440. if(array[i] == search){
  441. return true;
  442. }
  443. }
  444. return false;
  445. },
  446. onBack() {
  447. history.back();
  448. },
  449. onSubmit() {
  450. if (this.form.realname == '') {
  451. this.$toast('请输入真实姓名');
  452. return false;
  453. }
  454. if (this.form.sex == 0) {
  455. this.$toast('请选择性别');
  456. return false;
  457. }
  458. if (this.form.birthday == '') {
  459. this.$toast('请选择正确的生日');
  460. return false;
  461. }
  462. if (this.form.animal == '') {
  463. this.$toast('请选择生肖');
  464. return false;
  465. }
  466. if (this.form.marry == '') {
  467. this.$toast('请选择婚姻状况');
  468. return false;
  469. }
  470. if (this.form.education == '') {
  471. this.$toast('请选择学历');
  472. return false;
  473. }
  474. if (this.form.income == '') {
  475. this.$toast('请选择年收入');
  476. return false;
  477. }
  478. if (this.form.company == '') {
  479. this.$toast('请输入工作单位');
  480. return false;
  481. }
  482. $.post("{:url('infoAddPost')}", this.form, function (json) {
  483. location.href = "{:url('matingAdd')}?id=" + json.data.id;
  484. }, 'json');
  485. },
  486. onBirthdayConfirm(date) {
  487. let year = date.getFullYear();
  488. let month = date.getMonth() + 1;
  489. if (month < 10) {
  490. month = "0" + month;
  491. }
  492. let day = date.getDate();
  493. if (day < 10) {
  494. day = "0" + day;
  495. }
  496. this.form.birthday = `${year}-${month}-${day}`;
  497. this.showBirthday = false;
  498. },
  499. onHighConfirm(value) {
  500. this.form.high = value == '保密' ? 0 : value;
  501. this.showHigh = false;
  502. },
  503. onWeightConfirm(value) {
  504. this.form.weight = value == '保密' ? 0 : value;
  505. this.showWeight = false;
  506. },
  507. onMarryConfirm(value) {
  508. this.form.marry = value;
  509. this.showMarry = false;
  510. },
  511. onAnimalConfirm(value) {
  512. this.form.animal = value;
  513. this.showAnimal = false;
  514. },
  515. onEducationConfirm(value) {
  516. this.form.education = value;
  517. this.showEducation = false;
  518. },
  519. onIncomeConfirm(value) {
  520. this.form.income = value;
  521. this.showIncome = false;
  522. },
  523. onNationConfirm(value) {
  524. this.form.nation = value;
  525. this.showNation = false;
  526. },
  527. onHaveHouseConfirm(value,index) {
  528. this.form.have_house = index;
  529. this.showHaveHouse = false;
  530. },
  531. onHaveCarConfirm(value,index) {
  532. this.form.have_car = index;
  533. this.showHaveCar = false;
  534. },
  535. onWithParentLiveConfirm(value,index) {
  536. this.form.with_parent_live = index;
  537. this.showWithParentLive = false;
  538. },
  539. onWantBirthConfirm(value,index){
  540. this.form.want_birth = index;
  541. this.showWantBirth = false;
  542. },
  543. onSmokeConfirm(value) {
  544. this.form.smoke = value;
  545. this.showSmoke = false;
  546. },
  547. onDrinkConfirm(value) {
  548. this.form.drink = value;
  549. this.showDrink = false;
  550. },
  551. removeByVal(arrylist , val) {
  552. for(var i = 0; i < arrylist .length; i++) {
  553. if(arrylist[i] == val) {
  554. arrylist .splice(i, 1);
  555. break;
  556. }
  557. }
  558. },
  559. selectFamily(value) {
  560. if (this.in_array(value,this.form.family)) {
  561. this.removeByVal(this.form.family,value);
  562. } else {
  563. this.form.family.push(value);
  564. }
  565. },
  566. uploadHead(file) {
  567. let self = this;
  568. $.post("{:url('imageUpload')}",{file:file.content,name:file.file.name},function(json){
  569. if (json.code) {
  570. self.form.avatar = json.data.avatar;
  571. self.$forceUpdate();
  572. } else {
  573. self.$toast(json.msg);
  574. }
  575. },'json')
  576. },
  577. },
  578. computed: {
  579. form_high() {
  580. return this.form.high ? this.form.high + 'CM' : '保密';
  581. },
  582. form_weight() {
  583. return this.form.weight ? this.form.weight + 'KG' : '保密';
  584. },
  585. head_image() {
  586. return this.form.avatar ? this.form.avatar : '__TMPL__/public/assets/images/matchmaker/avatar2.png';
  587. }
  588. },
  589. });
  590. </script>
  591. </block>