Files
qingcheng-xiaochengxu/utils/logcheck.js

51 lines
1.0 KiB
JavaScript
Raw Normal View History

2025-05-15 21:01:14 +08:00
function checkLogin() {
try {
const user = wx.getStorageSync('usermessage');
if (!user || (typeof user === 'object' && Object.keys(user).length === 0)) {
wx.showToast({
title: '您未登录请先登录',
icon:'error',
duration:2000
})
setTimeout(() => {
wx.navigateTo({
url: '/pages/logain/logain',
});
}, 2000);
}
} catch (e) {
wx.navigateTo({
url: '/pages/logain/logain',
});
}
}
2025-06-17 18:43:08 +08:00
function checkLogin2() {
try {
const user = wx.getStorageSync('usermessage');
if (!user || (typeof user === 'object' && Object.keys(user).length === 0)) {
wx.showToast({
title: '您未登录请先登录',
icon:'error',
duration:2000
})
setTimeout(() => {
wx.navigateTo({
url: '/pages/logain/logain',
});
}, 2000);
}
} catch (e) {
wx.navigateTo({
url: '/pages/logain/logain',
});
}
}
2025-05-15 21:01:14 +08:00
module.exports = {
2025-06-17 18:43:08 +08:00
checkLogin, checkLogin2
2025-05-15 21:01:14 +08:00
};