mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 20:33:26 +08:00
【修复】修复安卓苹果APP下高德地图调用失败的问题。
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
<u-input :value="pickerValue" type="select" disabled placeholder="请选择省市区区域">
|
||||
<template slot="suffix">
|
||||
<!--<u-button text="请选择" type="success" size="mini" @click="toMap"></u-button>-->
|
||||
<u-button text="请选择" type="success" size="mini" @click="show = true"></u-button>
|
||||
<u-button text="请选择" type="success" size="mini" @click="show = true"></u-button>
|
||||
</template>
|
||||
</u-input>
|
||||
<!-- #endif -->
|
||||
@@ -34,13 +34,13 @@
|
||||
<u--input :value="pickerValue" type="select" disabled placeholder="请选择省市区区域">
|
||||
<template slot="suffix">
|
||||
<!--<u-button text="请选择" type="success" size="mini" @click="toMap"></u-button>-->
|
||||
<u-button text="请选择" type="success" size="mini" @click="show = true"></u-button>
|
||||
<u-button text="请选择" type="success" size="mini" @click="show = true"></u-button>
|
||||
</template>
|
||||
</u--input>
|
||||
<!-- #endif -->
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="街道社区" borderBottom @click="toMap">
|
||||
<u-form-item label="街道社区" borderBottom @click="toMap">
|
||||
<!-- 注意:由于兼容性差异,如果需要使用前后插槽,nvue下需使用u--input,非nvue下需使用u-input -->
|
||||
<!-- #ifndef APP-NVUE -->
|
||||
<u-input :value="form.street" type="text" disabled placeholder="请定位">
|
||||
@@ -84,7 +84,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef MP-WEIXIN
|
||||
const chooseLocation = requirePlugin('chooseLocation');
|
||||
// #endif
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
// #endif
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -157,43 +161,32 @@
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
const location = chooseLocation.getLocation(); // 如果点击确认选点按钮,则返回选点结果对象,否则返回null
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
const chooseLocation = requirePlugin('chooseLocation');
|
||||
const location = chooseLocation.getLocation();
|
||||
// #endif
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
const location = uni.getLocation();
|
||||
// #endif
|
||||
if (location != null) {
|
||||
this.form.latitude = location.latitude;
|
||||
this.form.longitude = location.longitude;
|
||||
|
||||
this.region = [location.province, location.district, location.city];
|
||||
//let data = {
|
||||
// provinceName: location.province,
|
||||
// cityName: location.district,
|
||||
// countyName: location.city
|
||||
//};
|
||||
this.form.street = location.name;
|
||||
this.form.address = location.address;
|
||||
|
||||
//let postData = {
|
||||
// countyName: location.district,
|
||||
// cityName: location.city,
|
||||
// provinceName: location.province,
|
||||
//}
|
||||
//this.$u.api.getAreaIdByName(postData).then(res => {
|
||||
// if (res.status) {
|
||||
// this.areaId = res.data.areaId;
|
||||
// this.pickerValue = res.data.fullName;
|
||||
// } else {
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: '地区选择出现问题,请重新选择地区',
|
||||
// showCancel: false
|
||||
// });
|
||||
// }
|
||||
//});
|
||||
console.log("location1:", location);
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
// 页面卸载时设置插件选点数据为null,防止再次进入页面,geLocation返回的是上次选点结果
|
||||
// #ifdef MP-WEIXIN
|
||||
chooseLocation.setLocation(null);
|
||||
// #endif
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
//uni.setLocation(null);
|
||||
// #endif
|
||||
},
|
||||
onLoad(e) {
|
||||
this.getMyLocation();
|
||||
@@ -424,6 +417,7 @@
|
||||
this.pickerIndex = [this.provinceKey, this.cityKey, this.areaKey];
|
||||
},
|
||||
toMap() {
|
||||
// #ifdef MP-WEIXIN
|
||||
const txMapkey = this.$store.state.config.qqMapKey; //使用在腾讯位置服务申请的key
|
||||
const referer = this.$store.state.config.shopName; //调用插件的app的名称
|
||||
const location = JSON.stringify({
|
||||
@@ -436,12 +430,20 @@
|
||||
url: 'plugin://chooseLocation/index?key=' + txMapkey + '&referer=' + referer + '&location=' +
|
||||
location + '&category=' + category
|
||||
});
|
||||
//if (!this.pickerValue) {
|
||||
// this.$u.toast('请先获取省市区信息');
|
||||
// return false;
|
||||
//} else {
|
||||
// this.$u.route('/pages/member/address/map/map', { pickerValue: this.pickerValue, areaId: this.areaId, longitude: this.form.longitude, latitude: this.form.latitude });
|
||||
//}
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
uni.chooseLocation({
|
||||
success: (res) => {
|
||||
this.form.street = res.name;
|
||||
this.form.latitude = res.latitude;
|
||||
this.form.longitude = res.longitude;
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user