|
@@ -8,13 +8,12 @@ const wx = Vue.prototype.wx;
|
|
|
// 腾讯位置服务 key
|
|
// 腾讯位置服务 key
|
|
|
const TxMapKey = 'WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6';
|
|
const TxMapKey = 'WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6';
|
|
|
// 当前设备
|
|
// 当前设备
|
|
|
-// const isDevice = localStorage.getItem('isDevice');
|
|
|
|
|
-// console.log(isDevice);
|
|
|
|
|
|
|
+const isDevice = localStorage.getItem('isDevice');
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取当前定位 调用之前确保当前页面已经授权(getTicketFun)
|
|
* 获取当前定位 调用之前确保当前页面已经授权(getTicketFun)
|
|
|
* */
|
|
* */
|
|
|
-export function getPosition(isDevice) {
|
|
|
|
|
|
|
+export function getPosition(isPermit = false) {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
toastLoading(0, '定位中...', true);
|
|
toastLoading(0, '定位中...', true);
|
|
|
// PC端没有定位权限依然可以访问
|
|
// PC端没有定位权限依然可以访问
|
|
@@ -31,10 +30,15 @@ export function getPosition(isDevice) {
|
|
|
toastLoading().clear();
|
|
toastLoading().clear();
|
|
|
resolve({ TXisBD: TXisBD, resData: resData });
|
|
resolve({ TXisBD: TXisBD, resData: resData });
|
|
|
} else if (isDevice == 'PC') {
|
|
} else if (isDevice == 'PC') {
|
|
|
|
|
+ // PC状态 分允许通过和不允许通过 isPermit: tru允许,false不允许
|
|
|
localStorage.setItem('lat', '');
|
|
localStorage.setItem('lat', '');
|
|
|
localStorage.setItem('lon', '');
|
|
localStorage.setItem('lon', '');
|
|
|
toastLoading().clear();
|
|
toastLoading().clear();
|
|
|
- resolve({ TXisBD: { lat: '', lon: '' }, resData: { latitude: '', longitude: '' } });
|
|
|
|
|
|
|
+ if (isPermit) {
|
|
|
|
|
+ resolve({ TXisBD: { lat: '', lon: '' }, resData: { latitude: '', longitude: '' } });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ reject('GPS未开启');
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
wx.ready(() => {
|
|
wx.ready(() => {
|
|
|
wx.getLocation({
|
|
wx.getLocation({
|