搜索定位

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", "path": "pages/videoCircle/index",
"style": { "style": {

View File

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