赞
踩
<!-- 遍历数组 --> <view class="itemList"> <view class="item acea-row row-between-wrapper" v-for="(item, indexw) in hnUserlist" :key="indexw"> <view class="namele">{{ item.allname }}</view> <view class="listn acea-row row-middle"> <view class="itemn" :class=" item.indexOld == indexn ?'on' : '' " v-for="(itemn, indexn) in item.detailValue" @click="tapAttr(indexw, indexn,{[item.name]:itemn.value})" :key="indexn" > {{ itemn.name}} </view> </view> </view> </view> 方法 hnUserlist:[ { detailValue: [{ name: '男', value: 0 }, { name: '女', value: 1 }], indexOld: 0, allname: "性别", name: 'sex1' }, { detailValue: [{ name: '社区居民', value: 0 }, { name: '非社区', value: 1 }], indexOld: 1, allname: "常驻类型", name: "reside1", }】 methods: { bindDateChange: function(res) { this.birthday1 = res.target.value console.log(res.detail.value) }, getDate(type) { const date = new Date(); let year = date.getFullYear(); let month = date.getMonth() + 1; let day = date.getDate(); if (type === 'start') { year = year - 60; } else if (type === 'end') { year = year + 2; } month = month > 9 ? month : '0' + month;; day = day > 9 ? day : '0' + day; return `${year}-${month}-${day}`; }, initHnUser: function(res) { let that = this; }, tapAttr: function(indexw, indexn,value) { //注释的是两种方法 /* this.clickArr[indexw] ? this.clickArr.splice(indexw, 0,{indexw: indexw, indexn: indexn,value: value}) : this.clickArr.push({indexw: indexw, indexn: indexn, value: value}) */ this.hnUserlist[indexw].indexOld = indexn; if (indexw == 0) { this.addressData.sex1 = indexn } else if (indexw == 1) { this.addressData.reside1 = indexn } else if (indexw == 2) { this.addressData.nation1 = indexn } else if (indexw == 3) { this.addressData.bloodYype1 = indexn } else if (indexw == 4) { this.addressData.standardCulture1 = indexn } else if (indexw == 5) { this.addressData.profession1 = indexn } else if (indexw == 6) { this.addressData.marriageStatus1 = indexn } else if (indexw == 7) { this.addressData.healthProducts1 = indexn } else if (indexw == 8) { this.addressData.takeExercise1 = indexn } else if (indexw == 9) { this.addressData.communityActivity1 = indexn } else if (indexw == 10) { this.addressData.healthSurvey1 = indexn } /* let that = this; */ console.log(this.clickArr); console.log("indexw", indexw); console.log("indexn", indexn); /* this.sex1 = this.clickArr.sex.value; */ /* this.sex1 = this.hnUserlist[indexw].indexOld = indexn; this.reside1 = this.hnUserlist[indexw].indexOld = indexn; */ /* this.nation1 = this.hnUserlist[indexw].indexOld= indexn; this.bloodYype1 = this.hnUserlist[indexw].indexOld= indexn; this.standardCulture1 = this.hnUserlist[indexw].indexOld= indexn; this.profession1 = this.hnUserlist[indexw].indexOld= indexn; this.marriageStatus1 = this.hnUserlist[indexw].indexOld= indexn; this.healthProducts1 = this.hnUserlist[indexw].indexOld= indexn; this.takeExercise1 = this.hnUserlist[indexw].indexOld= indexn; this.communityActivity1 = this.hnUserlist[indexw].indexOld= indexn; this.healthSurvey1 = this.hnUserlist[indexw].indexOld= indexn; */ }, //提交 submit(e){ //这里是转义的意思 /* this.clickArr.reduce((pre,cur) =>{ return Object.assign(pre,cur) },{}) console.log({...this.clickArr.map(v => v.value)}) console.log(this.clickArr.reduce((pre,cur) =>{ return Object.assign(pre,cur) },{})) */ /* var data = e.detail.value */ let data = this.addressData console.log('this.addressData', this.addressData) console.log(this.data) postUsermessage({ sex: data.sex1, reside: data.reside1, realName: this.addressData.realName1, mobile: this.addressData.mobile1, examinationTimes: this.addressData.examinationTimes1, subHealthRemark: this.addressData.subHealthRemark1, xryTimes: this.addressData.xryTimes1, xryExperience: this.addressData.xryExperience1, xqjTimes: this.addressData.xqjTimes1, xqjExperience: this.addressData.xqjExperience1, fqsTimes: this.addressData.fqsTimes1, fqsExperience: this.addressData.fqsExperience1, birthday: this.currentDate, nation: data.nation1, bloodYype: data.bloodYype1, standardCulture: data.standardCulture1, profession: data.profession1, marriageStatus: data.marriageStatus1, healthProducts: data.healthProducts1, takeExercise: data.takeExercise1, communityActivity: data.communityActivity1, healthSurvey: data.healthSurvey1, }) .then((res) => { handleOrderPayResults.call(this, res.data, "create", this.active); })
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。