diff --git a/apps/miniprogram/project.config.json b/apps/miniprogram/project.config.json index da4cd7d..2454a3c 100644 --- a/apps/miniprogram/project.config.json +++ b/apps/miniprogram/project.config.json @@ -3,12 +3,14 @@ "miniprogramRoot": "dist/", "compileType": "miniprogram", "setting": { - "autoAudits": false, "urlCheck": false, - "es6": true, - "enhance": true, + "automationAudits": true, + "es6": false, + "enhance": false, "compileHotReLoad": true, - "postcss": true, - "minified": true + "postcss": false, + "minified": false, + "bundle": false, + "minifyWXML": true } -} +} \ No newline at end of file diff --git a/apps/miniprogram/src/stores/auth.ts b/apps/miniprogram/src/stores/auth.ts index 9f71bb4..5970921 100644 --- a/apps/miniprogram/src/stores/auth.ts +++ b/apps/miniprogram/src/stores/auth.ts @@ -43,8 +43,14 @@ export const useAuthStore = create((set, get) => ({ }, restore: () => { - const user = Taro.getStorageSync('user') || null; - const roles = Taro.getStorageSync('user_roles') || []; + let user: AuthState['user'] = null; + let roles: string[] = []; + try { + const userData = secureGet('user_data'); + if (userData) user = JSON.parse(userData); + const rolesData = secureGet('user_roles'); + if (rolesData) roles = JSON.parse(rolesData); + } catch { /* secure storage 不可用时保持默认值 */ } const currentPatient = Taro.getStorageSync('current_patient') || null; set({ user, roles, currentPatient }); },