Commit 5019a8fc authored by nick zheng's avatar nick zheng

Merge branch 'beta' into 'master'

chore: 身份过期提示语多语言

See merge request !57
parents 255a4bd6 fc2fc3ef
import i18n from '@/locales'
import { fetchEventSource } from '@microsoft/fetch-event-source' import { fetchEventSource } from '@microsoft/fetch-event-source'
import { BASE_URLS } from '@/config/base-url' import { BASE_URLS } from '@/config/base-url'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useSystemLanguageStore } from '@/store/modules/system-language' import { useSystemLanguageStore } from '@/store/modules/system-language'
import { languageKeyTransform } from '@/utils/language-key-transform' import { languageKeyTransform } from '@/utils/language-key-transform'
const { t } = i18n.global
const ENV = import.meta.env.VITE_APP_ENV const ENV = import.meta.env.VITE_APP_ENV
const EVENT_SOURCE_BASE_URL = `${BASE_URLS[ENV || 'DEV']}` const EVENT_SOURCE_BASE_URL = `${BASE_URLS[ENV || 'DEV']}`
...@@ -43,7 +46,7 @@ export function fetchCustomEventSource(config: { ...@@ -43,7 +46,7 @@ export function fetchCustomEventSource(config: {
const data = JSON.parse(e.data) const data = JSON.parse(e.data)
if (data.code === -10) { if (data.code === -10) {
window.$message.info('身份已过期,请重新登陆') window.$message.info(t('common_module.expired_identity'))
config.onError && config.onError(data) config.onError && config.onError(data)
......
...@@ -81,6 +81,7 @@ common_module: ...@@ -81,6 +81,7 @@ common_module:
no_file: 'No file' no_file: 'No file'
view_file: 'View file' view_file: 'View file'
total_file: '1 file in total | {count} files in total' total_file: '1 file in total | {count} files in total'
expired_identity: 'Your identity has expired. Please login again'
dialogue_module: dialogue_module:
......
...@@ -80,6 +80,7 @@ common_module: ...@@ -80,6 +80,7 @@ common_module:
no_file: '暂无文件' no_file: '暂无文件'
view_file: '查看文件' view_file: '查看文件'
total_file: '共{count}个文件' total_file: '共{count}个文件'
expired_identity: '身份已过期,请重新登录'
dialogue_module: dialogue_module:
......
...@@ -80,6 +80,7 @@ common_module: ...@@ -80,6 +80,7 @@ common_module:
no_file: '暫無文件' no_file: '暫無文件'
view_file: '查看文件' view_file: '查看文件'
total_file: '共{count}個文件' total_file: '共{count}個文件'
expired_identity: '身份已過期,請重新登錄'
dialogue_module: dialogue_module:
continue_question_message: '你可以繼續提問' continue_question_message: '你可以繼續提問'
......
import axios, { type AxiosRequestConfig, type AxiosResponse } from 'axios' import axios, { type AxiosRequestConfig, type AxiosResponse } from 'axios'
import i18n from '@/locales'
import { BASE_URLS } from '@/config/base-url' import { BASE_URLS } from '@/config/base-url'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
...@@ -7,6 +8,8 @@ import { debounce } from 'lodash-es' ...@@ -7,6 +8,8 @@ import { debounce } from 'lodash-es'
import { useSystemLanguageStore } from '@/store/modules/system-language' import { useSystemLanguageStore } from '@/store/modules/system-language'
import { languageKeyTransform } from './language-key-transform' import { languageKeyTransform } from './language-key-transform'
const { t } = i18n.global
interface PagingInfoParams { interface PagingInfoParams {
pageNo: number pageNo: number
pageSize: number pageSize: number
...@@ -39,7 +42,7 @@ const handleLogout = debounce( ...@@ -39,7 +42,7 @@ const handleLogout = debounce(
router.replace({ name: 'Login', query: { redirect: encodeURIComponent(currentRoute.fullPath) } }) router.replace({ name: 'Login', query: { redirect: encodeURIComponent(currentRoute.fullPath) } })
useUserStore().logout() useUserStore().logout()
window.$message.warning('身份已过期,请重新登录') window.$message.warning(t('common_module.expired_identity'))
}, },
2000, 2000,
{ leading: true, trailing: false }, { leading: true, trailing: false },
......
import i18n from '@/locales'
import { fetchEventSource } from '@microsoft/fetch-event-source' import { fetchEventSource } from '@microsoft/fetch-event-source'
import { BASE_URLS } from '@/config/base-url' import { BASE_URLS } from '@/config/base-url'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useSystemLanguageStore } from '@/store/modules/system-language' import { useSystemLanguageStore } from '@/store/modules/system-language'
import { languageKeyTransform } from '@/utils/language-key-transform' import { languageKeyTransform } from '@/utils/language-key-transform'
const { t } = i18n.global
const ENV = import.meta.env.VITE_APP_ENV const ENV = import.meta.env.VITE_APP_ENV
const EVENT_SOURCE_BASE_URL = `${BASE_URLS[ENV || 'DEV']}` const EVENT_SOURCE_BASE_URL = `${BASE_URLS[ENV || 'DEV']}`
...@@ -43,7 +46,7 @@ export function fetchEventStreamSource(config: { ...@@ -43,7 +46,7 @@ export function fetchEventStreamSource(config: {
const data = JSON.parse(e.data) const data = JSON.parse(e.data)
if (data.code === -10) { if (data.code === -10) {
window.$message.info('身份已过期,请重新登陆') window.$message.info(t('common_module.expired_identity'))
config.onError && config.onError(data) config.onError && config.onError(data)
......
...@@ -81,6 +81,7 @@ declare namespace I18n { ...@@ -81,6 +81,7 @@ declare namespace I18n {
no_file: string no_file: string
view_file: string view_file: string
total_file: string total_file: string
expired_identity: string
dialogue_module: { dialogue_module: {
continue_question_message: string continue_question_message: string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment