修改了已知问题
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
const { checkLogin } = require('../../utils/logcheck');
|
||||
import {url} from '../../request'
|
||||
Page({
|
||||
|
||||
|
||||
@ -12,8 +13,9 @@ Page({
|
||||
url: '/pages/wodetuandui/wodetuandui',
|
||||
})
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
|
||||
checkLogin();
|
||||
},
|
||||
onReady() {
|
||||
|
||||
@ -25,7 +27,7 @@ Page({
|
||||
const userInfo = wx.getStorageSync('usermessage');
|
||||
console.log('用户信息:', userInfo);
|
||||
this.setData({
|
||||
nickName: userInfo.nickName || '',
|
||||
nickName: userInfo.nickName || '请登录',
|
||||
phoneNumber: userInfo.phoneNumber || '',
|
||||
invitationCode: userInfo.invitationCode || '',
|
||||
userAvatar: userInfo.userAvatar || 'https://tse2-mm.cn.bing.net/th/id/OIP-C.jHUH4s7TQ48X_B-1iozuJgHaHa?w=207&h=207&c=7&r=0&o=5&dpr=1.5&pid=1.7'
|
||||
@ -38,6 +40,57 @@ Page({
|
||||
wx.navigateTo({
|
||||
url: '/pages/wodejiedan/wodejiedan',
|
||||
})
|
||||
},
|
||||
out(){
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确定退出登录吗?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定')
|
||||
wx.getStorage({
|
||||
key: "logmessage",
|
||||
success(res) {
|
||||
const userinfo = res.data.Authorization
|
||||
wx.request({
|
||||
url: url + '/userInfo/mini/logout',
|
||||
method: 'GET',
|
||||
data: {
|
||||
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': userinfo
|
||||
},
|
||||
success(res) {
|
||||
console.log('查询成功', res);
|
||||
if(res.data.code==1){
|
||||
wx.showToast({
|
||||
title: "退出成功",
|
||||
icon:'sucess',
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.error('请求失败', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
try {
|
||||
wx.clearStorageSync();
|
||||
console.log("所有缓存清除成功");
|
||||
} catch (e) {
|
||||
console.error("清除缓存失败", e);
|
||||
}
|
||||
} else {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
onHide() {
|
||||
|
||||
|
Reference in New Issue
Block a user