diff --git a/.env.local b/.env.local index 610d0f1..3406c71 100644 --- a/.env.local +++ b/.env.local @@ -4,6 +4,7 @@ NODE_ENV=development VITE_DEV=true # 请求路径 +# VITE_BASE_URL='http://172.16.214.222:48080' VITE_BASE_URL='http://192.168.1.144:48080' # VITE_BASE_URL='http://47.79.98.113:48080' # VITE_BASE_URL='https://backstageapi.yolozs.com' diff --git a/src/locales/en.ts b/src/locales/en.ts index 7e67347..6e4a7b7 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -590,5 +590,10 @@ export default { fllowernum: 'Followers', updateTime: 'Update Time' - } + }, + hostsInvitationType:{ + eliteTicket:'elite ticket', + regularTicket:'regular ticket', + + }, } diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index a04e39a..d45b15e 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -589,5 +589,10 @@ export default { fllowernum: '关注数', updateTime: '更新时间' }, + hostsInvitationType:{ + eliteTicket:'金票', + regularTicket:'普票', + + }, 'OAuth 2.0': 'OAuth 2.0' // 避免菜单名是 OAuth 2.0 时,一直 warn 报错 } diff --git a/src/views/server/employeehosts/index.vue b/src/views/server/employeehosts/index.vue index f4ef321..7b5698b 100644 --- a/src/views/server/employeehosts/index.vue +++ b/src/views/server/employeehosts/index.vue @@ -87,8 +87,9 @@ + :label="$t(dict.label)" :value="dict.value" /> + - + + @@ -179,7 +183,11 @@ - + + + @@ -292,6 +300,29 @@ import { getAllocation, getCountry } from '@/api/system/user' import { useCache } from '@/hooks/web/useCache' import { func } from 'vue-types' import MobilePagination from '@/components/MobilePagination.vue' +import { useDictStore } from '@/store/modules/dict' // 如果你项目里有字典 store +const dictStore = useDictStore?.() // 有就用;没有的话把 dictStore 相关行删掉 + +// 统一用字符串比较,自动识别并翻译 i18n key +function dictLabelI18n(type: string, val: any) { + const v = val == null ? '' : String(val) + + // 优先从 store 取;若没有,就从你现有的工具取(getIntDictOptions / getStrDictOptions) + const opts = + (dictStore?.getDictOptions?.(type) as any[]) || + getIntDictOptions(type) || + getStrDictOptions(type) || + [] + + const hit = opts.find(o => String(o.value) === v) + const label = hit?.label ?? '' + // 形如 a.b 或包含点号的,大概率是 i18n key,则用 t() 翻 + return label && label.includes('.') ? t(label) : label +} + + + + const { wsCache } = useCache() diff --git a/src/views/server/manageemployeehosts/index.vue b/src/views/server/manageemployeehosts/index.vue index b78f276..8691f1b 100644 --- a/src/views/server/manageemployeehosts/index.vue +++ b/src/views/server/manageemployeehosts/index.vue @@ -83,7 +83,7 @@ + :label="$t(dict.label)" :value="dict.value" /> @@ -153,16 +153,12 @@ - - - - - - - + @@ -173,7 +169,11 @@ - + + + @@ -269,6 +269,28 @@ import EmployeeHostsForm from './EmployeeHostsForm.vue' import { getAllocation, getSimpleUserList, getCountry } from '@/api/system/user' import { useCache } from '@/hooks/web/useCache' import MobilePagination from '@/components/MobilePagination.vue' +import { useDictStore } from '@/store/modules/dict' // 如果你项目里有字典 store +const dictStore = useDictStore?.() // 有就用;没有的话把 dictStore 相关行删掉 + +// 统一用字符串比较,自动识别并翻译 i18n key +function dictLabelI18n(type: string, val: any) { + const v = val == null ? '' : String(val) + + // 优先从 store 取;若没有,就从你现有的工具取(getIntDictOptions / getStrDictOptions) + const opts = + (dictStore?.getDictOptions?.(type) as any[]) || + getIntDictOptions(type) || + getStrDictOptions(type) || + [] + + const hit = opts.find(o => String(o.value) === v) + const label = hit?.label ?? '' + // 形如 a.b 或包含点号的,大概率是 i18n key,则用 t() 翻 + return label && label.includes('.') ? t(label) : label +} + + + const { wsCache } = useCache() diff --git a/src/views/server/newhosts/NewHostsForm.vue b/src/views/server/newhosts/NewHostsForm.vue index 9ecb5ab..0233e3a 100644 --- a/src/views/server/newhosts/NewHostsForm.vue +++ b/src/views/server/newhosts/NewHostsForm.vue @@ -13,8 +13,9 @@ + :label="$t(dict.label)" :value="dict.value" /> + diff --git a/src/views/server/newhosts/index.vue b/src/views/server/newhosts/index.vue index 5eadb2c..a7afa34 100644 --- a/src/views/server/newhosts/index.vue +++ b/src/views/server/newhosts/index.vue @@ -117,7 +117,7 @@ + :label="$t(dict.label)" :value="dict.value" /> @@ -178,11 +178,15 @@ - + + + @@ -191,7 +195,11 @@ - + + +