info_edit.html 17 KB

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