ow
This commit is contained in:
1 parent
6417562c4f
commit
f1e6e116c3
31 files changed
+2065
-309
No files matched your search
@@ -9,6 +9,7 @@ import { useLocale } from "uview-pro";
|
||||
import { computed, ref } from "vue";
|
||||
import { brandGlyph, veinGlyph } from "@/common/brand";
|
||||
import { backendLocale, baseUrl } from "@/common/http.interceptor";
|
||||
import { DEFAULT_LOCALE, setCurrentUiLocale } from "@/common/locale-const";
|
||||
import { encryptLoginPassword } from "@/common/pwd-crypto";
|
||||
import { useThemeGradient, useThemeTokens } from "@/composables";
|
||||
import { LoginData as LoginDataClass } from "@/data/auto/loginData";
|
||||
@@ -58,12 +59,16 @@ onLoad((options) => {
|
||||
// 登录页中英文切换:走 uView Pro 语言包(t / setLocale),语言包 name 为 zh-CN / en-US
|
||||
const { t, setLocale, currentLocale } = useLocale();
|
||||
const isZh = computed(() => (currentLocale.value?.name ?? "zh-CN") !== "en-US");
|
||||
// 非组件上下文(请求拦截器)拿不到 useLocale,把当前界面语言登记到全局
|
||||
setCurrentUiLocale(currentLocale.value?.name ?? DEFAULT_LOCALE);
|
||||
|
||||
/** 非发布构建才显示「当前环境 + 实际调用的后端地址」:发布版 import.meta.env.PROD 为 true,整行编译期即被剔除 */
|
||||
const isProd = import.meta.env.PROD;
|
||||
const envMode = import.meta.env.MODE;
|
||||
function toggleLang() {
|
||||
setLocale(isZh.value ? "en-US" : "zh-CN");
|
||||
const next = isZh.value ? "en-US" : "zh-CN";
|
||||
setLocale(next);
|
||||
setCurrentUiLocale(next);
|
||||
// 开发构建顺手重拉数据库翻译:改完 DB 词条点一下切换就能看到新值,无需整页刷新
|
||||
// (生产构建 import.meta.env.DEV 为 false,该分支编译期即被剔除)
|
||||
if (import.meta.env.DEV) {
|
||||
|
||||
Reference in new issue
Block a user