wx.login({
success: function (login) {
wx.getUserInfo({
success: res => {
console.log(‘成功’);
wx.request({
url: url
method: ‘post’,
data: {
code: login.code,
rawData: res.rawData,
signature: res.signature,
encryptedData: res.encryptedData,
iv: res.iv
},
success: res => {
…
},
fail:function(){
wx.showModal({
title: ‘提示’,
content: ‘未授权,请授权后再使用’,
success: function (res) {
if (res.confirm) {
wx.navigateTo({
url: ‘/pages/index/index’,
})
} else if (res.cancel) {
wx.navigateTo({
url: ‘/pages/index/index’,
})
}
}
})
}
})
},