【bug】- 解决线上版本首次不能授权登录的bug
This commit is contained in:
+27
-1
@@ -97,6 +97,7 @@ Page({
|
|||||||
wx.getStorage({
|
wx.getStorage({
|
||||||
key: 'authorize',
|
key: 'authorize',
|
||||||
success(result){
|
success(result){
|
||||||
|
console.log('result=======', result)
|
||||||
// 做过查看微信用户信息
|
// 做过查看微信用户信息
|
||||||
if(result.data){ // 做过用户信息获取
|
if(result.data){ // 做过用户信息获取
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
@@ -137,6 +138,7 @@ Page({
|
|||||||
},
|
},
|
||||||
fail(err){
|
fail(err){
|
||||||
// 没有做过查看微信用户信息
|
// 没有做过查看微信用户信息
|
||||||
|
console.log('err========', err)
|
||||||
that.getUserInfo()
|
that.getUserInfo()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -144,9 +146,16 @@ Page({
|
|||||||
// 获取用户信息,微信登录
|
// 获取用户信息,微信登录
|
||||||
getUserInfo(){
|
getUserInfo(){
|
||||||
const that = this
|
const that = this
|
||||||
|
wx.showModal({
|
||||||
|
title: '温馨提示',
|
||||||
|
content: `亲,授权微信登录后才能正常使用小程序功能`,
|
||||||
|
cancelColor: 'cancelColor',
|
||||||
|
success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
wx.getUserProfile({
|
wx.getUserProfile({
|
||||||
desc: '用于完善用户信息',
|
desc: '获取你的昵称、头像、地区及性别',
|
||||||
success(result){
|
success(result){
|
||||||
|
console.log('result用于完善用户信息', result)
|
||||||
let userInfoTemp = JSON.parse(result.rawData)
|
let userInfoTemp = JSON.parse(result.rawData)
|
||||||
wx.setStorage({
|
wx.setStorage({
|
||||||
key: 'userInfoTemp',
|
key: 'userInfoTemp',
|
||||||
@@ -186,9 +195,26 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
fail(err){
|
fail(err){
|
||||||
|
console.log('err===========', err)
|
||||||
wx.setStorageSync('authorize', false)
|
wx.setStorageSync('authorize', false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// wx.showModal({
|
||||||
|
// title: '错误提示',
|
||||||
|
// content: `图片大于${that.data.maxSize}MB`,
|
||||||
|
// showCancel: false,
|
||||||
|
// success(res) {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// console.log('用户点击确定')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
},
|
},
|
||||||
// 登录
|
// 登录
|
||||||
formSubmit(e) {
|
formSubmit(e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user