定位逻辑修改
This commit is contained in:
parent
604f9aff08
commit
960d43ba01
@ -111,6 +111,13 @@ export default {
|
||||
wx.ready(() => {
|
||||
wx.updateAppMessageShareData(shareinfo);
|
||||
wx.updateTimelineShareData(shareinfo);
|
||||
wx.getLocation({
|
||||
type: 'gcj02',
|
||||
success: (e) => {
|
||||
localStorage.setItem('user_latitude', e.latitude)
|
||||
localStorage.setItem('user_longitude', e.longitude)
|
||||
}
|
||||
});
|
||||
});
|
||||
wx.error((e) => {
|
||||
});
|
||||
|
||||
@ -31,7 +31,7 @@ const routes = [
|
||||
name: 'Social',
|
||||
parentName: 'Index',
|
||||
component: () => import('./views/Tabbars/Social.vue'),
|
||||
meta: { title: '加盟店', cache: true }
|
||||
meta: { title: '加盟店' }
|
||||
},
|
||||
{
|
||||
path: '/My',
|
||||
|
||||
@ -84,11 +84,10 @@ export default {
|
||||
},
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this.init();
|
||||
|
||||
mounted() {
|
||||
if (wx && this.$isWechat()) {
|
||||
this.$post('/v1/client/HWxinfoClient/share', JSON.stringify(location.href)).then(res => {
|
||||
let url = 'https://m.taigurun.cn'
|
||||
this.$post('/v1/client/HWxinfoClient/share', JSON.stringify(url)).then(res => {
|
||||
const data = res.data || {};
|
||||
const jsApiList = data.jsApiList || ['onMenuShareTimeline', 'onMenuShareAppMessage', 'updateAppMessageShareData', 'updateTimelineShareData', 'openLocation', 'getLocation'];
|
||||
const openTagList = data.openTagList || ['wx-open-launch-weapp'];
|
||||
@ -111,12 +110,27 @@ export default {
|
||||
}
|
||||
});
|
||||
});
|
||||
wx.error((e) => {
|
||||
// window.location.reload();
|
||||
if (localStorage.getItem('latitude') && localStorage.getItem('longitude')) {
|
||||
this.searchparams.latitude = localStorage.getItem('latitude');
|
||||
this.searchparams.longitude = localStorage.getItem('longitude');
|
||||
return
|
||||
} else {
|
||||
// this.$geo.getWebGeo().then(res => {
|
||||
// this.searchparams.latitude = res.lat;
|
||||
// this.searchparams.longitude = res.lon;
|
||||
// });
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
const res = await this.$geo.getWebGeo();
|
||||
this.searchparams.latitude = res.lat;
|
||||
this.searchparams.longitude = res.lon;
|
||||
this.$geo.getWebGeo().then(res => {
|
||||
this.searchparams.latitude = res.lat;
|
||||
this.searchparams.longitude = res.lon;
|
||||
});
|
||||
}
|
||||
this.init();
|
||||
this.$nextTick(() => {
|
||||
this.checkScroll();
|
||||
const ro = new ResizeObserver(() => this.checkScroll());
|
||||
|
||||
@ -107,7 +107,7 @@ export default {
|
||||
if (wx && this.$isWechat()) {
|
||||
this.$post('/v1/client/HWxinfoClient/share', JSON.stringify(location.href)).then(res => {
|
||||
const data = res.data || {};
|
||||
const jsApiList = data.jsApiList || ['onMenuShareTimeline', 'onMenuShareAppMessage', 'updateAppMessageShareData', 'updateTimelineShareData', 'openLocation', 'getLocation'];
|
||||
const jsApiList = data.jsApiList || ['openLocation'];
|
||||
const openTagList = data.openTagList || ['wx-open-launch-weapp'];
|
||||
jsApiList.push('wx-open-launch-weapp');
|
||||
wx.config({
|
||||
@ -120,13 +120,6 @@ export default {
|
||||
openTagList: openTagList
|
||||
});
|
||||
wx.ready(() => {
|
||||
wx.getLocation({
|
||||
type: 'gcj02',
|
||||
success: (e) => {
|
||||
this.searchparams.latitude = e.latitude;
|
||||
this.searchparams.longitude = e.longitude;
|
||||
}
|
||||
});
|
||||
wx.openLocation({
|
||||
latitude: Number(lat),
|
||||
longitude: Number(lon),
|
||||
@ -137,19 +130,8 @@ export default {
|
||||
success: () => {
|
||||
console.log('wx.openLocation success');
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('wx.openLocation fail', err);
|
||||
// window.open(`https://uri.amap.com/navigation?to=${lon},${lat},${fullAddress}&mode=car&src=shop`, '_blank');
|
||||
}
|
||||
});
|
||||
});
|
||||
wx.error((err) => {
|
||||
console.error('wx.error', err);
|
||||
});
|
||||
// wx.error((err) => {
|
||||
// console.error('wx.openLocation error', err);
|
||||
// window.open(`https://uri.amap.com/navigation?to=${lon},${lat},${fullAddress}&mode=car&src=shop`, '_blank');
|
||||
// });
|
||||
});
|
||||
} else {
|
||||
window.open(`https://uri.amap.com/navigation?to=${lon},${lat},${fullAddress}&mode=car&src=shop`, '_blank');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user