mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-13 02:55:18 +08:00
feat: 移除多余代码
This commit is contained in:
parent
1a44f48fad
commit
044c6168c9
14 changed files with 8 additions and 586 deletions
|
@ -178,6 +178,8 @@ func handleUserInfo(tags string, settingRepo repo.ISettingRepo) {
|
|||
if err := settingRepo.Update("SecurityEntrance", common.RandStrAndNum(10)); err != nil {
|
||||
global.LOG.Fatalf("init entrance before start failed, err: %v", err)
|
||||
}
|
||||
sudo := cmd.SudoHandleCmd()
|
||||
_, _ = cmd.Execf("%s sed -i '/CHANGE_USER_INFO=%v/d' /usr/local/bin/1pctl", sudo, global.CONF.System.ChangeUserInfo)
|
||||
return
|
||||
}
|
||||
if strings.Contains(global.CONF.System.ChangeUserInfo, "username") {
|
||||
|
|
|
@ -2,7 +2,7 @@ system:
|
|||
db_file: 1Panel.db
|
||||
base_dir: /opt
|
||||
mode: dev
|
||||
repo_url: https://resource.fit2cloud.com/1panel/package
|
||||
repo_url: https://resource.fit2cloud.com/1panel/package/aliyun
|
||||
app_repo: https://apps-assets.fit2cloud.com
|
||||
is_demo: false
|
||||
port: 9999
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog class="level-up-pro" v-model="open" :close-on-click-modal="false" @close="handleClose">
|
||||
<div style="text-align: center" v-loading="loading">
|
||||
<span class="text-3xl font-medium title">{{ $t('license.levelUpPro') }}</span>
|
||||
<el-row type="flex" justify="center" class="mt-6">
|
||||
<el-col :span="22">
|
||||
<el-upload
|
||||
action="#"
|
||||
:auto-upload="false"
|
||||
ref="uploadRef"
|
||||
class="upload-demo"
|
||||
drag
|
||||
:limit="1"
|
||||
:on-change="fileOnChange"
|
||||
:on-exceed="handleExceed"
|
||||
v-model:file-list="uploaderFiles"
|
||||
>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">
|
||||
{{ $t('license.importHelper') }}
|
||||
</div>
|
||||
</el-upload>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-button
|
||||
type="primary"
|
||||
class="mt-3 w-52"
|
||||
:disabled="loading || uploaderFiles.length == 0"
|
||||
plain
|
||||
@click="submit"
|
||||
>
|
||||
{{ $t('license.power') }}
|
||||
</el-button>
|
||||
<div class="mt-3 mb-5">
|
||||
<el-button text type="primary" @click="toHalo">{{ $t('license.knowMorePro') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import i18n from '@/lang';
|
||||
import { ref } from 'vue';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { UploadFileData } from '@/api/modules/setting';
|
||||
import { GlobalStore } from '@/store';
|
||||
import { UploadFile, UploadFiles, UploadInstance, UploadProps, UploadRawFile, genFileId } from 'element-plus';
|
||||
import { useTheme } from '@/hooks/use-theme';
|
||||
import { getXpackSetting } from '@/utils/xpack';
|
||||
const globalStore = GlobalStore();
|
||||
|
||||
const { switchTheme } = useTheme();
|
||||
const loading = ref(false);
|
||||
const open = ref(false);
|
||||
const uploadRef = ref<UploadInstance>();
|
||||
const uploaderFiles = ref<UploadFiles>([]);
|
||||
|
||||
const handleClose = () => {
|
||||
open.value = false;
|
||||
uploadRef.value!.clearFiles();
|
||||
};
|
||||
|
||||
const fileOnChange = (_uploadFile: UploadFile, uploadFiles: UploadFiles) => {
|
||||
uploaderFiles.value = uploadFiles;
|
||||
};
|
||||
|
||||
const handleExceed: UploadProps['onExceed'] = (files) => {
|
||||
uploadRef.value!.clearFiles();
|
||||
const file = files[0] as UploadRawFile;
|
||||
file.uid = genFileId();
|
||||
uploadRef.value!.handleStart(file);
|
||||
};
|
||||
|
||||
const toHalo = () => {
|
||||
window.open('https://www.lxware.cn/1panel' + '', '_blank', 'noopener,noreferrer');
|
||||
};
|
||||
|
||||
const submit = async () => {
|
||||
if (uploaderFiles.value.length !== 1) {
|
||||
return;
|
||||
}
|
||||
const file = uploaderFiles.value[0];
|
||||
const formData = new FormData();
|
||||
formData.append('file', file.raw);
|
||||
loading.value = true;
|
||||
await UploadFileData(formData)
|
||||
.then(async () => {
|
||||
globalStore.isProductPro = true;
|
||||
const xpackRes = await getXpackSetting();
|
||||
if (xpackRes) {
|
||||
globalStore.themeConfig.isGold = xpackRes.data.theme === 'dark-gold';
|
||||
}
|
||||
loading.value = false;
|
||||
switchTheme();
|
||||
uploadRef.value!.clearFiles();
|
||||
uploaderFiles.value = [];
|
||||
open.value = false;
|
||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
uploadRef.value!.clearFiles();
|
||||
uploaderFiles.value = [];
|
||||
});
|
||||
};
|
||||
|
||||
const acceptParams = () => {
|
||||
uploaderFiles.value = [];
|
||||
uploadRef.value?.clearFiles();
|
||||
open.value = true;
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
acceptParams,
|
||||
});
|
||||
</script>
|
|
@ -16,11 +16,6 @@
|
|||
<el-divider v-if="!mobile" direction="vertical" />
|
||||
</div>
|
||||
<div class="flex flex-wrap">
|
||||
<el-button type="primary" link @click="toHalo">
|
||||
<span class="font-normal">
|
||||
{{ isProductPro ? $t('license.pro') : $t('license.community') }}
|
||||
</span>
|
||||
</el-button>
|
||||
<span class="version" @click="copyText(version)">{{ version }}</span>
|
||||
<el-badge is-dot style="margin-top: -3px" v-if="version !== 'Waiting' && globalStore.hasNewVersion">
|
||||
<el-button type="primary" link @click="onLoadUpgradeInfo">
|
||||
|
@ -126,10 +121,6 @@ const handleClose = () => {
|
|||
drawerVisible.value = false;
|
||||
};
|
||||
|
||||
const toHalo = () => {
|
||||
window.open('https://www.lxware.cn/1panel' + '', '_blank', 'noopener,noreferrer');
|
||||
};
|
||||
|
||||
const toDoc = () => {
|
||||
window.open('https://1panel.cn/docs/', '_blank', 'noopener,noreferrer');
|
||||
};
|
||||
|
|
|
@ -1093,7 +1093,6 @@ const message = {
|
|||
clam: {
|
||||
clam: 'Virus Scan',
|
||||
cron: 'Scheduled scan',
|
||||
cronHelper: 'Professional version supports scheduled scan feature',
|
||||
specErr: 'Execution schedule format error, please check and retry!',
|
||||
disableMsg:
|
||||
'Stopping scheduled execution will prevent this scan task from running automatically. Do you want to continue?',
|
||||
|
@ -1652,49 +1651,6 @@ const message = {
|
|||
compressPassword: 'Compression Password',
|
||||
backupRecoverMessage: 'Please enter the compression or decompression password (leave blank to not set)',
|
||||
},
|
||||
license: {
|
||||
community: 'Community Edition: ',
|
||||
community2: 'Community Edition',
|
||||
pro: 'Professional Edition: ',
|
||||
trial: 'Trial Edition',
|
||||
office: 'Official Edition',
|
||||
trialInfo: 'Version',
|
||||
authorizationId: 'Subscription Authorization ID',
|
||||
authorizedUser: 'Authorized User',
|
||||
expiresAt: 'Expiry Date',
|
||||
productName: 'Product Name',
|
||||
productStatus: 'Product Status',
|
||||
Lost01: 'Lost * 1',
|
||||
Lost02: 'Lost * 2',
|
||||
Lost03: 'Lost',
|
||||
Enable: 'Enabled',
|
||||
Disable: 'Disabled',
|
||||
lostHelper:
|
||||
'The License needs to be periodically synchronized for availability. Please ensure normal external network access. After three losses of connection, the License binding will be released.',
|
||||
quickUpdate: 'Quick Update',
|
||||
import: 'Import',
|
||||
power: 'Authorize',
|
||||
unbind: 'Unbind License',
|
||||
unbindHelper: 'All Pro related Settings will be cleared after unbinding. Do you want to continue? ',
|
||||
importLicense: 'Import License',
|
||||
importHelper: 'Please click or drag the license file here',
|
||||
technicalAdvice: 'Technical Advice',
|
||||
advice: 'Consultation',
|
||||
indefinitePeriod: 'Indefinite Period',
|
||||
levelUpPro: 'Upgrade to Professional Edition',
|
||||
licenseSync: 'License Sync',
|
||||
knowMorePro: 'Learn More',
|
||||
closeAlert: 'The current page can be closed in the panel settings',
|
||||
introduce: 'Feature Introduction',
|
||||
waf: 'Upgrading to the professional version can provide features such as interception map, logs, block records, geographical location blocking, custom rules, custom interception pages, etc.',
|
||||
tamper: 'Upgrading to the professional version can protect websites from unauthorized modifications or tampering.',
|
||||
gpu: 'Upgrading to the professional version can help users visually monitor important parameters of GPU such as workload, temperature, memory usage in real time.',
|
||||
setting:
|
||||
'Upgrading to the professional version allows customization of panel logo, welcome message, and other information.',
|
||||
monitor:
|
||||
'Upgrade to the professional version to view the real-time status of the website, visitor trends, visitor sources, request logs and other information. ',
|
||||
alert: 'Upgrade to the professional version to receive alarm information via SMS and view alarm logs, fully control various key events, and ensure worry-free system operation',
|
||||
},
|
||||
clean: {
|
||||
scan: 'Start Scanning',
|
||||
scanHelper: 'Easily tidy up junk files accumulated during 1Panel runtime',
|
||||
|
|
|
@ -1033,7 +1033,6 @@ const message = {
|
|||
clam: {
|
||||
clam: '病毒掃描',
|
||||
cron: '定時掃描',
|
||||
cronHelper: '專業版支持定時掃描功能',
|
||||
specErr: '執行周期格式錯誤,請檢查後重試!',
|
||||
disableMsg: '停止定時執行會導致該掃描任務不再自動執行。是否繼續?',
|
||||
enableMsg: '啟用定時執行會讓該掃描任務定期自動執行。是否繼續?',
|
||||
|
@ -1305,8 +1304,8 @@ const message = {
|
|||
systemIP: '伺服器地址',
|
||||
proxy: '代理伺服器',
|
||||
proxyHelper: '設置代理伺服器後,將在以下場景中生效:',
|
||||
proxyHelper1: '應用商店的安裝包下載和同步(專業版功能)',
|
||||
proxyHelper2: '系統版本升級及獲取更新說明(專業版功能)',
|
||||
proxyHelper1: '應用商店的安裝包下載和同步',
|
||||
proxyHelper2: '系統版本升級及獲取更新說明',
|
||||
proxyHelper3: '系統許可證的驗證和同步',
|
||||
proxyType: '代理類型',
|
||||
proxyUrl: '代理地址',
|
||||
|
@ -1535,46 +1534,6 @@ const message = {
|
|||
compressPassword: '壓縮密碼',
|
||||
backupRecoverMessage: '請輸入壓縮或解壓縮密碼(留空則不設定)',
|
||||
},
|
||||
license: {
|
||||
community: '社區版:',
|
||||
community2: '社區版',
|
||||
pro: '專業版:',
|
||||
trial: '試用版',
|
||||
office: '正式版',
|
||||
trialInfo: '版本',
|
||||
authorizationId: '訂閱授權 ID',
|
||||
authorizedUser: '被授權方',
|
||||
expiresAt: '到期時間',
|
||||
productName: '產品名稱',
|
||||
productStatus: '產品狀態',
|
||||
Lost01: '失聯 * 1',
|
||||
Lost02: '失聯 * 2',
|
||||
Lost03: '已失聯',
|
||||
Enable: '已啟用',
|
||||
Disable: '未啟用',
|
||||
lostHelper: '許可證需要定時同步是否可用,請保證正常外網訪問,失聯三次後將解除許可證綁定',
|
||||
quickUpdate: '快速更新',
|
||||
import: '導入',
|
||||
power: '授 權',
|
||||
unbind: '解除綁定',
|
||||
unbindHelper: '解除綁定後將清除所有專業版相關設置,是否繼續?',
|
||||
importLicense: '導入許可證',
|
||||
importHelper: '請點擊或拖動許可文件到此處',
|
||||
technicalAdvice: '技術諮詢',
|
||||
advice: '諮詢',
|
||||
indefinitePeriod: '無限期',
|
||||
levelUpPro: '升級專業版',
|
||||
licenseSync: '許可證同步',
|
||||
knowMorePro: '了解更多',
|
||||
closeAlert: '當前頁面可在面板設置中關閉顯示',
|
||||
introduce: '功能介紹',
|
||||
waf: '升級專業版可以獲得攔截地圖、日誌、封鎖記錄、地理位置封禁、自定義規則、自定義攔截頁面等功能。',
|
||||
tamper: '升級專業版可以保護網站免受未經授權的修改或篡改。',
|
||||
gpu: '升級專業版可以幫助用戶實時直觀查看到 GPU 的工作負載、溫度、顯存等重要參數。',
|
||||
setting: '升級專業版可以自定義面板 Logo、歡迎簡介等信息。',
|
||||
monitor: '升級專業版可以查看網站的即時狀態、訪客趨勢、訪客來源、請求日誌等資訊。 ',
|
||||
alert: '陞級專業版可通過簡訊接收告警資訊,並查看告警日誌,全面掌控各類關鍵事件,確保系統運行無憂。',
|
||||
},
|
||||
clean: {
|
||||
scan: '開始掃描',
|
||||
scanHelper: '輕鬆梳理 1Panel 運行期間積累的垃圾文件',
|
||||
|
|
|
@ -1034,7 +1034,6 @@ const message = {
|
|||
clam: {
|
||||
clam: '病毒扫描',
|
||||
cron: '定时扫描',
|
||||
cronHelper: '专业版支持定时扫描功能 ',
|
||||
specErr: '执行周期格式错误,请检查后重试!',
|
||||
disableMsg: '停止定时执行会导致该扫描任务不再自动执行。是否继续?',
|
||||
enableMsg: '启用定时执行会让该扫描任务定期自动执行。是否继续?',
|
||||
|
@ -1307,8 +1306,8 @@ const message = {
|
|||
systemIP: '服务器地址',
|
||||
proxy: '代理服务器',
|
||||
proxyHelper: '设置代理服务器后,将在以下场景中生效:',
|
||||
proxyHelper1: '应用商店的安装包下载和同步(专业版功能)',
|
||||
proxyHelper2: '系统版本升级及获取更新说明(专业版功能)',
|
||||
proxyHelper1: '应用商店的安装包下载和同步',
|
||||
proxyHelper2: '系统版本升级及获取更新说明',
|
||||
proxyHelper3: '系统许可证的验证和同步',
|
||||
proxyType: '代理类型',
|
||||
proxyUrl: '代理地址',
|
||||
|
@ -1537,46 +1536,6 @@ const message = {
|
|||
compressPassword: '压缩密码',
|
||||
backupRecoverMessage: '请输入压缩或解压缩密码(留空则不设置)',
|
||||
},
|
||||
license: {
|
||||
community: '社区版:',
|
||||
community2: '社区版',
|
||||
pro: '专业版:',
|
||||
trial: '试用版',
|
||||
office: '正式版',
|
||||
trialInfo: '版本',
|
||||
authorizationId: '订阅授权 ID',
|
||||
authorizedUser: '被授权方',
|
||||
expiresAt: '到期时间',
|
||||
productName: '产品名称',
|
||||
productStatus: '产品状态',
|
||||
Lost01: '失联 * 1',
|
||||
Lost02: '失联 * 2',
|
||||
Lost03: '已失联',
|
||||
Enable: '已激活',
|
||||
Disable: '未激活',
|
||||
lostHelper: '许可证需要定时同步是否可用,请保证正常外网访问,失联三次后将解除许可证绑定',
|
||||
quickUpdate: '快速更新',
|
||||
import: '导入',
|
||||
power: '授 权',
|
||||
unbind: '解除绑定',
|
||||
unbindHelper: '解除绑定后将清除所有专业版相关设置,是否继续?',
|
||||
importLicense: '导入许可证',
|
||||
importHelper: '请点击或拖动许可文件到此处',
|
||||
technicalAdvice: '技术咨询',
|
||||
advice: '咨询',
|
||||
indefinitePeriod: '无限期',
|
||||
levelUpPro: '升级专业版',
|
||||
licenseSync: '许可证同步',
|
||||
knowMorePro: '了解更多',
|
||||
closeAlert: '当前页面可在面板设置中关闭显示',
|
||||
introduce: '功能介绍',
|
||||
waf: '升级专业版可以获得拦截地图、日志、封锁记录、地理位置封禁、自定义规则、自定义拦截页面等功能。',
|
||||
tamper: '升级专业版可以保护网站免受未经授权的修改或篡改。',
|
||||
gpu: '升级专业版可以帮助用户实时直观查看到 GPU 的工作负载、温度、显存等重要参数。',
|
||||
setting: '升级专业版可以自定义面板 Logo、欢迎简介等信息。',
|
||||
monitor: '升级专业版可以查看网站的实时状态、访客趋势、访客来源、请求日志等信息。',
|
||||
alert: '升级专业版可通过短信接收告警信息,并查看告警日志,全面掌控各类关键事件,确保系统运行无忧。',
|
||||
},
|
||||
clean: {
|
||||
scan: '开始扫描',
|
||||
scanHelper: '轻松梳理 1Panel 运行期间积累的垃圾文件',
|
||||
|
|
|
@ -37,16 +37,6 @@ const settingRouter = {
|
|||
activeMenu: 'Setting',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'license',
|
||||
name: 'License',
|
||||
component: () => import('@/views/setting/license/index.vue'),
|
||||
hidden: true,
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
activeMenu: 'Setting',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'about',
|
||||
name: 'About',
|
||||
|
|
|
@ -7,17 +7,7 @@
|
|||
path: '/',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<template #route-button>
|
||||
<div class="router-button">
|
||||
<template v-if="!isProductPro">
|
||||
<el-button link type="primary" @click="toUpload">
|
||||
{{ $t('license.levelUpPro') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</RouterButton>
|
||||
/>
|
||||
|
||||
<el-alert
|
||||
v-if="!isSafety && globalStore.showEntranceWarn"
|
||||
|
@ -259,8 +249,6 @@
|
|||
</CardWithHeader>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<LicenseImport ref="licenseRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -269,7 +257,6 @@ import { onMounted, onBeforeUnmount, ref, reactive } from 'vue';
|
|||
import Status from '@/views/home/status/index.vue';
|
||||
import App from '@/views/home/app/index.vue';
|
||||
import VCharts from '@/components/v-charts/index.vue';
|
||||
import LicenseImport from '@/components/license-import/index.vue';
|
||||
import CardWithHeader from '@/components/card-with-header/index.vue';
|
||||
import i18n from '@/lang';
|
||||
import { Dashboard } from '@/api/interface/dashboard';
|
||||
|
@ -303,9 +290,6 @@ const timeNetDatas = ref<Array<string>>([]);
|
|||
const ioOptions = ref();
|
||||
const netOptions = ref();
|
||||
|
||||
const licenseRef = ref();
|
||||
const isProductPro = ref();
|
||||
|
||||
const searchInfo = reactive({
|
||||
ioOption: 'all',
|
||||
netOption: 'all',
|
||||
|
@ -659,12 +643,7 @@ const onBlur = () => {
|
|||
isActive.value = false;
|
||||
};
|
||||
|
||||
const toUpload = () => {
|
||||
licenseRef.value.acceptParams();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
isProductPro.value = globalStore.isProductPro;
|
||||
window.addEventListener('focus', onFocus);
|
||||
window.addEventListener('blur', onBlur);
|
||||
loadSafeStatus();
|
||||
|
|
|
@ -27,10 +27,6 @@ const buttons = [
|
|||
label: i18n.global.t('setting.snapshot'),
|
||||
path: '/settings/snapshot',
|
||||
},
|
||||
{
|
||||
label: i18n.global.t('setting.license'),
|
||||
path: '/settings/license',
|
||||
},
|
||||
{
|
||||
label: i18n.global.t('setting.about'),
|
||||
path: '/settings/about',
|
||||
|
|
|
@ -1,261 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<LayoutContent v-loading="loading" :title="$t('setting.license')" :divider="true">
|
||||
<template #main>
|
||||
<el-row :gutter="20" class="mt-5; mb-10">
|
||||
<el-col :xs="24" :sm="24" :md="15" :lg="15" :xl="15">
|
||||
<div class="descriptions" v-if="hasLicense">
|
||||
<el-descriptions :column="1" direction="horizontal" size="large" border>
|
||||
<el-descriptions-item :label="$t('license.authorizationId')">
|
||||
{{ license.licenseName || '-' }}
|
||||
<el-button
|
||||
type="primary"
|
||||
class="ml-3"
|
||||
plain
|
||||
@click="onSync"
|
||||
size="small"
|
||||
v-if="showSync()"
|
||||
>
|
||||
{{ $t('commons.button.sync') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="!license.offline"
|
||||
type="primary"
|
||||
class="ml-3"
|
||||
plain
|
||||
@click="onUnBind()"
|
||||
size="small"
|
||||
>
|
||||
{{ $t('license.unbind') }}
|
||||
</el-button>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('license.authorizedUser')">
|
||||
{{ license.assigneeName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('license.productName')">
|
||||
{{ license.productName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('license.trialInfo')">
|
||||
{{ license.trial ? $t('license.trial') : $t('license.office') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('license.expiresAt')">
|
||||
{{ license.expiresAt || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('license.productStatus')">
|
||||
<div v-if="license.status">
|
||||
<el-tooltip
|
||||
v-if="license.status.indexOf('Lost') !== -1"
|
||||
:content="$t('license.lostHelper')"
|
||||
>
|
||||
<el-tag type="info">
|
||||
{{ $t('license.' + license.status) }}
|
||||
</el-tag>
|
||||
</el-tooltip>
|
||||
<el-tag v-else>{{ $t('license.' + license.status) }}</el-tag>
|
||||
</div>
|
||||
<span v-else>-</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item class="descriptions" :label="$t('commons.table.message')">
|
||||
{{ license.message }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
|
||||
<CardWithHeader :header="$t('home.overview')" height="160px" v-if="!hasLicense">
|
||||
<template #body>
|
||||
<div class="h-app-card">
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<span>{{ $t('setting.license') }}</span>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span>{{ $t('license.community2') }}</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
</CardWithHeader>
|
||||
</el-col>
|
||||
|
||||
<el-col :xs="24" :sm="24" :md="9" :lg="9" :xl="9">
|
||||
<CardWithHeader :header="$t('license.quickUpdate')" height="160px">
|
||||
<template #body>
|
||||
<div class="h-app-card">
|
||||
<el-row>
|
||||
<el-col :span="15">
|
||||
<div class="h-app-content">{{ $t('license.importLicense') }}:</div>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-button type="primary" plain round size="small" @click="toUpload">
|
||||
{{ $t('license.import') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="h-app-card">
|
||||
<el-row>
|
||||
<el-col :span="15">
|
||||
<div class="h-app-content">{{ $t('license.technicalAdvice') }}:</div>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-button type="primary" plain round size="small" @click="toHalo()">
|
||||
{{ $t('license.advice') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
</CardWithHeader>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</LayoutContent>
|
||||
|
||||
<LicenseImport ref="licenseRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { getLicense, syncLicense, unbindLicense } from '@/api/modules/setting';
|
||||
import CardWithHeader from '@/components/card-with-header/index.vue';
|
||||
import LicenseImport from '@/components/license-import/index.vue';
|
||||
import i18n from '@/lang';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { GlobalStore } from '@/store';
|
||||
const loading = ref();
|
||||
const licenseRef = ref();
|
||||
const globalStore = GlobalStore();
|
||||
const hasLicense = ref();
|
||||
|
||||
const license = reactive({
|
||||
licenseName: '',
|
||||
trial: true,
|
||||
offline: true,
|
||||
expiresAt: '',
|
||||
assigneeName: '',
|
||||
productName: '',
|
||||
|
||||
status: '',
|
||||
message: '',
|
||||
});
|
||||
|
||||
const toHalo = () => {
|
||||
window.open('https://www.lxware.cn/1panel' + '', '_blank', 'noopener,noreferrer');
|
||||
};
|
||||
|
||||
const onSync = async () => {
|
||||
loading.value = true;
|
||||
await syncLicense()
|
||||
.then(() => {
|
||||
loading.value = false;
|
||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const onUnBind = async () => {
|
||||
ElMessageBox.confirm(i18n.global.t('license.unbindHelper'), i18n.global.t('license.unbind'), {
|
||||
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
||||
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
||||
type: 'info',
|
||||
}).then(async () => {
|
||||
loading.value = true;
|
||||
await unbindLicense()
|
||||
.then(() => {
|
||||
loading.value = false;
|
||||
globalStore.isProductPro = false;
|
||||
globalStore.themeConfig.isGold = false;
|
||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const timestampToDate = (timestamp: number) => {
|
||||
const date = new Date(timestamp * 1000);
|
||||
const y = date.getFullYear();
|
||||
let m: string | number = date.getMonth() + 1;
|
||||
m = m < 10 ? `0${String(m)}` : m;
|
||||
let d: string | number = date.getDate();
|
||||
d = d < 10 ? `0${String(d)}` : d;
|
||||
let h: string | number = date.getHours();
|
||||
h = h < 10 ? `0${String(h)}` : h;
|
||||
let minute: string | number = date.getMinutes();
|
||||
minute = minute < 10 ? `0${String(minute)}` : minute;
|
||||
let second: string | number = date.getSeconds();
|
||||
second = second < 10 ? `0${String(second)}` : second;
|
||||
return `${y}-${m}-${d} ${h}:${minute}:${second}`;
|
||||
};
|
||||
|
||||
const search = async () => {
|
||||
loading.value = true;
|
||||
await getLicense()
|
||||
.then((res) => {
|
||||
loading.value = false;
|
||||
license.status = res.data.status;
|
||||
globalStore.isProductPro =
|
||||
res.data.status === 'Enable' || res.data.status === 'Lost01' || res.data.status === 'Lost02';
|
||||
if (res.data.status === '') {
|
||||
hasLicense.value = false;
|
||||
return;
|
||||
}
|
||||
hasLicense.value = true;
|
||||
if (globalStore.isProductPro) {
|
||||
globalStore.productProExpires = Number(res.data.productPro);
|
||||
globalStore.isTrial = res.data.trial;
|
||||
}
|
||||
license.licenseName = res.data.licenseName;
|
||||
license.message = res.data.message;
|
||||
license.assigneeName = res.data.assigneeName;
|
||||
license.trial = res.data.trial;
|
||||
license.offline = res.data.offline;
|
||||
if (res.data.productPro) {
|
||||
license.productName = 'product-1panel-pro';
|
||||
license.expiresAt =
|
||||
res.data.productPro === '0'
|
||||
? i18n.global.t('license.indefinitePeriod')
|
||||
: timestampToDate(Number(res.data.productPro));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const showSync = () => {
|
||||
return (license.status.indexOf('Lost') !== -1 || license.status === 'Disable') && !license.offline;
|
||||
};
|
||||
|
||||
const toUpload = () => {
|
||||
licenseRef.value.acceptParams();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
search();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.h-app-card {
|
||||
padding: 10px 15px;
|
||||
margin-right: 10px;
|
||||
line-height: 18px;
|
||||
&:hover {
|
||||
background-color: rgba(0, 94, 235, 0.03);
|
||||
}
|
||||
}
|
||||
:deep(.el-descriptions__content) {
|
||||
max-width: 300px;
|
||||
}
|
||||
.descriptions {
|
||||
word-break: break-all;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
</style>
|
|
@ -126,21 +126,6 @@
|
|||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('setting.developerMode')" prop="developerMode">
|
||||
<el-radio-group
|
||||
@change="onSave('DeveloperMode', form.developerMode)"
|
||||
v-model="form.developerMode"
|
||||
>
|
||||
<el-radio-button value="enable">
|
||||
<span>{{ $t('commons.button.enable') }}</span>
|
||||
</el-radio-button>
|
||||
<el-radio-button value="disable">
|
||||
<span>{{ $t('commons.button.disable') }}</span>
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
<span class="input-help">{{ $t('setting.developerModeHelper') }}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('setting.advancedMenuHide')">
|
||||
<el-input disabled v-model="form.proHideMenus">
|
||||
<template #append>
|
||||
|
@ -266,7 +251,6 @@ const search = async () => {
|
|||
form.defaultNetworkVal = res.data.defaultNetwork === 'all' ? i18n.t('commons.table.all') : res.data.defaultNetwork;
|
||||
form.proHideMenus = res.data.xpackHideMenu;
|
||||
form.hideMenuList = res.data.xpackHideMenu;
|
||||
form.developerMode = res.data.developerMode;
|
||||
|
||||
form.proxyUrl = res.data.proxyUrl;
|
||||
form.proxyType = res.data.proxyType;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
<ul style="margin-left: -20px">
|
||||
<li v-if="isProductPro">{{ $t('setting.proxyHelper1') }}</li>
|
||||
<li v-if="isProductPro">{{ $t('setting.proxyHelper2') }}</li>
|
||||
<li>{{ $t('setting.proxyHelper3') }}</li>
|
||||
</ul>
|
||||
</template>
|
||||
</el-alert>
|
||||
|
|
|
@ -53,12 +53,6 @@
|
|||
<el-form-item prop="hasSpec">
|
||||
<el-checkbox v-model="dialogData.rowData!.hasSpec" :label="$t('toolbox.clam.cron')" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="dialogData.rowData!.hasSpec && !isProductPro">
|
||||
<span>{{ $t('toolbox.clam.cronHelper') }}</span>
|
||||
<el-button link type="primary" @click="toUpload">
|
||||
{{ $t('license.levelUpPro') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item prop="spec" v-if="dialogData.rowData!.hasSpec && isProductPro">
|
||||
<el-select
|
||||
class="specTypeClass"
|
||||
|
@ -135,7 +129,6 @@
|
|||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
<LicenseImport ref="licenseRef" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
|
@ -145,7 +138,6 @@ import { Rules } from '@/global/form-rules';
|
|||
import FileList from '@/components/file-list/index.vue';
|
||||
import i18n from '@/lang';
|
||||
import { ElForm } from 'element-plus';
|
||||
import LicenseImport from '@/components/license-import/index.vue';
|
||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||
import { MsgError, MsgSuccess } from '@/utils/message';
|
||||
import { Toolbox } from '@/api/interface/toolbox';
|
||||
|
@ -155,7 +147,6 @@ import { storeToRefs } from 'pinia';
|
|||
import { GlobalStore } from '@/store';
|
||||
|
||||
const globalStore = GlobalStore();
|
||||
const licenseRef = ref();
|
||||
const { isProductPro } = storeToRefs(globalStore);
|
||||
interface DialogProps {
|
||||
title: string;
|
||||
|
@ -307,10 +298,6 @@ const hasHour = (item: any) => {
|
|||
return item.specType !== 'perHour' && item.specType !== 'perNMinute' && item.specType !== 'perNSecond';
|
||||
};
|
||||
|
||||
const toUpload = () => {
|
||||
licenseRef.value.acceptParams();
|
||||
};
|
||||
|
||||
const changeSpecType = () => {
|
||||
let item = dialogData.value.rowData!.specObj;
|
||||
switch (item.specType) {
|
||||
|
|
Loading…
Reference in a new issue