From 5f4ba844e18265feb3bff900739a68c3492af43d Mon Sep 17 00:00:00 2001 From: xuecong <> Date: Thu, 2 Dec 2021 17:54:32 +0800 Subject: [PATCH] fix minp location --- employee-mp/src/config.js | 2 +- employee-mp/src/pages/sign/begin.js | 21 +++++++++++++++++++-- employee-mp/src/pages/sign/finish.js | 21 +++++++++++++++++++-- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/employee-mp/src/config.js b/employee-mp/src/config.js index 881d04b..4b1e505 100644 --- a/employee-mp/src/config.js +++ b/employee-mp/src/config.js @@ -24,4 +24,4 @@ export const WECHAT_VERSION = '7.0.0'; export const SDK_VERSION = '2.16.0'; -export const VERSION = '1.1.11'; +export const VERSION = '1.1.12'; diff --git a/employee-mp/src/pages/sign/begin.js b/employee-mp/src/pages/sign/begin.js index 3b97ab9..4aaa1c0 100644 --- a/employee-mp/src/pages/sign/begin.js +++ b/employee-mp/src/pages/sign/begin.js @@ -165,7 +165,19 @@ CwPage({ wx.getSetting({ success: res => { - if (res.authSetting['scope.userLocation']) { + if (res.authSetting['scope.userLocation'] === undefined) { + wx.authorize({ + scope: 'scope.userLocation', + success: () => { + getLocationAndSend(); + }, + fail: () => { + $toast.fail({ + message: '请授权位置' + }); + } + }); + } else if (res.authSetting['scope.userLocation'] === true) { getLocationAndSend(); } else { wx.openSetting({ @@ -176,9 +188,14 @@ CwPage({ $toast.clear(); $toast.fail({ - message: '不能使用位置' + message: '请打开位置' }); } + }, + fail: () => { + $toast.fail({ + message: '请授权位置' + }); } }); } diff --git a/employee-mp/src/pages/sign/finish.js b/employee-mp/src/pages/sign/finish.js index a5beb66..ec81837 100644 --- a/employee-mp/src/pages/sign/finish.js +++ b/employee-mp/src/pages/sign/finish.js @@ -171,7 +171,19 @@ CwPage({ wx.getSetting({ success: res => { - if (res.authSetting['scope.userLocation']) { + if (res.authSetting['scope.userLocation'] === undefined) { + wx.authorize({ + scope: 'scope.userLocation', + success: () => { + getLocationAndSend(); + }, + fail: () => { + $toast.fail({ + message: '请授权位置' + }); + } + }); + } else if (res.authSetting['scope.userLocation'] === true) { getLocationAndSend(); } else { wx.openSetting({ @@ -182,9 +194,14 @@ CwPage({ $toast.clear(); $toast.fail({ - message: '不能使用位置' + message: '请打开位置' }); } + }, + fail: () => { + $toast.fail({ + message: '请授权位置' + }); } }); }