targetInfo.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  1. import WxValidate from '../../utils/WxValidate.js';
  2. const app = require('../../utils/util.js');
  3. const tool = require('../../utils/tool.js');
  4. Page({
  5. data: {
  6. form: {
  7. ageMin: '',
  8. ageMax: '',
  9. heightMin: '',
  10. heightMax: '',
  11. education: '',
  12. income: '',
  13. nativePlace: '',
  14. marriage: '',
  15. assetHouse: '',
  16. assetHouseArea: '',
  17. // assetHouseLoan: '',
  18. assetCar: '',
  19. assetCarValue: '',
  20. // assetCarLoan: '',
  21. constellation: '',
  22. workStatus: '',
  23. companyNature: '',
  24. parentAssets: '',
  25. composition: '',
  26. isCommon: '',
  27. id: ''
  28. },
  29. educationArr: [],
  30. incomeArr: [],
  31. nativePlaceArr: [],
  32. marriageArr: [],
  33. constellationArr: [],
  34. workStatusArr: [],
  35. assetHouseArr: ['租房', '购房', '咋的都行'],
  36. assetHouseAreaArr: [],
  37. // assetHouseLoanArr: ['有', '没有', '咋的都行'],
  38. assetCarArr: ['咋的都行','有', '没有'],
  39. assetCarValueArr: [],
  40. // assetCarLoanArr: ['不行', '行', '咋的都行'],
  41. companyNatureArr: [],
  42. parentAssetsArr: [],
  43. compositionArr: [],
  44. isCommonArr: ['愿意', '不愿意', '咋的都行']
  45. },
  46. ageMinChange(e) {
  47. let ageMin = 'form.ageMin'
  48. this.setData({
  49. [ageMin]: e.detail.value
  50. })
  51. },
  52. ageMaxChange(e) {
  53. let ageMax = 'form.ageMax'
  54. this.setData({
  55. [ageMax]: e.detail.value
  56. })
  57. },
  58. heightMinChange(e) {
  59. let heightMin = 'form.heightMin'
  60. this.setData({
  61. [heightMin]: e.detail.value
  62. })
  63. },
  64. heightMaxChange(e) {
  65. let heightMax = 'form.heightMax'
  66. this.setData({
  67. [heightMax]: e.detail.value
  68. })
  69. },
  70. educationPicker(e) {
  71. let education = 'form.education'
  72. this.setData({
  73. educationLabel: this.data.educationArr[e.detail.value],
  74. [education]: this.data.educationArrValue[e.detail.value]
  75. })
  76. },
  77. incomePicker(e) {
  78. let income = 'form.income'
  79. this.setData({
  80. incomeLabel: this.data.incomeArr[e.detail.value],
  81. [income]: this.data.incomeArrValue[e.detail.value]
  82. })
  83. },
  84. nativePlacePicker(e) {
  85. let nativePlace = 'form.nativePlace';
  86. this.setData({
  87. nativePlaceLabel: this.data.nativePlaceArr[e.detail.value],
  88. [nativePlace]: this.data.nativePlaceArrValue[e.detail.value],
  89. })
  90. },
  91. marriageChange(e) {
  92. let marriage = 'form.marriage';
  93. this.setData({
  94. marriageLabel: this.data.marriageArr[e.detail.value],
  95. [marriage]: this.data.marriageArrValue[e.detail.value]
  96. })
  97. },
  98. assetHousePickerChange(e) {
  99. let assetHouse = 'form.assetHouse';
  100. this.setData({
  101. assetHouseLabel: this.data.assetHouseArr[e.detail.value]
  102. })
  103. if (e.detail.value != 2) {
  104. this.setData({
  105. [assetHouse]: e.detail.value
  106. })
  107. }
  108. },
  109. assetHouseAreaPickerChange(e) {
  110. let assetHouseArea = 'form.assetHouseArea'
  111. this.setData({
  112. assetHouseAreaLabel: this.data.assetHouseAreaArr[e.detail.value],
  113. [assetHouseArea]: this.data.assetHouseAreaArrValue[e.detail.value]
  114. })
  115. },
  116. // assetHouseLoanPickerChange(e) {
  117. // let assetHouseLoan = 'form.assetHouseLoan';
  118. // this.setData({
  119. // assetHouseLoanLabel: this.data.assetHouseLoanArr[e.detail.value]
  120. // })
  121. // if (e.detail.value != 2) {
  122. // this.setData({
  123. // [assetHouseLoan]: e.detail.value
  124. // })
  125. // }
  126. // },
  127. assetCarPickerChange(e) {
  128. console.log(e.detail.value)
  129. console.log(this.data.assetCarArr[e.detail.value])
  130. let assetCar = 'form.assetCar';
  131. this.setData({
  132. assetCarLabel: this.data.assetCarArr[e.detail.value],
  133. [assetCar]: e.detail.value
  134. })
  135. // if (e.detail.value != 2) {
  136. // this.setData({
  137. // [assetCar]: e.detail.value
  138. // })
  139. // }
  140. },
  141. assetCarValuePickerChange(e) {
  142. let assetCarValue = 'form.assetCarValue'
  143. this.setData({
  144. assetCarValueLabel: this.data.assetCarValueArr[e.detail.value],
  145. [assetCarValue]: this.data.assetCarValueArrValue[e.detail.value]
  146. })
  147. },
  148. // assetCarLoanPickerChange(e) {
  149. // let assetCarLoan = 'form.assetCarLoan';
  150. // this.setData({
  151. // assetCarLoanLabel: this.data.assetCarLoanArr[e.detail.value]
  152. // })
  153. // if (e.detail.value != 2) {
  154. // this.setData({
  155. // [assetCarLoan]: e.detail.value
  156. // })
  157. // }
  158. // },
  159. constellationPicker(e) {
  160. console.log(e.detail.value)
  161. const items = this.data.constellationArr;
  162. const values = e.detail.value;
  163. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  164. items[i].checked = false
  165. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  166. if (items[i].value === values[j]) {
  167. items[i].checked = true
  168. break
  169. }
  170. }
  171. }
  172. let constellation = 'form.constellation'
  173. this.setData({
  174. constellationArr: this.data.constellationArr,
  175. [constellation]: e.detail.value
  176. })
  177. },
  178. workStatusChange(e) {
  179. console.log(e.detail.value)
  180. const items = this.data.workStatusArr;
  181. const values = e.detail.value;
  182. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  183. items[i].checked = false
  184. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  185. if (items[i].value === values[j]) {
  186. items[i].checked = true
  187. break
  188. }
  189. }
  190. }
  191. let workStatus = 'form.workStatus'
  192. this.setData({
  193. workStatusArr: this.data.workStatusArr,
  194. [workStatus]: e.detail.value
  195. })
  196. },
  197. companyNaturePicker: function (e) {
  198. // let companyNature = 'form.companyNature'
  199. // this.setData({
  200. // companyNatureLabel: this.data.companyNatureArr[e.detail.value],
  201. // [companyNature]: this.data.companyNatureArrValue[e.detail.value]
  202. // })
  203. console.log(e.detail.value)
  204. const items = this.data.companyNatureArr;
  205. const values = e.detail.value;
  206. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  207. items[i].checked = false
  208. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  209. if (items[i].value === values[j]) {
  210. items[i].checked = true
  211. break
  212. }
  213. }
  214. }
  215. let companyNature = 'form.companyNature'
  216. this.setData({
  217. companyNatureArr: this.data.companyNatureArr,
  218. [companyNature]: e.detail.value
  219. })
  220. },
  221. parentAssetsPicker(e) {
  222. let parentAssets = 'form.parentAssets'
  223. this.setData({
  224. parentAssetsLabel: this.data.parentAssetsArr[e.detail.value],
  225. [parentAssets]: this.data.parentAssetsArrValue[e.detail.value]
  226. })
  227. },
  228. compositionPicker(e) {
  229. let composition = 'form.composition'
  230. this.setData({
  231. [composition]: this.data.compositionArrValue[e.detail.value],
  232. compositionLabel: this.data.compositionArr[e.detail.value]
  233. })
  234. },
  235. isCommonPicker(e) {
  236. let isCommon = 'form.isCommon'
  237. this.setData({
  238. [isCommon]: e.detail.value,
  239. isCommonLabel: this.data.isCommonArr[e.detail.value]
  240. })
  241. },
  242. getInfos() {
  243. wx.showLoading();
  244. wx.request({
  245. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/standard',
  246. method: "get",
  247. success: (res) => {
  248. console.log(res.data.standard, '我是获取的信息')
  249. let ageMin = 'form.ageMin';
  250. let ageMax = 'form.ageMax';
  251. let heightMin = 'form.heightMin';
  252. let heightMax = 'form.heightMax';
  253. let income = 'form.income';
  254. let nativePlace = 'form.nativePlace';
  255. let education = 'form.education';
  256. let marriage = 'form.marriage';
  257. let assetHouse = 'form.assetHouse';
  258. let assetHouseArea = 'form.assetHouseArea';
  259. // let assetHouseLoan = 'form.assetHouseLoan';
  260. let assetCar = 'form.assetCar';
  261. let assetCarValue = 'form.assetCarValue';
  262. // let assetCarLoan = 'form.assetCarLoan';
  263. let constellation = 'form.constellation';
  264. let workStatus = 'form.workStatus';
  265. let companyNature = 'form.companyNature';
  266. let composition = 'form.composition';
  267. let parentAssets = 'form.parentAssets';
  268. let isCommon = 'form.isCommon';
  269. let id = 'form.id'
  270. if (res.data.standard) {
  271. this.setData({
  272. [ageMin]: res.data.standard.ageMin,
  273. [ageMax]: res.data.standard.ageMax,
  274. [heightMin]: res.data.standard.heightMin,
  275. [heightMax]: res.data.standard.heightMax,
  276. // nativePlaceLabel: this.data.nativePlaceArr[res.data.standard.nativePlace],
  277. // [nativePlace]: res.data.standard.nativePlace,
  278. // marriageLabel: this.data.marriageArr[res.data.standard.marriage],
  279. // [marriage]: res.data.standard.marriage,
  280. assetHouseLabel: this.data.assetHouseArr[res.data.standard.assetHouse],
  281. [assetHouse]: res.data.standard.assetHouse,
  282. assetHouseAreaLabel: this.data.assetHouseAreaArr[res.data.standard.assetHouseArea],
  283. [assetHouseArea]: res.data.standard.assetHouseArea,
  284. // assetHouseLoanLabel: this.data.assetHouseLoanArr[res.data.standard.assetHouseLoan],
  285. // [assetHouseLoan]: res.data.standard.assetHouseLoan,
  286. assetCarLabel: this.data.assetCarArr[res.data.standard.assetCar],
  287. [assetCar]: res.data.standard.assetCar,
  288. // assetCarLoanLabel: this.data.assetCarLoanArr[res.data.standard.assetCarLoan],
  289. // [assetCarLoan]: res.data.standard.assetCarLoan,
  290. compositionLabel: this.data.compositionArr[res.data.standard.composition],
  291. [composition]: res.data.standard.composition,
  292. isCommonLabel: this.data.isCommonArr[res.data.standard.isCommon],
  293. [isCommon]: res.data.standard.isCommon,
  294. [id]: res.data.standard.id
  295. })
  296. }
  297. tool.formDetails('he_is_no').then(result => {
  298. this.setData({
  299. nativePlaceArr: ['咋的都行'].concat(result[0]),
  300. nativePlaceArrValue: ['0'].concat(result[1]),
  301. })
  302. if (res.data.standard.nativePlace) {
  303. for (let i = 0; i < ['0'].concat(result[1]).length; i++) {
  304. if (res.data.standard.nativePlace == ['0'].concat(result[1])[i]) {
  305. this.setData({
  306. nativePlaceLabel: ['咋的都行'].concat(result[0])[i],
  307. [nativePlace]: res.data.standard.nativePlace
  308. })
  309. }
  310. }
  311. }
  312. })
  313. tool.formDetails('he_divorce').then(result => {
  314. console.log(result)
  315. this.setData({
  316. marriageArr: ['咋的都行'].concat(result[0]),
  317. marriageArrValue: ['0'].concat(result[1]),
  318. })
  319. if (res.data.standard.marriage) {
  320. for (let i = 0; i < [''].concat(result[1]).length; i++) {
  321. if (res.data.standard.marriage == ['0'].concat(result[1])[i]) {
  322. this.setData({
  323. marriageLabel: ['咋的都行'].concat(result[0])[i],
  324. [marriage]: res.data.standard.marriage
  325. })
  326. }
  327. }
  328. }
  329. })
  330. tool.formDetails('he_education').then(result => {
  331. this.setData({
  332. educationArr: ['咋的都行'].concat(result[0]),
  333. educationArrValue: ['0'].concat(result[1]),
  334. })
  335. if (res.data.standard.education) {
  336. for (let i = 0; i < ['0'].concat(result[1]).length; i++) {
  337. if (res.data.standard.education == ['0'].concat(result[1])[i]) {
  338. this.setData({
  339. educationLabel: ['咋的都行'].concat(result[0])[i],
  340. [education]: res.data.standard.education
  341. })
  342. }
  343. }
  344. }
  345. })
  346. tool.formDetails('he_income').then(result => {
  347. this.setData({
  348. incomeArr: ['咋的都行'].concat(result[0]),
  349. incomeArrValue: ['0'].concat(result[1])
  350. })
  351. if (res.data.standard) {
  352. for (let i = 0; i < [''].concat(result[1]).length; i++) {
  353. if (res.data.standard.income == ['0'].concat(result[1])[i]) {
  354. this.setData({
  355. incomeLabel: ['咋的都行'].concat(result[0])[i],
  356. [income]: res.data.standard.income
  357. })
  358. }
  359. }
  360. }
  361. })
  362. tool.formDetails('he_asset_house_area').then(result => {
  363. this.setData({
  364. assetHouseAreaArr: ['咋的都行'].concat(result[0]),
  365. assetHouseAreaArrValue: ['0'].concat(result[1])
  366. })
  367. if (res.data.standard) {
  368. for (let i = 0; i < [''].concat(result[1]).length; i++) {
  369. if (res.data.standard.assetHouseArea == ['0'].concat(result[1])[i]) {
  370. this.setData({
  371. assetHouseAreaLabel: ['咋的都行'].concat(result[0])[i],
  372. [assetHouseArea]: res.data.standard.assetHouseArea
  373. })
  374. }
  375. }
  376. }
  377. })
  378. tool.formDetails('he_asset_car_value').then(result => {
  379. this.setData({
  380. assetCarValueArr: ['咋的都行'].concat(result[0]),
  381. assetCarValueArrValue: ['0'].concat(result[1])
  382. })
  383. if (res.data.standard) {
  384. for (let i = 0; i < [''].concat(result[1]).length; i++) {
  385. if (res.data.standard.assetCarValue == ['0'].concat(result[1])[i]) {
  386. this.setData({
  387. assetCarValueLabel: ['咋的都行'].concat(result[0])[i],
  388. [assetCarValue]: res.data.standard.assetCarValue
  389. })
  390. }
  391. }
  392. }
  393. })
  394. tool.formDetails('he_astrology').then(result => {
  395. let constellationArr = result[0].map((item, index) => {
  396. return Object.assign({}, {
  397. 'name': item,
  398. 'value': item,
  399. 'checked': false
  400. })
  401. })
  402. console.log(result);
  403. if (res.data.standard) {
  404. let resComposition = res.data.standard.constellation.split(",");
  405. let resCompositionIndexArr = [];
  406. for (let i = 0; i < resComposition.length; i++) {
  407. for (let j = 0; j < result[1].length; j++) {
  408. if (resComposition[i] == result[1][j]) {
  409. resCompositionIndexArr.push(i)
  410. }
  411. }
  412. }
  413. let resCompositionLabel = [];
  414. for (let i = 0; i < resCompositionIndexArr.length; i++) {
  415. resCompositionLabel.push(result[0][resCompositionIndexArr[i]])
  416. }
  417. for (let i = 0; i < resCompositionLabel.length; i++) {
  418. if (resCompositionLabel[i] == constellationArr[i].value) {
  419. constellationArr[i].checked = true;
  420. }
  421. }
  422. this.setData({
  423. [constellation]: resCompositionLabel
  424. })
  425. }
  426. this.setData({
  427. constellationArr: constellationArr,
  428. constellationArrLabel: result[0],
  429. constellationArrValue: result[1],
  430. })
  431. })
  432. tool.formDetails('he_work_status').then(result => {
  433. let workStatusArr = result[0].map((item, index) => {
  434. return Object.assign({}, {
  435. 'name': item,
  436. 'value': item,
  437. 'checked': false
  438. })
  439. })
  440. if (res.data.standard) {
  441. let resWorkStatus = res.data.standard.workStatus.split(",");
  442. let resWorkStatusIndexArr = [];
  443. for (let i = 0; i < resWorkStatus.length; i++) {
  444. for (let j = 0; j < result[1].length; j++) {
  445. if (resWorkStatus[i] == result[1][j]) {
  446. resWorkStatusIndexArr.push(i)
  447. }
  448. }
  449. }
  450. let resWorkStatusLabel = [];
  451. for (let i = 0; i < resWorkStatusIndexArr.length; i++) {
  452. resWorkStatusLabel.push(result[0][resWorkStatusIndexArr[i]])
  453. }
  454. for (let i = 0; i < resWorkStatusLabel.length; i++) {
  455. if (resWorkStatusLabel[i] == workStatusArr[i].value) {
  456. workStatusArr[i].checked = true;
  457. }
  458. }
  459. this.setData({
  460. [workStatus]: resWorkStatusLabel
  461. })
  462. }
  463. this.setData({
  464. workStatusArr: workStatusArr,
  465. workStatusArrLabel: result[0],
  466. workStatusArrValue: result[1],
  467. })
  468. })
  469. tool.formDetails('he_company_nature').then(result => {
  470. let companyNatureArr = result[0].map((item, index) => {
  471. return Object.assign({}, {
  472. 'name': item,
  473. 'value': item,
  474. 'checked': false
  475. })
  476. })
  477. if (res.data.standard.companyNature) {
  478. let rescompanyNature = res.data.standard.companyNature.split(",");
  479. let recompanyNatureIndexArr = [];
  480. for (let i = 0; i < rescompanyNature.length; i++) {
  481. for (let j = 0; j < result[1].length; j++) {
  482. if (rescompanyNature[i] == result[1][j]) {
  483. recompanyNatureIndexArr.push(i)
  484. }
  485. }
  486. }
  487. let rescompanyNatureLabel = [];
  488. for (let i = 0; i < recompanyNatureIndexArr.length; i++) {
  489. rescompanyNatureLabel.push(result[0][recompanyNatureIndexArr[i]])
  490. }
  491. for (let i = 0; i < rescompanyNatureLabel.length; i++) {
  492. if (rescompanyNatureLabel[i] == companyNatureArr[i].value) {
  493. companyNatureArr[i].checked = true;
  494. }
  495. }
  496. this.setData({
  497. [companyNature]: rescompanyNatureLabel
  498. })
  499. }
  500. this.setData({
  501. companyNatureArr: companyNatureArr,
  502. companyNatureArrLabel: result[0],
  503. companyNatureArrValue: result[1],
  504. })
  505. })
  506. tool.formDetails('he_composition_agree').then(result => {
  507. this.setData({
  508. compositionArr: ['咋的都行'].concat(result[0]),
  509. compositionArrValue: ['0'].concat(result[1])
  510. })
  511. if (res.data.standard.composition) {
  512. for (let i = 0; i < [''].concat(result[1]).length; i++) {
  513. if (res.data.standard.composition == ['0'].concat(result[1])[i]) {
  514. this.setData({
  515. compositionLabel: ['咋的都行'].concat(result[0])[i],
  516. [composition]: res.data.standard.composition
  517. })
  518. }
  519. }
  520. }
  521. })
  522. tool.formDetails('he_parent_assets').then(result => {
  523. this.setData({
  524. parentAssetsArr: ['咋的都行'].concat(result[0]),
  525. parentAssetsArrValue: ['0'].concat(result[1])
  526. })
  527. if (res.data.standard) {
  528. for (let i = 0; i < [''].concat(result[1]).length; i++) {
  529. if (res.data.standard.parentAssets == ['0'].concat(result[1])[i]) {
  530. this.setData({
  531. parentAssetsLabel: ['咋的都行'].concat(result[0])[i],
  532. [parentAssets]: res.data.standard.parentAssets
  533. })
  534. }
  535. }
  536. }
  537. })
  538. },
  539. complete: () => {
  540. wx.hideLoading()
  541. }
  542. })
  543. },
  544. formSubmit(e) {
  545. const params = e.detail.value
  546. //校验表单
  547. if (!this.WxValidate.checkForm(params)) {
  548. const error = this.WxValidate.errorList[0]
  549. this.showModal(error)
  550. return false
  551. }
  552. let constellation = 'form.constellation'
  553. let workStatus = 'form.workStatus'
  554. let companyNature='form.companyNature'
  555. let indexArr = [];
  556. for (let i = 0; i < params.constellation.length; i++) {
  557. indexArr.push(this.data.constellationArrLabel.indexOf(params.constellation[i]))
  558. }
  559. let value = [];
  560. for (let i = 0; i < indexArr.length; i++) {
  561. value.push(this.data.constellationArrValue[indexArr[i]])
  562. }
  563. let str = '';
  564. for (let i = 0; i < value.length; i++) {
  565. str += value[i] + ','
  566. }
  567. let indexArr2 = [];
  568. for (let i = 0; i < params.workStatus.length; i++) {
  569. indexArr2.push(this.data.workStatusArrLabel.indexOf(params.workStatus[i]))
  570. }
  571. let value2 = [];
  572. for (let i = 0; i < indexArr2.length; i++) {
  573. value2.push(this.data.workStatusArrValue[indexArr2[i]])
  574. }
  575. let str2 = '';
  576. for (let i = 0; i < value2.length; i++) {
  577. str2 += value2[i] + ','
  578. }
  579. let indexArr3 = [];
  580. for (let i = 0; i < params.companyNature.length; i++) {
  581. indexArr3.push(this.data.companyNatureArrLabel.indexOf(params.companyNature[i]))
  582. }
  583. let value3 = [];
  584. for (let i = 0; i < indexArr3.length; i++) {
  585. value3.push(this.data.companyNatureArrValue[indexArr3[i]])
  586. }
  587. let str3 = '';
  588. for (let i = 0; i < value3.length; i++) {
  589. str3 += value3[i] + ','
  590. }
  591. this.setData({
  592. [constellation]: str.slice(0, str.length - 1),
  593. [workStatus]: str2.slice(0, str2.length - 1),
  594. [companyNature]:str3.slice(0, str3.length - 1)
  595. })
  596. console.log(this.data.form)
  597. wx.request({
  598. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/standard',
  599. method: "POST",
  600. header: {
  601. 'content-type': 'application/x-www-form-urlencoded',
  602. },
  603. data: this.data.form,
  604. success: (res) => {
  605. console.log(res)
  606. if (res.data.code == 0) {
  607. wx.showModal({
  608. title: '上传成功',
  609. showCancel: false,
  610. success(res) {
  611. if (res.confirm) {
  612. wx.redirectTo({
  613. url: '/pages/index/index',
  614. })
  615. }
  616. }
  617. });
  618. }
  619. }
  620. })
  621. },
  622. showModal(error) {
  623. wx.showModal({
  624. content: error.msg,
  625. showCancel: false,
  626. })
  627. },
  628. //验证函数
  629. initValidate() {
  630. const rules = {
  631. ageMin: {
  632. required: true
  633. },
  634. ageMax: {
  635. required: true
  636. },
  637. heightMin: {
  638. required: true
  639. },
  640. heightMax: {
  641. required: true
  642. },
  643. education: {
  644. required: true
  645. },
  646. income: {
  647. required: true
  648. },
  649. nativePlace: {
  650. required: true
  651. },
  652. marriage: {
  653. required: true
  654. },
  655. assetHouse: {
  656. required: true
  657. },
  658. assetHouseArea: {
  659. required: true
  660. },
  661. // assetHouseLoan: {
  662. // required: true
  663. // },
  664. assetCar: {
  665. required: true
  666. },
  667. assetCarValue: {
  668. required: true
  669. },
  670. // assetCarLoan: {
  671. // required: true
  672. // },
  673. constellation: {
  674. required: true
  675. },
  676. workStatus: {
  677. required: true
  678. },
  679. companyNature: {
  680. required: true
  681. },
  682. parentAssets: {
  683. required: true
  684. },
  685. composition: {
  686. required: true
  687. },
  688. isCommon: {
  689. required: true
  690. }
  691. }
  692. const messages = {
  693. ageMin: {
  694. required: '请输入您能接受的最小年纪呦'
  695. },
  696. ageMax: {
  697. required: '请输入您能接受的最大年纪呦'
  698. },
  699. heightMin: {
  700. required: '请输入您能接受的最低身高呦'
  701. },
  702. heightMax: {
  703. required: '请输入您能接受的最高身高呦'
  704. },
  705. education: {
  706. required: '请输入您能接受的教育程度呦'
  707. },
  708. income: {
  709. required: '请选择您能接受的收入呦'
  710. },
  711. nativePlace: {
  712. required: '请选择本地或者外地呦'
  713. },
  714. marriage: {
  715. required: '请选择您能接受的婚姻状态呦'
  716. },
  717. assetHouse: {
  718. required: '请选择您可以接受的房子状态呦'
  719. },
  720. assetHouseArea: {
  721. required: '请选择您可以接受的房子面积呦'
  722. },
  723. // assetHouseLoan: {
  724. // required: '请选择您可以接受的房子是否有贷款'
  725. // },
  726. assetCar: {
  727. required: '请选择您可以接受的车子状态呦'
  728. },
  729. assetCarValue: {
  730. required: '请选择您可以接受的车子价值呦'
  731. },
  732. // assetCarLoan: {
  733. // required: '请选择您是否可以接受的车子有贷款'
  734. // },
  735. constellation: {
  736. required: '请选择您的优先选择星座呦'
  737. },
  738. workStatus: {
  739. required: '请选择您能接受的工作状态呦'
  740. },
  741. companyNature: {
  742. required: '请选择您能接受的单位性质呦'
  743. },
  744. parentAssets: {
  745. required: '请选择您能接受的父母经济状态呦'
  746. },
  747. composition: {
  748. required: '请选择您可以接受的家庭构成呦'
  749. },
  750. isCommon: {
  751. required: '请选择您是否接受与父母同住呦'
  752. }
  753. }
  754. this.WxValidate = new WxValidate(rules, messages)
  755. },
  756. async onLoad(options) {
  757. // tool.formDetails('he_composition_agree').then(result => {
  758. // console.log(result)
  759. // })
  760. this.initValidate()
  761. tool.openidStatus().then(result => {
  762. this.setData({
  763. openid: result[0],
  764. sessionkey: result[1]
  765. })
  766. // this.getForm();
  767. this.getInfos();
  768. })
  769. },
  770. /**
  771. * 生命周期函数--监听页面初次渲染完成
  772. */
  773. onReady: function () {
  774. },
  775. /**
  776. * 生命周期函数--监听页面显示
  777. */
  778. onShow: function () {
  779. },
  780. /**
  781. * 生命周期函数--监听页面隐藏
  782. */
  783. onHide: function () {
  784. },
  785. /**
  786. * 生命周期函数--监听页面卸载
  787. */
  788. onUnload: function () {
  789. },
  790. /**
  791. * 页面相关事件处理函数--监听用户下拉动作
  792. */
  793. onPullDownRefresh: function () {
  794. },
  795. /**
  796. * 页面上拉触底事件的处理函数
  797. */
  798. onReachBottom: function () {
  799. },
  800. /**
  801. * 用户点击右上角分享
  802. */
  803. onShareAppMessage: function () {
  804. }
  805. })