重构项目文件夹目录

This commit is contained in:
2026-06-15 15:53:55 +08:00
parent 8093e07190
commit 7cbe5b3de5
1098 changed files with 34 additions and 4441 deletions
+58
View File
@@ -0,0 +1,58 @@
const CUSTOMER_HOME_PATH = '/pages/home/index'
const ADMIN_LOGIN_PATH = '/admin/pages/login/index'
function getCurrentApp() {
return typeof getApp === 'function' ? getApp() : null
}
function clearCustomerSession() {
const app = getCurrentApp()
if (app && typeof app.clearUserSession === 'function') {
app.clearUserSession()
return
}
try {
wx.removeStorageSync('accessToken')
wx.removeStorageSync('refreshToken')
wx.removeStorageSync('userInfo')
wx.removeStorageSync('needSetPassword')
} catch (error) {}
}
function clearAdminSession() {
const app = getCurrentApp()
if (app && typeof app.clearAdminSession === 'function') {
app.clearAdminSession()
return
}
try {
wx.removeStorageSync('adminAccessToken')
wx.removeStorageSync('adminRefreshToken')
wx.removeStorageSync('adminUserInfo')
wx.removeStorageSync('adminPermissions')
wx.removeStorageSync('adminCurrentShop')
} catch (error) {}
}
function relaunch(url) {
wx.reLaunch({ url })
}
function openAdminLogin() {
clearCustomerSession()
relaunch(ADMIN_LOGIN_PATH)
}
function openCustomerHome() {
clearAdminSession()
relaunch(CUSTOMER_HOME_PATH)
}
module.exports = {
ADMIN_LOGIN_PATH,
CUSTOMER_HOME_PATH,
clearCustomerSession,
clearAdminSession,
openAdminLogin,
openCustomerHome
}