ow
This commit is contained in:
1 parent
8a2adb0a92
commit
bd678b0112
22 files changed
+1968
-81
No files matched your search
@@ -4,10 +4,10 @@
|
||||
// 加密已抽到 @/common/pwd-crypto(wxmp-rsa 纯 JS 实现,H5/小程序/App 全端可用)
|
||||
import type { LoginData } from "@/data/auto/loginData";
|
||||
import type { LoginProfile } from "@/data/auto/loginProfile";
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { useLocale } from "uview-pro";
|
||||
import { computed, ref } from "vue";
|
||||
import { backendLocale, baseUrl, hasLoginSession } from "@/common/http.interceptor";
|
||||
import { backendLocale, baseUrl } from "@/common/http.interceptor";
|
||||
import { encryptLoginPassword } from "@/common/pwd-crypto";
|
||||
import { LoginData as LoginDataClass } from "@/data/auto/loginData";
|
||||
import { reloadLocales } from "@/locale";
|
||||
@@ -36,17 +36,10 @@ onLoad((options) => {
|
||||
});
|
||||
|
||||
/**
|
||||
* 冷启动直接落在登录入口且本地已有登录会话 → 自动进 dashboard,
|
||||
* 省掉"明明登录过还闪一下登录页"。令牌若已过期,dashboard 首个请求会触发请求层用
|
||||
* RefreshToken 自动续期;续期失败再 goLogin 退回本页,不会卡在受保护页里。
|
||||
* 被"有意送回登录页"的场景(401 去登录 / 403 重新登录)不必再设豁免:
|
||||
* goLoginWithRedirect 已先清登录态,此刻 hasLoginSession 必为假,表单正常展示。
|
||||
* 已登录访问 /login 不再自动放行进 dashboard——本页是"切换账号"的唯一入口,
|
||||
* 自动跳走会让用户够不到登录表单。旧令牌在 Login 成功后被 updateLoginProfile 覆盖;
|
||||
* 由守卫送回本页的场景 goLoginWithRedirect 已先 clearLoginState,会话本就是干净的。
|
||||
*/
|
||||
onShow(() => {
|
||||
if (hasLoginSession()) {
|
||||
uni.reLaunch({ url: redirectUrl.value });
|
||||
}
|
||||
});
|
||||
|
||||
// 登录页中英文切换:走 uView Pro 语言包(t / setLocale),语言包 name 为 zh-CN / en-US
|
||||
const { t, setLocale, currentLocale } = useLocale();
|
||||
|
||||
Reference in new issue
Block a user