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