统一甲屿云命名体系

This commit is contained in:
2026-06-29 23:26:43 +08:00
parent 48c47fe3ff
commit bc8a7d8d4c
1268 changed files with 3477 additions and 3511 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
}