targetInfo.js 27 KB

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