UnisKB/ui/src/layout/components/top-bar/avatar/AboutDialog.vue

137 lines
3.6 KiB
Vue
Raw Normal View History

2023-12-18 03:11:13 +00:00
<template>
2024-07-15 10:08:02 +00:00
<el-dialog
v-model="aboutDialogVisible"
class="about-dialog border-r-4"
:class="!isDefaultTheme ? 'custom-header' : ''"
>
2023-12-18 03:11:13 +00:00
<template #header="{ titleId, titleClass }">
2024-07-01 01:45:59 +00:00
<div class="logo flex-center" :id="titleId" :class="titleClass">
2024-07-15 10:08:02 +00:00
<LogoFull height="59px" />
2023-12-18 03:11:13 +00:00
</div>
</template>
2024-07-17 07:24:53 +00:00
<div class="about-ui" v-loading="loading">
<div class="flex">
<span class="label">授权给</span><span>{{ licenseInfo?.corporation || '-' }}</span>
</div>
<div class="flex">
<span class="label">ISV</span><span>{{ licenseInfo?.isv || '-' }}</span>
</div>
<div class="flex">
2024-07-18 10:13:38 +00:00
<span class="label">到期时间</span>
2024-07-17 08:13:33 +00:00
<span
>{{ licenseInfo?.expired || '-' }}
2024-07-18 08:17:55 +00:00
<span class="danger" v-if="licenseInfo?.expired && fromNowDate(licenseInfo?.expired)"
2024-07-17 08:13:33 +00:00
>{{ fromNowDate(licenseInfo?.expired) }}</span
></span
>
2024-07-17 07:24:53 +00:00
</div>
<div class="flex">
2024-07-18 10:26:41 +00:00
<span class="label">版本</span><span>{{ user.isXPack ? '专业版' : '社区版' }}</span>
2024-07-17 07:24:53 +00:00
</div>
<div class="flex">
2024-07-18 08:17:55 +00:00
<span class="label">版本号</span
><span>{{ licenseInfo?.licenseVersion || user.version }}</span>
2024-07-17 07:24:53 +00:00
</div>
<div class="flex">
<span class="label">序列号</span><span>{{ licenseInfo?.serialNo || '-' }}</span>
</div>
<div class="flex">
<span class="label">备注</span><span>{{ licenseInfo?.remark || '-' }}</span>
</div>
2024-07-18 10:13:38 +00:00
<div class="mt-16 flex align-center" v-if="user.isXPack">
2024-07-17 07:24:53 +00:00
<el-upload
ref="uploadRef"
action="#"
:auto-upload="false"
:show-file-list="false"
:on-change="onChange"
>
<el-button class="border-primary">更新 License</el-button>
</el-upload>
<el-button class="border-primary ml-16" @click="toSupport"></el-button>
</div>
2024-03-21 07:52:10 +00:00
</div>
2023-12-18 03:11:13 +00:00
</el-dialog>
</template>
<script setup lang="ts">
2024-07-15 10:08:02 +00:00
import { ref, computed } from 'vue'
2024-07-17 07:24:53 +00:00
import licenseApi from '@/api/license'
2024-07-17 08:13:33 +00:00
import { fromNowDate } from '@/utils/time'
2024-03-21 08:33:13 +00:00
import useStore from '@/stores'
2024-07-16 09:32:27 +00:00
const { user } = useStore()
2024-07-15 10:08:02 +00:00
const isDefaultTheme = computed(() => {
2024-07-16 09:32:27 +00:00
return user.isDefaultTheme()
2024-07-15 10:08:02 +00:00
})
2024-03-21 08:33:13 +00:00
2023-12-18 03:11:13 +00:00
const aboutDialogVisible = ref(false)
2024-07-17 07:24:53 +00:00
const loading = ref(false)
const licenseInfo = ref<any>(null)
2023-12-18 03:11:13 +00:00
const open = () => {
2024-07-18 10:13:38 +00:00
if (user.isXPack) {
2024-07-18 08:17:55 +00:00
getLicenseInfo()
}
2023-12-18 03:11:13 +00:00
aboutDialogVisible.value = true
}
2024-07-17 07:24:53 +00:00
const onChange = (file: any) => {
let fd = new FormData()
fd.append('license_file', file.raw)
licenseApi.putLicense(fd, loading).then((res: any) => {
getLicenseInfo()
})
}
function getLicenseInfo() {
licenseApi.getLicense(loading).then((res: any) => {
licenseInfo.value = res.data?.license
})
}
function toSupport() {
const url = 'https://support.fit2cloud.com/'
2024-03-21 07:52:10 +00:00
window.open(url, '_blank')
}
2023-12-18 03:11:13 +00:00
defineExpose({ open })
</script>
<style lang="scss" scope>
.about-dialog {
2024-03-21 10:01:04 +00:00
padding: 0 0 24px 0;
2024-02-23 10:28:21 +00:00
width: 600px;
2024-03-21 10:01:04 +00:00
font-weight: 400;
2023-12-18 03:11:13 +00:00
.el-dialog__header {
background: var(--app-header-bg-color);
margin-right: 0;
2024-02-23 10:28:21 +00:00
height: 140px;
box-sizing: border-box;
2024-07-01 01:45:59 +00:00
border-radius: 4px 4px 0 0;
2024-02-23 10:28:21 +00:00
}
.el-dialog__title {
2024-07-01 01:45:59 +00:00
height: 140px;
box-sizing: border-box;
2023-12-18 03:11:13 +00:00
}
.about-ui {
2024-07-17 07:24:53 +00:00
width: 450px;
2023-12-18 03:11:13 +00:00
margin: 0 auto;
2024-02-23 10:28:21 +00:00
font-weight: 400;
2024-07-17 07:24:53 +00:00
font-size: 14px;
2024-03-21 10:01:04 +00:00
margin-top: 24px;
2024-07-17 07:24:53 +00:00
line-height: 36px;
2024-02-23 10:28:21 +00:00
.label {
2024-07-17 07:24:53 +00:00
width: 150px;
2024-02-23 10:28:21 +00:00
text-align: left;
color: var(--app-text-color-secondary);
2023-12-18 03:11:13 +00:00
}
}
2024-07-17 03:16:21 +00:00
&.custom-header {
2024-07-17 07:24:53 +00:00
.el-dialog__header {
background: var(--el-color-primary-light-9) !important;
}
2024-07-15 10:08:02 +00:00
}
}
2023-12-18 03:11:13 +00:00
</style>