From 945efbbc81bba13c012251b4bb30028d718c18bf Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Sun, 5 May 2019 16:51:25 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=9C=B0=E7=90=86=E4=BD=8D=E7=BD=AE][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]=EF=BC=9A[=E5=9C=B0=E7=90=86=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E6=8E=88=E6=9D=83=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=9C=AA?= =?UTF-8?q?=E6=8E=88=E6=9D=83=EF=BC=8C=E6=9A=82=E6=97=B6=E4=B8=8D=E5=81=9A?= =?UTF-8?q?=E5=A4=84=E7=90=86=E3=80=82=E5=85=B6=E6=8E=A5=E5=8F=A3=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=81=9A=E4=BA=86=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=9B=A0?= =?UTF-8?q?=E5=85=B6=E6=94=B9=E6=88=90=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 52 +--------------------------------------- pages/passCar/passCar.js | 50 +------------------------------------- 2 files changed, 2 insertions(+), 100 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 9405769..4f7ea9c 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -66,57 +66,7 @@ Page({ }) wx.setStorageSync('options', JSON.stringify(options)) wx.setStorageSync('imgurl', imgurl) - - wx.getSetting({ - success: (res) => { - console.log(res) - if (res.authSetting['scope.userLocation'] != undefined && res.authSetting['scope.userLocation'] != true) {//非初始化进入该页面,且未授权 - wx.showModal({ - title: '是否授权当前位置', - content: '需要获取您的地理位置,请确认授权,否则无法获取您所需数据', - success: function (res) { - debugger; - if (res.cancel) { - wx.showToast({ - title: '授权失败', - icon: 'success', - duration: 1000 - }) - } else if (res.confirm) { - wx.openSetting({ - success: function (dataAu) { - if (dataAu.authSetting["scope.userLocation"] == true) { - wx.showToast({ - title: '授权成功', - icon: 'success', - duration: 1000 - }) - //再次授权,调用getLocationt的API - app.getLocation(); - } else { - wx.showToast({ - title: '授权失败', - icon: 'success', - duration: 1000 - }) - } - } - }) - } - } - }) - } else if (res.authSetting['scope.userLocation'] == undefined) { - //初始化进入 - app.getLocation(); - } - else { - //授权后默认加载 - app.getLocation(); - } - } - }) - - + app.getLocation(); if (options.couponChannelId || options.orderId || options.id) { that.userLogin(options); } else { diff --git a/pages/passCar/passCar.js b/pages/passCar/passCar.js index 8cd9aa3..f10cf5b 100644 --- a/pages/passCar/passCar.js +++ b/pages/passCar/passCar.js @@ -161,55 +161,7 @@ Page({ scene: scene }); if (app.globalData.token) { } else { - // app.getLocation(); - wx.getSetting({ - success: (res) => { - console.log(res) - if (res.authSetting['scope.userLocation'] != undefined && res.authSetting['scope.userLocation'] != true) {//非初始化进入该页面,且未授权 - wx.showModal({ - title: '是否授权当前位置', - content: '需要获取您的地理位置,请确认授权,否则无法获取您所需数据', - success: function (res) { - debugger; - if (res.cancel) { - wx.showToast({ - title: '授权失败', - icon: 'success', - duration: 1000 - }) - } else if (res.confirm) { - wx.openSetting({ - success: function (dataAu) { - if (dataAu.authSetting["scope.userLocation"] == true) { - wx.showToast({ - title: '授权成功', - icon: 'success', - duration: 1000 - }) - //再次授权,调用getLocationt的API - app.getLocation(); - } else { - wx.showToast({ - title: '授权失败', - icon: 'success', - duration: 1000 - }) - } - } - }) - } - } - }) - } else if (res.authSetting['scope.userLocation'] == undefined) { - //初始化进入 - app.getLocation(); - } - else { - //授权后默认加载 - app.getLocation(); - } - } - }) + app.getLocation(); that.userLogin() } },