diff --git a/pages/home/register.vue b/pages/home/register.vue index 043ee87..38f595f 100644 --- a/pages/home/register.vue +++ b/pages/home/register.vue @@ -77,12 +77,27 @@ export default { else call(); }, trigger:"blur"}, }, + adderss:{} } }, onload(){ }, - onShow(){ + async onShow(){ + //#ifdef APP-PLUS + await new Promise(resolve=>{ + uni.getLocation({ + type:"gcj02", + geocode:true, + altitude:true, + isHighAccuracy:true, + success:res=>{ + this.adderss=res.address + }, + complete:resolve + }) + }) + //#endif this.init() }, methods:{ @@ -93,6 +108,16 @@ export default { }) if(res.statu){ this.fields.type.columns=[res.data] + res.data.forEach(i=>{ + if(i.label==this.adderss.city){ + i.children.forEach(j=>{ + if(j.label==this.adderss.district){ + this.fields.areaCode.value=[i.value,j.value] + this.formData.areaCode=j.value + } + }) + } + }) }else{ uni.showModal({ title:"提示",