邓洁 : 地址转为经纬度函数

This commit is contained in:
dengj
2023-11-15 17:43:52 +08:00
parent f7537b0b82
commit 830b5482f0
3 changed files with 25 additions and 7 deletions

View File

@@ -51,8 +51,8 @@
methods: {
getBanner(){
this.$api.getBanner().then(res=>{
console.log('lunbo',res.data.data);
this.swiperList = res.data.data.map(item=>item.img)
console.log('轮播图',res.data.data);
this.swiperList = res.data.data.map(item=>this.$api.imgUrl+item.img)
})
},
getNotice(){

View File

@@ -20,7 +20,7 @@
</u-form-item>
<u-form-item label="地址" label-position="top" border-bottom="true" prop="place">
<u-input v-model="form.place" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"
@change="change"></u-input>
@change="changeAddress"></u-input>
</u-form-item>
<u-form-item label="行业" label-position="top" border-bottom="true" class="picker">
<text @click="show2 = true" class="checktext">请选择行业类型</text>
@@ -132,13 +132,30 @@
console.log("失败信息:" + JSON.stringify(errors))
// uni.$u.toast('校验失败')
})
}
},
changeAddress(e) {
console.log('changeAddress', e);
// this.getAddressList(e)
},
getAddressList(value) {
var that = this
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + value + '&key=' +
that.$api.key,
success(res) {
console.log('diz', res.data.result.location);
console.log('lat', res.data.result.location.lat);
console.log('lng', res.data.result.location.lng);
},
fail(err) {
console.log('请求区域失败:', err);
}
})
},
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
}
}
</script>

View File

@@ -128,6 +128,7 @@ const toast = {
}
const apiService = {
serverHost,
imgUrl:'https://spsp.feashow.com/',
key:'ZRKBZ-Q7FWL-GVZPK-MCRBU-4XFB5-ATBDB',
uploadImgUrl: serverHost + `/upload/image/`,
//登录接口