qingcheng-xiaochengxu/pages/mypage/mypage.js
2025-05-21 20:24:34 +08:00

101 lines
1.9 KiB
JavaScript

import {url} from '../../request'
Page({
data: {
},
onLoad(options) {
checkLogin();
},
onReady() {
},
tiaozhuan(){
wx.navigateTo({
url: '/pages/tuiguangma/tuiguangma',
})
},
onShow() {
},
wodejiedan(){
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() {
},
onUnload() {
},
onPullDownRefresh() {
},
onReachBottom() {
},
onShareAppMessage() {
}
})