增加退出接口

This commit is contained in:
liuwu 2023-09-18 17:17:45 +08:00
parent ffc3d516f7
commit a087f64a6c
3 changed files with 22 additions and 7 deletions

View File

@ -19,6 +19,17 @@ Page({
}) })
}, },
exitLogin(){
wx.clearStorageSync()
// wx.setStorageSync("loginName", _this.data.username);
// wx.setStorageSync("password", _this.data.password);
// wx.setStorageSync("userInfo", obj.data.userInfo);
// wx.setStorageSync("perInfo", obj.data.perInfo);
wx.reLaunch({
url: '/pages/loading/loading'
});
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

View File

@ -51,4 +51,8 @@
</view> </view>
</view> </view>
</view> </view>
<view class="mine_item" style="margin-top:20px;">
<van-button type="danger" bindtap="exitLogin" block>退出当前账号</van-button>
</view>
</view> </view>

View File

@ -19,12 +19,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.loadListData();
if (wx.getStorageSync('userInfo').loginName !== 'admin'){
this.setData({
head:wx.getStorageSync('perInfo').id
})
}
}, },
//上拉加载 //上拉加载
@ -109,7 +104,12 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
if (wx.getStorageSync('userInfo').loginName !== 'admin'){
this.setData({
head:wx.getStorageSync('perInfo').id
})
}
this.loadListData();
}, },
/** /**