用户权限授权修改

This commit is contained in:
limqhz
2021-05-27 22:43:12 +08:00
parent 68e4dd0eaa
commit 87236f1f89
13 changed files with 121 additions and 289 deletions

View File

@@ -121,42 +121,52 @@ Page({
showUnclickMask: true
})
let that = this;
wx.login({
success: function(res) {
app.$api.memberLoginWX({
avatar: e.detail.userInfo.avatarUrl,
code: res.code,
nickname: e.detail.userInfo.nickName
}).then(res => {
wx.setStorageSync('information', res.information);
if (!res.authorization) {
wx.redirectTo({
url: '/pages/register/index?codeType=' + 1,
wx.getUserProfile({
desc: '用于完善会员资料',
success: (res) => {
wx.login({
success: function(r){
app.$api.memberLoginWX({
avatar: res.userInfo.avatarUrl,
code: r.code,
nickname: res.userInfo.nickName
}).then(res => {
wx.setStorageSync('information', res.information);
if (!res.authorization) {
wx.redirectTo({
url: '/pages/register/index?codeType=' + 1,
})
return;
}
wx.setStorageSync('accessToken', res.authorization.accessToken);
let route = wx.getStorageSync('history');
wx.removeStorageSync('history');
if (!route || route == '/pages/login/index') {
return wx.redirectTo({
url: '/pages/mine/index',
})
}
wx.redirectTo({
url: route,
})
}, err => {
that.setData({
showUnclickMask: false
})
});
},
fail: function(res) {
that.setData({
showUnclickMask: false
})
return;
}
wx.setStorageSync('accessToken', res.authorization.accessToken);
let route = wx.getStorageSync('history');
wx.removeStorageSync('history');
if (!route || route == '/pages/login/index') {
return wx.redirectTo({
url: '/pages/mine/index',
})
}
wx.redirectTo({
url: route,
})
}, err => {
that.setData({
showUnclickMask: false
})
});
},
})
},
fail: function(res) {
fail: (res) => {
that.setData({
showUnclickMask: false
})
},
})
},
})
})