Browse Source

[地理位置][修改]:[地理位置授权,如果未授权,暂时不做处理。其接口文档做了修改,因其改成组件样式]

tags/江西版6.1.0
meo 6 years ago
parent
commit
945efbbc81
2 changed files with 2 additions and 100 deletions
  1. +1
    -51
      pages/index/index.js
  2. +1
    -49
      pages/passCar/passCar.js

+ 1
- 51
pages/index/index.js View File

@@ -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 {


+ 1
- 49
pages/passCar/passCar.js View File

@@ -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()
}
},


Loading…
Cancel
Save