diff --git a/src/config/axios/index.ts b/src/config/axios/index.ts index 79e558dae..919b50131 100644 --- a/src/config/axios/index.ts +++ b/src/config/axios/index.ts @@ -1,9 +1,12 @@ import { service } from './service' import { config } from './config' +import { useCache } from '@/hooks/web/useCache' const { default_headers } = config - +const { wsCache } = useCache() +console.log('lang='+wsCache.get('lang')); +const language = wsCache.get('lang') const request = (option: any) => { const { url, method, params, data, headersType, responseType, ...config } = option return service({ @@ -14,7 +17,8 @@ const request = (option: any) => { ...config, responseType: responseType, headers: { - 'Content-Type': headersType || default_headers + 'Content-Type': headersType || default_headers, + 'language': language } }) } diff --git a/src/locales/en.ts b/src/locales/en-US.ts similarity index 100% rename from src/locales/en.ts rename to src/locales/en-US.ts diff --git a/src/store/modules/locale.ts b/src/store/modules/locale.ts index 1fc772a73..c0a020df5 100644 --- a/src/store/modules/locale.ts +++ b/src/store/modules/locale.ts @@ -30,7 +30,7 @@ export const useLocaleStore = defineStore('locales', { name: '简体中文' }, { - lang: 'en', + lang: 'en-US', name: 'English' } ] diff --git a/src/views/Login/components/LoginForm.vue b/src/views/Login/components/LoginForm.vue index 403d20807..237aefd6a 100644 --- a/src/views/Login/components/LoginForm.vue +++ b/src/views/Login/components/LoginForm.vue @@ -188,6 +188,7 @@ const handleLogin = async (params) => { } const res = await LoginApi.login(loginData.loginForm) if (!res) { + getCode() return } loading.value = ElLoading.service({ @@ -212,6 +213,7 @@ const handleLogin = async (params) => { push({ path: redirect.value || permissionStore.addRouters[0].path }) } } finally { + getCode() loginLoading.value = false loading.value.close() }