info_edit.html 19 KB

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