18 lines
929 B
Plaintext
18 lines
929 B
Plaintext
// 只清理指定账户命名空间,不触及其他账户或旧匿名草稿。
|
|||
|
|
export function clearAccountCache(userId: string): void {
|
||
|
|
if (userId.length == 0) return
|
||
|
|
const prefix = 'airz:v1:user:' + userId + ':'
|
||
|
|
uni.getStorageInfoSync().keys.forEach((key: string) => {
|
||
|
|
if (key.startsWith(prefix)) uni.removeStorageSync(key)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// 草稿功能已取消,启动时移除旧版本遗留键,不自动导入或恢复敏感表单。
|
||
|
|
export function clearLegacyAssessmentCache(): void {
|
||
|
|
uni.getStorageInfoSync().keys.forEach((key: string) => {
|
||
|
|
if (key == 'assessmentDraft' || key.startsWith('assessmentDraft:') || key.endsWith(':assessmentDraft')
|
||
|
|
|| key.includes(':assessmentDraft:') || key.endsWith(':assessmentActiveType') || key.endsWith(':assessmentEditStep')
|
||
|
|
|| key == 'assessmentActiveType' || key == 'assessmentEditStep') uni.removeStorageSync(key)
|
||
|
|
})
|
||
|
|
}
|