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