修复bug

This commit is contained in:
zhouyanli
2026-08-11 14:52:25 +08:00
parent 3757033744
commit 839f3ee1b7
6 changed files with 56 additions and 23 deletions

View File

@@ -37,7 +37,7 @@ export default function request(url, data = {}, method = 'GET') {
title: '登录过期,请重新登录',
icon: 'none'
})
uni.clearStorageSync('token')
clearAccountStorage()
setTimeout(() => {
uni.reLaunch({
url: '/pageSubPack/loginSub/pwd-login'
@@ -114,6 +114,23 @@ export const upload = (filePath, url, fileName) => {
* @param {Object|null|undefined} params - 原始请求参数
* @returns {Object} 过滤后的干净参数对象,只保留有效值
*/
/**
* 清除账号相关缓存(退出登录/切换账号/登录过期时调用)
* 只清除账号绑定的 key,保留设备级和应用级 key(如 push_cid、hasShowGuide、rememberPwd 等)
*/
export function clearAccountStorage() {
const keys = [
'token',
'userId',
'userPermission',
'currentVillage',
'currentVillageId',
'home_banner_cache',
'tempChangePwdParams'
]
keys.forEach(key => uni.removeStorageSync(key))
}
export function filterParams(params) {
if (!params) return {}
return Object.keys(params).reduce((acc, key) => {