mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-08 22:46:51 +08:00
fix: Modify the license import method (#8495)
This commit is contained in:
parent
e75449f19d
commit
39502b355f
16 changed files with 48 additions and 29 deletions
|
@ -2,7 +2,9 @@
|
|||
<div>
|
||||
<DialogPro v-model="open" class="level-up-pro" @close="handleClose">
|
||||
<div style="text-align: center" v-loading="loading">
|
||||
<span class="text-3xl font-medium title">{{ $t('license.levelUpPro') }}</span>
|
||||
<span class="text-3xl font-medium title">
|
||||
{{ isImport ? $t('license.importLicense') : $t('license.levelUpPro') }}
|
||||
</span>
|
||||
<el-row type="flex" justify="center" class="mt-6">
|
||||
<el-col :span="22">
|
||||
<el-upload
|
||||
|
@ -25,12 +27,12 @@
|
|||
</el-row>
|
||||
<el-button
|
||||
type="primary"
|
||||
class="mt-3 w-52"
|
||||
class="mt-3 w-52 custom-button"
|
||||
:disabled="loading || uploaderFiles.length == 0"
|
||||
plain
|
||||
@click="submit"
|
||||
>
|
||||
{{ $t('license.power') }}
|
||||
{{ isImport ? $t('commons.button.confirm') : $t('commons.button.power') }}
|
||||
</el-button>
|
||||
<div class="mt-3 mb-5">
|
||||
<el-button text type="primary" @click="toLxware">{{ $t('license.knowMorePro') }}</el-button>
|
||||
|
@ -56,16 +58,19 @@ const loading = ref(false);
|
|||
const open = ref(false);
|
||||
const uploadRef = ref<UploadInstance>();
|
||||
const uploaderFiles = ref<UploadFiles>([]);
|
||||
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,
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.custom-button {
|
||||
letter-spacing: 4px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</span>
|
||||
<div class="flex flex-wrap items-center">
|
||||
<el-link :underline="false" type="primary" @click="toLxware">
|
||||
{{ $t(!isMasterProductPro ? 'license.community' : 'license.pro') }}
|
||||
{{ $t(!isMasterPro ? 'license.community' : 'license.pro') }}
|
||||
</el-link>
|
||||
<el-link :underline="false" class="version" type="primary" @click="copyText(version)">
|
||||
{{ 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<string>('');
|
||||
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();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -50,6 +50,7 @@ const message = {
|
|||
verify: 'Verify',
|
||||
saveAndEnable: 'Save and enable',
|
||||
import: 'Import',
|
||||
power: 'Authorization',
|
||||
search: 'Search',
|
||||
refresh: 'Refresh',
|
||||
get: 'Get',
|
||||
|
|
|
@ -48,6 +48,7 @@ const message = {
|
|||
verify: '確認する',
|
||||
saveAndEnable: '保存して有効にします',
|
||||
import: '輸入',
|
||||
power: '認可',
|
||||
search: '検索',
|
||||
refresh: 'リロード',
|
||||
get: '得る',
|
||||
|
|
|
@ -48,6 +48,7 @@ const message = {
|
|||
verify: '검증',
|
||||
saveAndEnable: '저장 및 활성화',
|
||||
import: '가져오기',
|
||||
power: '권한 부여',
|
||||
search: '검색',
|
||||
refresh: '새로고침',
|
||||
get: '가져오기',
|
||||
|
|
|
@ -48,6 +48,7 @@ const message = {
|
|||
verify: 'Sahkan',
|
||||
saveAndEnable: 'Simpan dan aktifkan',
|
||||
import: 'Import',
|
||||
power: 'Pemberian Kuasa',
|
||||
search: 'Cari',
|
||||
refresh: 'Segarkan',
|
||||
get: 'Dapatkan',
|
||||
|
|
|
@ -48,6 +48,7 @@ const message = {
|
|||
verify: 'Verificar',
|
||||
saveAndEnable: 'Salvar e ativar',
|
||||
import: 'Importar',
|
||||
power: 'Autorização',
|
||||
search: 'Pesquisar',
|
||||
refresh: 'Atualizar',
|
||||
get: 'Obter',
|
||||
|
|
|
@ -48,6 +48,7 @@ const message = {
|
|||
verify: 'Проверить',
|
||||
saveAndEnable: 'Сохранить и включить',
|
||||
import: 'Импорт',
|
||||
power: 'Авторизация',
|
||||
search: 'Поиск',
|
||||
refresh: 'Обновить',
|
||||
get: 'Получить',
|
||||
|
|
|
@ -50,6 +50,7 @@ const message = {
|
|||
verify: '驗證',
|
||||
saveAndEnable: '保存並啟用',
|
||||
import: '導入',
|
||||
power: '授權',
|
||||
search: '搜索',
|
||||
refresh: '刷新',
|
||||
get: '獲取',
|
||||
|
|
|
@ -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: '请点击或拖动许可文件到此处',
|
||||
|
|
|
@ -96,6 +96,9 @@ const nodeChangeRef = ref<DropdownInstance>();
|
|||
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);
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue