info_edit.html 19 KB

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