bug修改
This commit is contained in:
+21
-12
@@ -9,6 +9,7 @@ Page({
|
||||
data: {
|
||||
userId: '',
|
||||
name: '',
|
||||
avatarUrl: '', // 头像
|
||||
phone: '未知手机号',
|
||||
rsaPublicKey: '',
|
||||
},
|
||||
@@ -37,17 +38,12 @@ Page({
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
UserApi.wxUnbind().then(res => {
|
||||
if (res.success) {
|
||||
wx.clearStorage()
|
||||
wx.redirectTo({
|
||||
url: '../login/login',
|
||||
})
|
||||
} else {
|
||||
wx.clearStorage()
|
||||
wx.redirectTo({
|
||||
url: '../login/login',
|
||||
})
|
||||
}
|
||||
wx.removeStorage({key:'userInfo'})
|
||||
wx.removeStorage({key:'X-Access-Token'})
|
||||
wx.removeStorage({key:'avatarUrl'})
|
||||
wx.redirectTo({
|
||||
url: '../login/login',
|
||||
})
|
||||
})
|
||||
} else if (res.cancel) {}
|
||||
}
|
||||
@@ -115,7 +111,9 @@ Page({
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
UserApi.logout().then(res => {
|
||||
wx.clearStorage()
|
||||
wx.removeStorage({key:'userInfo'})
|
||||
wx.removeStorage({key:'X-Access-Token'})
|
||||
wx.removeStorage({key:'avatarUrl'})
|
||||
wx.redirectTo({
|
||||
url: '../login/login',
|
||||
})
|
||||
@@ -124,6 +122,17 @@ Page({
|
||||
}
|
||||
})
|
||||
},
|
||||
onLoad(){
|
||||
const that = this
|
||||
wx.getStorage({
|
||||
key: 'avatarUrl',
|
||||
success(res){
|
||||
that.setData({
|
||||
avatarUrl: res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"navigationBarTitleText": "我的",
|
||||
"usingComponents": {},
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
<!-- 顶部选项栏 -->
|
||||
<view class="select-box">
|
||||
<view class="avator">
|
||||
<image src="../../assets/images/tx.png"></image>
|
||||
<image wx:if="{{!avatarUrl}}" src="../../assets/images/tx.png"></image>
|
||||
<image wx:if="{{avatarUrl}}" src="{{avatarUrl}}"></image>
|
||||
<view class="info">
|
||||
<text wx:if="{{!name}}" bindtap="goLogin">未登录</text>
|
||||
<text wx:if="{{name}}">{{name}}</text>
|
||||
|
||||
Reference in New Issue
Block a user