Browse Source

注册页面 添加定位

master
邓宏 2 years ago
parent
commit
70e7b2a026
  1. 27
      pages/home/register.vue

27
pages/home/register.vue

@ -77,12 +77,27 @@ export default {
else call(); else call();
}, trigger:"blur"}, }, trigger:"blur"},
}, },
adderss:{}
} }
}, },
onload(){ 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() this.init()
}, },
methods:{ methods:{
@ -93,6 +108,16 @@ export default {
}) })
if(res.statu){ if(res.statu){
this.fields.type.columns=[res.data] 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{ }else{
uni.showModal({ uni.showModal({
title:"提示", title:"提示",

Loading…
Cancel
Save