info_add.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  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. v-model="form.company"
  195. label="工作单位"
  196. placeholder="请输入工作单位"
  197. ></van-field>
  198. <van-field
  199. v-model="form.job"
  200. label="职务"
  201. placeholder="请输入职务"
  202. ></van-field>
  203. <!--家庭成员-->
  204. <van-field name="form.family" label="家庭成员">
  205. <template #input>
  206. <van-row :gutter="10">
  207. <van-col span="8" v-for="(item) in family">
  208. <div :class="{btn_search_item:true,active: in_array(item,form.family)}"
  209. @click="selectFamily(item)">
  210. {{item}}
  211. <van-icon v-if="in_array(item,form.family)"
  212. class="iconfont icon-gouxuan-youxiajiaogouxuan btn_search_icon text-pink"></van-icon>
  213. </div>
  214. </van-col>
  215. </van-row>
  216. </template>
  217. </van-field>
  218. <!--籍贯-->
  219. <van-field
  220. v-model="form.native"
  221. label="籍贯"
  222. placeholder="请输入籍贯"
  223. ></van-field>
  224. <van-field
  225. v-model="form.live_place"
  226. label="居住地"
  227. placeholder="请输入居住地"
  228. ></van-field>
  229. <!--民族-->
  230. <van-field
  231. readonly
  232. clickable
  233. :value="form.nation"
  234. label="民族"
  235. placeholder="点击选择民族"
  236. @click="showNation = true"
  237. ></van-field>
  238. <van-popup position="bottom" v-model="showNation">
  239. <van-picker
  240. title="民族"
  241. show-toolbar
  242. :columns="nation"
  243. @confirm="onNationConfirm"
  244. @cancel="showNation = false"
  245. ></van-picker>
  246. </van-popup>
  247. <!--兴趣爱好-->
  248. <van-field
  249. v-model="form.hobby"
  250. autosize
  251. label="兴趣爱好"
  252. type="textarea"
  253. placeholder="请输入兴趣爱好"
  254. ></van-field>
  255. <h3 class="fz16 mb10 pt20 plr12">工作生活</h3>
  256. <!--房车,与父母同住-->
  257. <van-field
  258. readonly
  259. clickable
  260. :value="tinyint[form.have_house]"
  261. label="是否有房"
  262. placeholder="点击选择是否有房"
  263. @click="showHaveHouse = true"
  264. ></van-field>
  265. <van-popup position="bottom" v-model="showHaveHouse">
  266. <van-picker
  267. title="是否有房"
  268. show-toolbar
  269. :columns="tinyint"
  270. @confirm="onHaveHouseConfirm"
  271. @cancel="showHaveHouse = false"
  272. ></van-picker>
  273. </van-popup>
  274. <van-field
  275. readonly
  276. clickable
  277. :value="tinyint[form.have_car]"
  278. label="是否有车"
  279. placeholder="点击选择是否有车"
  280. @click="showHaveCar = true"
  281. ></van-field>
  282. <van-popup position="bottom" v-model="showHaveCar">
  283. <van-picker
  284. title="是否有车"
  285. show-toolbar
  286. :columns="tinyint"
  287. @confirm="onHaveCarConfirm"
  288. @cancel="showHaveCar = false"
  289. ></van-picker>
  290. </van-popup>
  291. <van-field
  292. readonly
  293. clickable
  294. :value="tinyint[form.with_parent_live]"
  295. label="婚后是否愿意与父母同住"
  296. placeholder="点击选择"
  297. @click="showWithParentLive = true"
  298. ></van-field>
  299. <van-popup position="bottom" v-model="showWithParentLive">
  300. <van-picker
  301. title="婚后是否愿意与父母同住"
  302. show-toolbar
  303. :columns="tinyint"
  304. @confirm="onWithParentLiveConfirm"
  305. @cancel="showWithParentLive = false"
  306. ></van-picker>
  307. </van-popup>
  308. <van-field
  309. readonly
  310. clickable
  311. :value="tinyint[form.want_birth]"
  312. label="是否愿意生育"
  313. placeholder="点击选择"
  314. @click="showWantBirth = true"
  315. ></van-field>
  316. <van-popup position="bottom" v-model="showWantBirth">
  317. <van-picker
  318. title="是否愿意生育"
  319. show-toolbar
  320. :columns="tinyint"
  321. @confirm="onWantBirthConfirm"
  322. @cancel="showWantBirth = false"
  323. ></van-picker>
  324. </van-popup>
  325. <!--是否吸烟-->
  326. <van-field
  327. readonly
  328. clickable
  329. :value="form.smoke"
  330. label="是否吸烟"
  331. placeholder="点击选择是否吸烟"
  332. @click="showSmoke = true"
  333. ></van-field>
  334. <van-popup position="bottom" v-model="showSmoke">
  335. <van-picker
  336. title="是否吸烟"
  337. show-toolbar
  338. :columns="smoke"
  339. @confirm="onSmokeConfirm"
  340. @cancel="showSmoke = false"
  341. ></van-picker>
  342. </van-popup>
  343. <!--是否喝酒-->
  344. <van-field
  345. readonly
  346. clickable
  347. :value="form.drink"
  348. label="是否喝酒"
  349. placeholder="点击选择是否喝酒"
  350. @click="showDrink = true"
  351. ></van-field>
  352. <van-popup position="bottom" v-model="showDrink">
  353. <van-picker
  354. title="是否喝酒"
  355. show-toolbar
  356. :columns="drink"
  357. @confirm="onDrinkConfirm"
  358. @cancel="showDrink = false"
  359. ></van-picker>
  360. </van-popup>
  361. <div style="padding:16px;">
  362. <van-button block class="bg-pink" @click="onSubmit">下一步</van-button>
  363. </div>
  364. </block>
  365. <block name="script">
  366. <script>
  367. new Vue({
  368. el: '#app',
  369. data() {
  370. return {
  371. form: {
  372. realname: '',
  373. sex: 0,
  374. mobile: '',
  375. avatar: '',
  376. birthday: '',
  377. animal: '',
  378. high: 0,
  379. weight: 0,
  380. education: '',
  381. company: '',
  382. job: '',
  383. income: '',
  384. nation: '',
  385. hobby: '',
  386. smoke: '',
  387. drink: '',
  388. family: [],
  389. native: '',
  390. live_place: '',
  391. have_house: 0,
  392. want_birth: 1,
  393. have_car: 0,
  394. with_parent_live: 0,
  395. marry: '',
  396. },
  397. showSex: false,
  398. sex: {$sex},
  399. showBirthday: false,
  400. minDate: new Date(1970, 0, 1),
  401. showHigh: false,
  402. high: {$high},
  403. showWeight: false,
  404. weight: {$weight},
  405. showMarry: false,
  406. marry: {$marry},
  407. showEducation: false,
  408. education: {$education},
  409. showIncome: false,
  410. income: {$income},
  411. showNation: false,
  412. nation: {$nation},
  413. showTalentLevel: false,
  414. showSmoke: false,
  415. smoke: {$smoke},
  416. showDrink: false,
  417. drink: {$drink},
  418. family: {$family},
  419. showHaveHouse: false,
  420. showHaveCar: false,
  421. showWithParentLive: false,
  422. tinyint: {$tinyint},
  423. animal: {$animal},
  424. showAnimal: false,
  425. showWantBirth: false,
  426. };
  427. },
  428. methods: {
  429. in_array(search,array){
  430. for(var i in array){
  431. if(array[i] == search){
  432. return true;
  433. }
  434. }
  435. return false;
  436. },
  437. onBack() {
  438. history.back();
  439. },
  440. onSubmit() {
  441. if (this.form.realname == '') {
  442. this.$toast('请输入真实姓名');
  443. return false;
  444. }
  445. if (this.form.sex == 0) {
  446. this.$toast('请选择性别');
  447. return false;
  448. }
  449. if (this.form.birthday == '') {
  450. this.$toast('请选择正确的生日');
  451. return false;
  452. }
  453. if (this.form.animal == '') {
  454. this.$toast('请选择生肖');
  455. return false;
  456. }
  457. if (this.form.marry == '') {
  458. this.$toast('请选择婚姻状况');
  459. return false;
  460. }
  461. if (this.form.education == '') {
  462. this.$toast('请选择学历');
  463. return false;
  464. }
  465. if (this.form.income == '') {
  466. this.$toast('请选择年收入');
  467. return false;
  468. }
  469. $.post("{:url('infoAddPost')}", this.form, function (json) {
  470. location.href = "{:url('matingAdd')}?id=" + json.data.id;
  471. }, 'json');
  472. },
  473. onBirthdayConfirm(date) {
  474. let year = date.getFullYear();
  475. let month = date.getMonth() + 1;
  476. if (month < 10) {
  477. month = "0" + month;
  478. }
  479. let day = date.getDate();
  480. if (day < 10) {
  481. day = "0" + day;
  482. }
  483. this.form.birthday = `${year}-${month}-${day}`;
  484. this.showBirthday = false;
  485. },
  486. onHighConfirm(value) {
  487. this.form.high = value == '保密' ? 0 : value;
  488. this.showHigh = false;
  489. },
  490. onWeightConfirm(value) {
  491. this.form.weight = value == '保密' ? 0 : value;
  492. this.showWeight = false;
  493. },
  494. onMarryConfirm(value) {
  495. this.form.marry = value;
  496. this.showMarry = false;
  497. },
  498. onAnimalConfirm(value) {
  499. this.form.animal = value;
  500. this.showAnimal = false;
  501. },
  502. onEducationConfirm(value) {
  503. this.form.education = value;
  504. this.showEducation = false;
  505. },
  506. onIncomeConfirm(value) {
  507. this.form.income = value;
  508. this.showIncome = false;
  509. },
  510. onNationConfirm(value) {
  511. this.form.nation = value;
  512. this.showNation = false;
  513. },
  514. onHaveHouseConfirm(value,index) {
  515. this.form.have_house = index;
  516. this.showHaveHouse = false;
  517. },
  518. onHaveCarConfirm(value,index) {
  519. this.form.have_car = index;
  520. this.showHaveCar = false;
  521. },
  522. onWithParentLiveConfirm(value,index) {
  523. this.form.with_parent_live = index;
  524. this.showWithParentLive = false;
  525. },
  526. onWantBirthConfirm(value,index){
  527. this.form.want_birth = index;
  528. this.showWantBirth = false;
  529. },
  530. onSmokeConfirm(value) {
  531. this.form.smoke = value;
  532. this.showSmoke = false;
  533. },
  534. onDrinkConfirm(value) {
  535. this.form.drink = value;
  536. this.showDrink = false;
  537. },
  538. removeByVal(arrylist , val) {
  539. for(var i = 0; i < arrylist .length; i++) {
  540. if(arrylist[i] == val) {
  541. arrylist .splice(i, 1);
  542. break;
  543. }
  544. }
  545. },
  546. selectFamily(value) {
  547. if (this.in_array(value,this.form.family)) {
  548. this.removeByVal(this.form.family,value);
  549. } else {
  550. this.form.family.push(value);
  551. }
  552. },
  553. uploadHead(file) {
  554. let self = this;
  555. $.post("{:url('imageUpload')}",{file:file.content,name:file.file.name},function(json){
  556. if (json.code) {
  557. self.form.avatar = json.data.avatar;
  558. self.$forceUpdate();
  559. } else {
  560. self.$toast(json.msg);
  561. }
  562. },'json')
  563. },
  564. },
  565. computed: {
  566. form_high() {
  567. return this.form.high ? this.form.high + 'CM' : '保密';
  568. },
  569. form_weight() {
  570. return this.form.weight ? this.form.weight + 'KG' : '保密';
  571. },
  572. head_image() {
  573. return this.form.avatar ? this.form.avatar : '__TMPL__/public/assets/images/matchmaker/avatar2.png';
  574. }
  575. },
  576. });
  577. </script>
  578. </block>