mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-02 03:48:05 +08:00
fix 切换语言不清空 tabs 缓存
This commit is contained in:
parent
8aa6e2dacc
commit
fc3d0f0762
@ -27,14 +27,14 @@ export const langDict: { [key: string]: LangType } = {
|
||||
local: () => import(/* @vite-ignore */ './locales/zh_cn.json')
|
||||
},
|
||||
'zh-hk': {
|
||||
// 🇭🇰
|
||||
label: '\u7e41\u4f53\u4e2d\u6587\uff08\u4e2d\u56fd\u9999\u6e2f\uff09',
|
||||
// 🇭🇰 繁體中文(中國香港)
|
||||
label: '\u7e41\u9ad4\u4e2d\u6587\uff08\u4e2d\u570b\u9999\u6e2f\uff09',
|
||||
antd: () => import(/* @vite-ignore */ 'ant-design-vue/es/locale/zh_HK'),
|
||||
local: () => import(/* @vite-ignore */ './locales/zh_hk.json')
|
||||
},
|
||||
'zh-tw': {
|
||||
// 🇨🇳
|
||||
label: '\u7e41\u4f53\u4e2d\u6587\uff08\u4e2d\u56fd\u53f0\u6e7e\uff09',
|
||||
// 🇨🇳 繁體中文(中國臺灣)
|
||||
label: '\u7e41\u9ad4\u4e2d\u6587\uff08\u4e2d\u570b\u81fa\u7063\uff09',
|
||||
antd: () => import(/* @vite-ignore */ 'ant-design-vue/es/locale/zh_TW'),
|
||||
local: () => import(/* @vite-ignore */ './locales/zh_tw.json')
|
||||
},
|
||||
|
@ -1594,7 +1594,6 @@
|
||||
"i18n_9014d6d289":"backup list",
|
||||
"i18n_90154854b6":"Please enter host",
|
||||
"i18n_901de97cdb":"Mode Request interface parameters are passed into the request body ContentType Please use: text/plain",
|
||||
"i18n_9030cebe31":"After switching the language, the page will automatically refresh, and the already opened tab menu (tab) will be cleared together",
|
||||
"i18n_903b25f64e":"unknown state",
|
||||
"i18n_904615588b":"File type does not have console functionality",
|
||||
"i18n_9057ac9664":"Please select the trigger type",
|
||||
@ -1623,6 +1622,7 @@
|
||||
"i18n_92e3a830ae":"help",
|
||||
"i18n_92f0744426":"Container building refers to the use of docker containers to execute builds, which can be isolated from the host environment without installing a dependent environment",
|
||||
"i18n_92f3fdb65f":"Warehouse:",
|
||||
"i18n_92f9a3c474":"The page will automatically refresh after switching languages",
|
||||
"i18n_9300692fac":"Markup Reference",
|
||||
"i18n_9302bc7838":"Please enter the port to check",
|
||||
"i18n_930882bb0a":"a",
|
||||
|
@ -1594,7 +1594,7 @@
|
||||
"i18n_9014d6d289": "备份列表",
|
||||
"i18n_90154854b6": "请输入host",
|
||||
"i18n_901de97cdb": "方式请求接口参数传入到请求体 ContentType 请使用:text/plain",
|
||||
"i18n_9030cebe31": "切换语言后页面将自动刷新,已经打开的标签菜单(选项卡)将一并清空",
|
||||
|
||||
"i18n_903b25f64e": "未知状态",
|
||||
"i18n_904615588b": "文件类型没有控制台功能",
|
||||
"i18n_9057ac9664": "请选择触发类型",
|
||||
@ -1623,6 +1623,7 @@
|
||||
"i18n_92e3a830ae": "帮助",
|
||||
"i18n_92f0744426": "容器构建是指使用 docker 容器执行构建,这样可以达到和宿主机环境隔离不用安装依赖环境",
|
||||
"i18n_92f3fdb65f": "仓库:",
|
||||
"i18n_92f9a3c474": "切换语言后页面将自动刷新",
|
||||
"i18n_9300692fac": "标记引用",
|
||||
"i18n_9302bc7838": "请输入要检查的端口",
|
||||
"i18n_930882bb0a": "个",
|
||||
|
@ -1594,7 +1594,6 @@
|
||||
"i18n_9014d6d289":"備份列表",
|
||||
"i18n_90154854b6":"請輸入host",
|
||||
"i18n_901de97cdb":"方式請求接口參數傳入到請求體 ContentType 請使用:text/plain",
|
||||
"i18n_9030cebe31":"切換語言後頁面將自動刷新,已經打開的標籤菜單(選項卡)將一併清空",
|
||||
"i18n_903b25f64e":"未知狀態",
|
||||
"i18n_904615588b":"文件類型沒有控制枱功能",
|
||||
"i18n_9057ac9664":"請選擇觸發類型",
|
||||
@ -1623,6 +1622,7 @@
|
||||
"i18n_92e3a830ae":"幫助",
|
||||
"i18n_92f0744426":"容器構建是指使用 docker 容器執行構建,這樣可以達到和宿主機環境隔離不用安裝依賴環境",
|
||||
"i18n_92f3fdb65f":"倉庫:",
|
||||
"i18n_92f9a3c474":"切換語言後頁面將自動刷新",
|
||||
"i18n_9300692fac":"標記引用",
|
||||
"i18n_9302bc7838":"請輸入要檢查的端口",
|
||||
"i18n_930882bb0a":"個",
|
||||
|
@ -1594,7 +1594,6 @@
|
||||
"i18n_9014d6d289":"備份列表",
|
||||
"i18n_90154854b6":"請輸入host",
|
||||
"i18n_901de97cdb":"方式請求介面引數傳入到請求體 ContentType 請使用:text/plain",
|
||||
"i18n_9030cebe31":"切換語言後頁面將自動重新整理,已經開啟的標籤選單(選項卡)將一併清空",
|
||||
"i18n_903b25f64e":"未知狀態",
|
||||
"i18n_904615588b":"檔案型別沒有控制檯功能",
|
||||
"i18n_9057ac9664":"請選擇觸發型別",
|
||||
@ -1623,6 +1622,7 @@
|
||||
"i18n_92e3a830ae":"幫助",
|
||||
"i18n_92f0744426":"容器構建是指使用 docker 容器執行構建,這樣可以達到和宿主機環境隔離不用安裝依賴環境",
|
||||
"i18n_92f3fdb65f":"倉庫:",
|
||||
"i18n_92f9a3c474":"切換語言後頁面將自動重新整理",
|
||||
"i18n_9300692fac":"標記引用",
|
||||
"i18n_9302bc7838":"請輸入要檢查的埠",
|
||||
"i18n_930882bb0a":"個",
|
||||
|
@ -13,7 +13,6 @@ import '@/assets/reset.less'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import '@/router/auth'
|
||||
import CustomModal from '@/components/customModal/index.vue'
|
||||
import i18n from './i18n'
|
||||
import { changeLang, defaultLocale } from './i18n'
|
||||
|
||||
@ -27,9 +26,6 @@ changeLang(defaultLocale).then(() => {
|
||||
app.use(pinia)
|
||||
app.use(i18n)
|
||||
|
||||
// 增加弹窗全局引入
|
||||
app.component('CustomModal', CustomModal)
|
||||
|
||||
app.mount('#app')
|
||||
})
|
||||
//console.log('app done', new Date().getTime())
|
||||
|
@ -456,7 +456,7 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item :label="$t('i18n_295bb704f5')">
|
||||
<template #help>{{ $t('i18n_9030cebe31') }}</template>
|
||||
<template #help>{{ $t('i18n_92f9a3c474') }}</template>
|
||||
|
||||
<a-select v-model:value="locale" style="width: 220px">
|
||||
<a-select-option v-for="item in supportLang" :key="item.value" :value="item.value">{{
|
||||
|
@ -16,6 +16,7 @@ import { getHashQuery } from '@/utils/utils'
|
||||
import { RouteLocationNormalized } from 'vue-router'
|
||||
import { executionRequest } from '@/api/external'
|
||||
import { parseTime, pageBuildInfo } from '@/utils/const'
|
||||
import { useGuideStore } from '@/stores/guide'
|
||||
|
||||
export const useAppStore = defineStore('app', {
|
||||
state: () => ({
|
||||
@ -50,7 +51,11 @@ export const useAppStore = defineStore('app', {
|
||||
this.isShowInfo = true
|
||||
// 控制台输出版本号信息
|
||||
const buildInfo = pageBuildInfo()
|
||||
executionRequest('https://jpom.top/docs/versions.show', { ...buildInfo, p: to.path })
|
||||
executionRequest('https://jpom.top/docs/versions.show', {
|
||||
...buildInfo,
|
||||
p: to.path,
|
||||
l: useGuideStore().getLocale()
|
||||
})
|
||||
.then((data) => {
|
||||
console.log(
|
||||
'\n %c ' + parseTime(buildInfo.t) + ' %c vs %c ' + buildInfo.v + ' %c vs %c ' + data,
|
||||
|
@ -8,7 +8,7 @@
|
||||
/// See the Mulan PSL v2 for more details.
|
||||
///
|
||||
import { t, defaultLocale, normalLang } from '@/i18n'
|
||||
import { useAllMenuStore } from './menu2'
|
||||
|
||||
/**
|
||||
* 引导相关 store
|
||||
*
|
||||
@ -144,11 +144,6 @@ export const useGuideStore = defineStore('guide', {
|
||||
cache.locale = locale || 'zh-cn'
|
||||
this.setGuideCache(cache)
|
||||
//
|
||||
//清空本地 tabs
|
||||
const menuStore = useAllMenuStore()
|
||||
// 调用其他 action
|
||||
menuStore.clearTabs('normal', { key: 'all' })
|
||||
menuStore.clearTabs('management', { key: 'all' })
|
||||
location.reload()
|
||||
}
|
||||
},
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { path } from 'node:path'
|
||||
///
|
||||
/// Copyright (c) 2019 Of Him Code Technology Studio
|
||||
/// Jpom is licensed under Mulan PSL v2.
|
||||
@ -13,6 +14,7 @@ import { MANAGEMENT_ACTIVE_TAB_KEY, MANAGEMENT_TAB_LIST_KEY, MANAGEMENT_ACTIVE_M
|
||||
|
||||
import { getMenu, getSystemMenu } from '@/api/menu'
|
||||
import routeMenuMap from '@/router/route-menu'
|
||||
import { title } from 'process'
|
||||
|
||||
const api: any = {
|
||||
normal: getMenu,
|
||||
@ -123,18 +125,37 @@ export const useAllMenuStore = defineStore('menu2', {
|
||||
})
|
||||
let tabList = this[mode + '_tabList'] || []
|
||||
// 过滤已经不能显示的菜单
|
||||
tabList = tabList.filter((item: any) => {
|
||||
return (
|
||||
menus.filter((menu: any) => {
|
||||
return (
|
||||
menu.path == item.path ||
|
||||
menu.childs?.filter((subMenu: any) => {
|
||||
tabList = tabList
|
||||
.map((item: any) => {
|
||||
const newTitle = menus
|
||||
.map((menu: any) => {
|
||||
// console.log(menu)
|
||||
if (menu.path == item.path) {
|
||||
return menu.title
|
||||
}
|
||||
const findSub = menu.childs?.find((subMenu: any) => {
|
||||
return subMenu.path === item.path
|
||||
}).length > 0
|
||||
)
|
||||
}).length > 0
|
||||
)
|
||||
})
|
||||
})
|
||||
if (findSub) {
|
||||
return findSub.title
|
||||
}
|
||||
})
|
||||
.find((title: any) => title)
|
||||
|
||||
return { ...item, title: newTitle }
|
||||
})
|
||||
.filter((item: any) => {
|
||||
return (
|
||||
menus.filter((menu: any) => {
|
||||
return (
|
||||
menu.path == item.path ||
|
||||
menu.childs?.filter((subMenu: any) => {
|
||||
return subMenu.path === item.path
|
||||
}).length > 0
|
||||
)
|
||||
}).length > 0
|
||||
)
|
||||
})
|
||||
this.setTabList(mode, tabList)
|
||||
|
||||
if (!currentMenu) {
|
||||
|
@ -429,9 +429,9 @@ export function compareVersion(version1: string, version2: string) {
|
||||
|
||||
// 当前页面构建信息
|
||||
export function pageBuildInfo() {
|
||||
const htmlVersion = document.head.querySelector('[name~=jpom-version][content]')?.content
|
||||
const buildTime = document.head.querySelector('[name~=build-time][content]')?.content
|
||||
const buildEnv = document.head.querySelector('[name~=build-env][content]')?.content
|
||||
const htmlVersion = (document.head.querySelector('[name~=jpom-version][content]') as any)?.content
|
||||
const buildTime = (document.head.querySelector('[name~=build-time][content]') as any)?.content
|
||||
const buildEnv = (document.head.querySelector('[name~=build-env][content]') as any)?.content
|
||||
return {
|
||||
v: htmlVersion,
|
||||
t: buildTime,
|
||||
|
Loading…
Reference in New Issue
Block a user