[']
This commit is contained in:
@@ -59,11 +59,6 @@
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
wx.login({
|
||||
success: res => {
|
||||
this.loginCode = res.code
|
||||
}
|
||||
})
|
||||
this.getUserInfo()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
@@ -85,86 +80,6 @@
|
||||
})
|
||||
})
|
||||
},
|
||||
// 点击绑定用户得授权信息,且绑定带修改
|
||||
getUser() {
|
||||
uni.getUserProfile({
|
||||
desc: "获取你的昵称、头像、地区及性别",
|
||||
success: e => {
|
||||
console.log(e)
|
||||
if (e.errMsg == "getUserProfile:ok") {
|
||||
this.userInfo = e.userInfo
|
||||
// // 检查用户登录Code是否过期
|
||||
wx.checkSession({
|
||||
success: res => {
|
||||
this.userLogin(e)
|
||||
},
|
||||
fail: err => {
|
||||
// 登录过期重新获取code
|
||||
uni.login({
|
||||
success: res => {
|
||||
this.loginCode = res.code
|
||||
// 登录
|
||||
this.userLogin()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
duration: 1500,
|
||||
title: "绑定手机号失败了",
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
uni.showToast({
|
||||
duration: 1500,
|
||||
title: "您拒绝了请求",
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 登陆接口
|
||||
userLogin(info) {
|
||||
let that = this
|
||||
uni.login({
|
||||
success: res => {
|
||||
let data = {
|
||||
iv: info.iv,
|
||||
encryptedData: info.encryptedData,
|
||||
code: res.code
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '绑定中'
|
||||
})
|
||||
wechatbind(data).then(res => {
|
||||
setTimeout(res => {
|
||||
uni.hideLoading()
|
||||
}, 1000)
|
||||
this.$refs.uToast.show({
|
||||
title: '绑定成功',
|
||||
type: 'primary',
|
||||
duration: 3000
|
||||
})
|
||||
setTimeout(res => {
|
||||
this.getUserInfo()
|
||||
}, 3000)
|
||||
}).catch(err => {
|
||||
this.$refs.uToast.show({
|
||||
title: err.message,
|
||||
type: 'primary',
|
||||
duration: 3000
|
||||
})
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
|
||||
},
|
||||
loginOut() {
|
||||
uni.removeStorageSync('token')
|
||||
uni.reLaunch({
|
||||
|
||||
Reference in New Issue
Block a user