修复bug
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user