|
|
@ -63,49 +63,52 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
bindGetUserInfo: function (e) { |
|
|
|
if (e.detail.userInfo) { |
|
|
|
// let wxHeadImg = e.detail.userInfo.avatarUrl
|
|
|
|
// let wxNickName = e.detail.userInfo.nickName
|
|
|
|
console.log(e) |
|
|
|
let that = this |
|
|
|
wx.login({ |
|
|
|
success: function (response) { |
|
|
|
let code = response.code; |
|
|
|
wx.getUserInfo({ |
|
|
|
success: function (res) { |
|
|
|
console.log(res.encryptedData) |
|
|
|
console.log(res.iv) |
|
|
|
let encryptedData = res.encryptedData |
|
|
|
let iv = res.iv |
|
|
|
api.updateWxInfo(code, encryptedData, iv).then(function (res) { |
|
|
|
// 跳转到首页
|
|
|
|
console.log('跳转到首页') |
|
|
|
wx.setStorageSync('isFirst', 'noFirst') |
|
|
|
wx.reLaunch({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
console.log('拒绝授权') |
|
|
|
wx.redirectTo({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}) |
|
|
|
// wx.showModal({
|
|
|
|
// title: '提示',
|
|
|
|
// content: '您点击了拒绝授权,将无法进入小程序,请授权之后再进入!',
|
|
|
|
// showCancel: false,
|
|
|
|
// confirmText: '返回授权',
|
|
|
|
// if (e.detail.userInfo) {
|
|
|
|
// // let wxHeadImg = e.detail.userInfo.avatarUrl
|
|
|
|
// // let wxNickName = e.detail.userInfo.nickName
|
|
|
|
// console.log(e)
|
|
|
|
// let that = this
|
|
|
|
// wx.login({
|
|
|
|
// success: function (response) {
|
|
|
|
// let code = response.code;
|
|
|
|
// wx.getUserInfo({
|
|
|
|
// success: function (res) {
|
|
|
|
// if (res.confirm) {
|
|
|
|
// console.log('用户点击了“返回授权”')
|
|
|
|
// console.log(res.encryptedData)
|
|
|
|
// console.log(res.iv)
|
|
|
|
// let encryptedData = res.encryptedData
|
|
|
|
// let iv = res.iv
|
|
|
|
// api.updateWxInfo(code, encryptedData, iv).then(function (res) {
|
|
|
|
// // 跳转到首页
|
|
|
|
// console.log('跳转到首页')
|
|
|
|
// wx.setStorageSync('isFirst', 'noFirst')
|
|
|
|
// wx.reLaunch({
|
|
|
|
// url: '/pages/index/index'
|
|
|
|
// })
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
} |
|
|
|
|
|
|
|
// } else {
|
|
|
|
// console.log('拒绝授权')
|
|
|
|
// wx.redirectTo({
|
|
|
|
// url: '/pages/index/index'
|
|
|
|
// })
|
|
|
|
// // wx.showModal({
|
|
|
|
// // title: '提示',
|
|
|
|
// // content: '您点击了拒绝授权,将无法进入小程序,请授权之后再进入!',
|
|
|
|
// // showCancel: false,
|
|
|
|
// // confirmText: '返回授权',
|
|
|
|
// // success: function (res) {
|
|
|
|
// // if (res.confirm) {
|
|
|
|
// // console.log('用户点击了“返回授权”')
|
|
|
|
// // }
|
|
|
|
// // }
|
|
|
|
// // })
|
|
|
|
// }
|
|
|
|
wx.reLaunch({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|