搜索定位

This commit is contained in:
Mr.jiang 2024-07-15 18:31:03 +08:00
parent d10fc98aab
commit 3e94d266e3
2 changed files with 29 additions and 12 deletions

View File

@ -42,6 +42,17 @@
}
}
},
{
"path": "pages/index/searchAddress",
"style": {
"navigationBarTitleText": "搜索地址",
"enablePullDownRefresh": true,
"navigationStyle": "custom",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/videoCircle/index",
"style": {

View File

@ -4,7 +4,7 @@
<view class="index-top">
<view class="index-top-left font-size-34">盛安到家</view>
<view v-if="XCXIsSelect != ''" class="flex locate-line"
@tap="Cityshow = true">
@tap="goCity">
<view class="localName">{{ city }}</view>
<image src="../../static/liliao-1.png" class="dingwei-img"></image>
</view>
@ -424,24 +424,25 @@
})
// 116.481488,39.990464
// 125.424295,43.878294
// that.getAddress();
var dizhi={
key:'32c22db939160ba44394eb187f7897ae',
location:'116.481488,39.990464',
radius:'3000',
extensions:'base',
// poitype:'',
// roadlevel:'0'
key:'a90dccd8b55793bb939c38c7a4be3e15',
location:'125.424295,43.878294',
radius:'1000',
extensions:'all',
output:'JSON'
}
uni.request({
url: 'https://restapi.amap.com/v3/geocode/regeo',
data:dizhi,
method:'GET',
success(re) {
if (re.status =='1') {
console.log("获取城市名称成功", re)
that.city = re ? re : '未知'
success(rea) {
console.log("获取城市名称成功", rea)
if (rea.statusCode ==200) {
that.city = rea.data.regeocode.addressComponent.township;
uni.setStorageSync('citySou',rea.data.regeocode.addressComponent.city)
} else {
that.city ='请重试'
console.log("获取信息失败,请重试!")
}
}
@ -556,6 +557,11 @@
// }
},
methods: {
goCity(){
uni.navigateTo({
url:'/pages/index/searchAddress'
})
},
searchBtn(){//
uni.navigateTo({
url:'/pages/my/fuwuGengduo?searchValue='+this.searchValue