diff --git a/frontend/src/components/license-import/index.vue b/frontend/src/components/license-import/index.vue index 9adc8b361..5207d54bd 100644 --- a/frontend/src/components/license-import/index.vue +++ b/frontend/src/components/license-import/index.vue @@ -2,7 +2,9 @@
- {{ $t('license.levelUpPro') }} + + {{ isImport ? $t('license.importLicense') : $t('license.levelUpPro') }} + - {{ $t('license.power') }} + {{ isImport ? $t('commons.button.confirm') : $t('commons.button.power') }}
{{ $t('license.knowMorePro') }} @@ -56,16 +58,19 @@ const loading = ref(false); const open = ref(false); const uploadRef = ref(); const uploaderFiles = ref([]); +const isImport = ref(); const oldLicense = ref(); interface DialogProps { oldLicense: string; + isImport: boolean; } const acceptParams = (params: DialogProps) => { oldLicense.value = params?.oldLicense || ''; uploaderFiles.value = []; uploadRef.value?.clearFiles(); + isImport.value = params?.isImport; open.value = true; }; @@ -100,7 +105,12 @@ const submit = async () => { const file = uploaderFiles.value[0]; const formData = new FormData(); formData.append('file', file.raw); - formData.append('title', oldLicense.value); + if (oldLicense.value) { + formData.append('oldLicenseName', oldLicense.value); + } + if (!isImport.value) { + formData.append('currentNode', globalStore.currentNode); + } loading.value = true; await uploadLicense(oldLicense.value, formData) .then(async () => { @@ -130,3 +140,8 @@ defineExpose({ acceptParams, }); + diff --git a/frontend/src/components/system-upgrade/index.vue b/frontend/src/components/system-upgrade/index.vue index 69479340b..66710aab7 100644 --- a/frontend/src/components/system-upgrade/index.vue +++ b/frontend/src/components/system-upgrade/index.vue @@ -18,7 +18,7 @@
- {{ $t(!isMasterProductPro ? 'license.community' : 'license.pro') }} + {{ $t(!isMasterPro ? 'license.community' : 'license.pro') }} {{ version }} @@ -52,9 +52,11 @@ import { storeToRefs } from 'pinia'; const globalStore = GlobalStore(); const { docsUrl } = storeToRefs(globalStore); const upgradeRef = ref(); +const isMasterPro = computed(() => { + return globalStore.isMasterPro(); +}); const version = ref(''); -const isMasterProductPro = ref(); const loading = ref(false); const upgradeInfo = ref(); const upgradeVersion = ref(); @@ -119,7 +121,6 @@ const onLoadUpgradeInfo = async () => { }; onMounted(() => { - isMasterProductPro.value = globalStore.isMasterProductPro; search(); }); diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 4ec4dd50f..f60fe944a 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -50,6 +50,7 @@ const message = { verify: 'Verify', saveAndEnable: 'Save and enable', import: 'Import', + power: 'Authorization', search: 'Search', refresh: 'Refresh', get: 'Get', diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts index 726deaeeb..e3100e529 100644 --- a/frontend/src/lang/modules/ja.ts +++ b/frontend/src/lang/modules/ja.ts @@ -48,6 +48,7 @@ const message = { verify: '確認する', saveAndEnable: '保存して有効にします', import: '輸入', + power: '認可', search: '検索', refresh: 'リロード', get: '得る', diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts index 7a3941d61..b0e3c0b38 100644 --- a/frontend/src/lang/modules/ko.ts +++ b/frontend/src/lang/modules/ko.ts @@ -48,6 +48,7 @@ const message = { verify: '검증', saveAndEnable: '저장 및 활성화', import: '가져오기', + power: '권한 부여', search: '검색', refresh: '새로고침', get: '가져오기', diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts index de7ddc82f..910bd6aeb 100644 --- a/frontend/src/lang/modules/ms.ts +++ b/frontend/src/lang/modules/ms.ts @@ -48,6 +48,7 @@ const message = { verify: 'Sahkan', saveAndEnable: 'Simpan dan aktifkan', import: 'Import', + power: 'Pemberian Kuasa', search: 'Cari', refresh: 'Segarkan', get: 'Dapatkan', diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts index ae3f21469..be399d9e0 100644 --- a/frontend/src/lang/modules/pt-br.ts +++ b/frontend/src/lang/modules/pt-br.ts @@ -48,6 +48,7 @@ const message = { verify: 'Verificar', saveAndEnable: 'Salvar e ativar', import: 'Importar', + power: 'Autorização', search: 'Pesquisar', refresh: 'Atualizar', get: 'Obter', diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts index 0d5735187..66fb44558 100644 --- a/frontend/src/lang/modules/ru.ts +++ b/frontend/src/lang/modules/ru.ts @@ -48,6 +48,7 @@ const message = { verify: 'Проверить', saveAndEnable: 'Сохранить и включить', import: 'Импорт', + power: 'Авторизация', search: 'Поиск', refresh: 'Обновить', get: 'Получить', diff --git a/frontend/src/lang/modules/zh-Hant.ts b/frontend/src/lang/modules/zh-Hant.ts index c3709084d..d160d07dc 100644 --- a/frontend/src/lang/modules/zh-Hant.ts +++ b/frontend/src/lang/modules/zh-Hant.ts @@ -50,6 +50,7 @@ const message = { verify: '驗證', saveAndEnable: '保存並啟用', import: '導入', + power: '授權', search: '搜索', refresh: '刷新', get: '獲取', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 22379d301..ad585e27b 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -50,6 +50,7 @@ const message = { verify: '验证', saveAndEnable: '保存并启用', import: '导入', + power: '授权', search: '搜索', refresh: '刷新', get: '获取', @@ -1755,7 +1756,6 @@ const message = { lostHelper: '许可证已达到最大重试次数,请手动点击同步按钮,以确保专业版功能正常使用,详情:', exceptionalHelper: '许可证同步验证异常,请手动点击同步按钮,以确保专业版功能正常使用,详情:', quickUpdate: '快速更新', - power: '授 权', unbindHelper: '解除绑定后将清除该节点所有专业版相关设置,是否继续?', importLicense: '导入许可证', importHelper: '请点击或拖动许可文件到此处', diff --git a/frontend/src/layout/components/Sidebar/components/Collapse.vue b/frontend/src/layout/components/Sidebar/components/Collapse.vue index 4d5270451..b1fbf4082 100644 --- a/frontend/src/layout/components/Sidebar/components/Collapse.vue +++ b/frontend/src/layout/components/Sidebar/components/Collapse.vue @@ -96,6 +96,9 @@ const nodeChangeRef = ref(); const props = defineProps({ version: String, }); +const isMasterPro = computed(() => { + return globalStore.isMasterPro(); +}); const emit = defineEmits(['openTask']); bus.on('refreshTask', () => { @@ -128,7 +131,7 @@ const changeFilter = () => { }; const loadNodes = async () => { - if (!globalStore.isMasterProductPro) { + if (!isMasterPro.value) { globalStore.currentNode = 'local'; return; } @@ -156,7 +159,7 @@ const changeNode = (command: string) => { globalStore.currentNode = command || 'local'; globalStore.isOffline = false; router.push({ name: 'home' }).then(() => { - location.reload(); + window.location.reload(); }); return; } @@ -177,14 +180,14 @@ const changeNode = (command: string) => { globalStore.currentNode = command || 'local'; globalStore.isOffline = item.isOffline; router.push({ name: 'home' }).then(() => { - location.reload(); + window.location.reload(); }); } } }; const showNodes = () => { - return nodes.value.length > 0 && globalStore.isMasterProductPro; + return nodes.value.length > 0 && isMasterPro; }; const taskCount = ref(0); diff --git a/frontend/src/layout/index.vue b/frontend/src/layout/index.vue index 9fb782aba..ca7e06ddf 100644 --- a/frontend/src/layout/index.vue +++ b/frontend/src/layout/index.vue @@ -112,14 +112,14 @@ const loadStatus = async () => { await getSystemAvailable() .then((res) => { if (res) { - location.reload(); + window.location.reload(); toLogin(); clearInterval(Number(timer)); timer = null; } }) .catch(() => { - location.reload(); + window.location.reload(); clearInterval(Number(timer)); timer = null; }); diff --git a/frontend/src/store/modules/global.ts b/frontend/src/store/modules/global.ts index 353ec7c35..b5d4705df 100644 --- a/frontend/src/store/modules/global.ts +++ b/frontend/src/store/modules/global.ts @@ -22,6 +22,9 @@ const GlobalStore = defineStore({ logo: '', logoWithText: '', favicon: '', + loginImage: '', + loginBackground: '', + loginBgType: '', }, openMenuTabs: false, isFullScreen: false, @@ -89,6 +92,9 @@ const GlobalStore = defineStore({ isMobile() { return this.device === DeviceType.Mobile; }, + isMasterPro() { + return this.isMasterProductPro; + }, setLastFilePath(path: string) { this.lastFilePath = path; }, diff --git a/frontend/src/views/setting/license/bind/free.vue b/frontend/src/views/setting/license/bind/free.vue index b8e85eced..2d3e18de5 100644 --- a/frontend/src/views/setting/license/bind/free.vue +++ b/frontend/src/views/setting/license/bind/free.vue @@ -22,9 +22,7 @@ import { reactive, ref } from 'vue'; import i18n from '@/lang'; import { MsgSuccess } from '@/utils/message'; import { changeBind, listNodeOptions } from '@/api/modules/setting'; -import { GlobalStore } from '@/store'; import { Setting } from '@/api/interface/setting'; -const globalStore = GlobalStore(); interface DialogProps { licenseID: number; @@ -61,7 +59,6 @@ const onBind = async () => { .then(() => { loading.value = false; MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); - globalStore.isProductPro = false; window.location.reload(); }) .catch(() => { diff --git a/frontend/src/views/setting/license/bind/xpack.vue b/frontend/src/views/setting/license/bind/xpack.vue index 72cf640c3..10b7123f2 100644 --- a/frontend/src/views/setting/license/bind/xpack.vue +++ b/frontend/src/views/setting/license/bind/xpack.vue @@ -63,7 +63,6 @@ const onBind = async (formEl: FormInstance | undefined) => { .then(() => { loading.value = false; MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); - globalStore.isProductPro = false; window.location.reload(); }) .catch(() => { diff --git a/frontend/src/views/setting/license/index.vue b/frontend/src/views/setting/license/index.vue index f7dcc290c..08e6869b0 100644 --- a/frontend/src/views/setting/license/index.vue +++ b/frontend/src/views/setting/license/index.vue @@ -101,10 +101,7 @@ import BindXpack from '@/views/setting/license/bind/xpack.vue'; import { dateFormat } from '@/utils/util'; import i18n from '@/lang'; import { MsgError, MsgSuccess } from '@/utils/message'; -import { GlobalStore } from '@/store'; -import { initFavicon } from '@/utils/xpack'; -const globalStore = GlobalStore(); const loading = ref(); const licenseRef = ref(); const bindFreeRef = ref(); @@ -175,13 +172,7 @@ const submitUnbind = async () => { .then(() => { loading.value = false; MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); - if (unbindRow.value.freeCount !== 0) { - globalStore.isMasterProductPro = false; - initFavicon(); - window.location.reload(); - return; - } - search(); + window.location.reload(); }) .catch(() => { loading.value = false; @@ -226,7 +217,7 @@ const timestampToDate = (timestamp: number) => { }; const toUpload = () => { - licenseRef.value.acceptParams(); + licenseRef.value.acceptParams({ isImport: true }); }; const loadVersion = (row: any) => {