用户权限授权修改
This commit is contained in:
@@ -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
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user