This commit is contained in:
Mr.jiang 2024-07-15 18:55:54 +08:00
parent 3e94d266e3
commit 0df65863b5
2 changed files with 66 additions and 1 deletions

View File

@ -426,7 +426,7 @@
// 125.424295,43.878294
// that.getAddress();
var dizhi={
key:'a90dccd8b55793bb939c38c7a4be3e15',
key:'4f23770b6e53b96e7d0661a7ccfb9c21',
location:'125.424295,43.878294',
radius:'1000',
extensions:'all',

View File

@ -0,0 +1,65 @@
<template>
<view>
<input type="text" v-model="keywords"/>
<view @click="inpuCity">搜索</view>
</view>
</template>
<script>
export default{
data(){
return{
keywords:''
}
},
onLoad() {
var that=this;
},
methods:{
inpuCity(){
var that=this;
that.$nextTick(() =>{
that.getCity()
},100)
},
getCity(e){
// this.keywords=e.detail.value;
var that=this;
const value = uni.getStorageSync('citySou');
var dizhi={
// a90dccd8b55793bb939c38c7a4be3e15
key:'4f23770b6e53b96e7d0661a7ccfb9c21',
keywords:that.keywords,
city:'城市中文'+'|'+'citycode'+'|'+'中文全拼'+'|'+'adcode',
citylimit:true,
datatype:'all',
location:'125.424295,43.878294',
output:'JSON',
// type:'010000'+'|'+'020000'+'|'+'030000'+'|'+'040000'+'|'+'050000'+'|'+'060000'
// +'|'+'070000'+'|'+'080000'+'|'+'090000'+'|'+'100000'+'|'+'110000'+'|'+'120000'
// +'|'+'130000'+'|'+'140000'+'|'+'150000'+'|'+'160000'+'|'+'170000'+'|'+'180000'
// +'|'+'190000'+'|'+'200000'+'|'+'220000'+'|'+'970000'+'|'+'990000'+'|'+'991000'+'|'+'991001'
// +'|'+'991400'+'|'+'991401'+'|'+'991500'+'|'+'991600'+'|'+'991601'
// ,
// type:'010000|020000|030000|040000|050000|060000|080000|090000|100000|110000|120000|130000|140000|150000|160000|170000|180000|190000|200000',
}
uni.request({
url: 'https://restapi.amap.com/v3/assistant/inputtips',
data:dizhi,
method:'GET',
success(res) {
if (res.statusCode ==200) {
// that.city = res.data.regeocode.formatted_address
} else {
console.log("获取信息失败,请重试!")
}
}
});
}
}
}
</script>
<style>
</style>