优化代码

This commit is contained in:
java110 2022-07-04 16:54:17 +08:00
parent 28c602c4e9
commit b6778137b5

View File

@ -49,7 +49,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="cu-form-group margin-top"> <view class="cu-form-group margin-top" v-if="mapKey">
<view class="title">当前位置</view> <view class="title">当前位置</view>
<input type="text" v-model="reverseGeocoderSimplify" disabled="disabled" /> <input type="text" v-model="reverseGeocoderSimplify" disabled="disabled" />
</view> </view>
@ -98,13 +98,16 @@
location: '', location: '',
reverseGeocoderSimplify: '正在获取...', reverseGeocoderSimplify: '正在获取...',
titles: [], titles: [],
itemId:'' itemId:'',
mapKey:''
} }
}, },
onLoad(option) { onLoad(option) {
this.java110Context.onLoad(); this.java110Context.onLoad();
let that = this; let that = this;
this.mapKey = conf.QQMapKey;
wx.getLocation({ wx.getLocation({
type: 'gcj02', type: 'gcj02',
success: (res) => { success: (res) => {
@ -161,7 +164,7 @@
let locationObj = this.latitude + ',' + this.longitude; let locationObj = this.latitude + ',' + this.longitude;
let url = 'https://apis.map.qq.com/ws/geocoder/v1?coord_type=5&get_poi=1&output=jsonp&poi_options=page_size=1;page_index=1'; let url = 'https://apis.map.qq.com/ws/geocoder/v1?coord_type=5&get_poi=1&output=jsonp&poi_options=page_size=1;page_index=1';
this.$jsonp(url, { this.$jsonp(url, {
key: conf.QQMapKey, key: this.mapKey,
location: locationObj location: locationObj
}) })
.then(res => { .then(res => {