refactor: license ui

This commit is contained in:
wxg0103 2025-06-19 17:49:47 +08:00
parent 5237f8b5fc
commit fd73ede7c8
4 changed files with 26 additions and 13 deletions

View File

@ -16,20 +16,18 @@
</div> </div>
<div class="flex"> <div class="flex">
<span class="label">{{ $t('layout.about.expiredTime') }}</span> <span class="label">{{ $t('layout.about.expiredTime') }}</span>
<!-- <span--> <span
<!-- >{{ licenseInfo?.expired || '-' }}--> >{{ licenseInfo?.expired || '-' }}
<!-- <span class="color-danger"--> <!-- <span class="color-danger"-->
<!-- v-if="licenseInfo?.expired && fromNowDate(licenseInfo?.expired)"--> <!-- v-if="licenseInfo?.expired && fromNowDate(licenseInfo?.expired)"-->
<!-- >{{ fromNowDate(licenseInfo?.expired) }}</span--> <!-- >{{ fromNowDate(licenseInfo?.expired) }}</span>-->
<!-- ></span--> </span
<!-- >--> >
</div> </div>
<div class="flex"> <div class="flex">
<span class="label">{{ $t('layout.about.edition.label') }}</span> <span class="label">{{ $t('layout.about.edition.label') }}</span>
<span>{{ <span>{{
user.showXpack() editionText
? $t('layout.about.edition.professional')
: $t('layout.about.edition.community')
}}</span> }}</span>
</div> </div>
<div class="flex"> <div class="flex">
@ -71,7 +69,7 @@ import licenseApi from '@/api/system/license'
//import {fromNowDate} from '@/utils/time' //import {fromNowDate} from '@/utils/time'
import {Role} from '@/utils/permission/type' import {Role} from '@/utils/permission/type'
import useStore from '@/stores' import useStore from '@/stores'
import { t } from '@/locales'
const {user, theme} = useStore() const {user, theme} = useStore()
const isDefaultTheme = computed(() => { const isDefaultTheme = computed(() => {
return theme.isDefaultTheme() return theme.isDefaultTheme()
@ -98,6 +96,7 @@ const open = () => {
aboutDialogVisible.value = true aboutDialogVisible.value = true
} }
const onChange = (file: any) => { const onChange = (file: any) => {
const fd = new FormData() const fd = new FormData()
fd.append('license_file', file.raw) fd.append('license_file', file.raw)
@ -107,9 +106,20 @@ const onChange = (file: any) => {
}) })
} }
const editionText = computed(() => {
if (!user) return '-'
if (user.isPE()) {
return t('layout.about.edition.professional')
} else if (user.isEE()) {
return t('layout.about.edition.enterprise')
} else {
return t('layout.about.edition.community')
}
})
function getLicenseInfo() { function getLicenseInfo() {
licenseApi.getLicense(loading).then((res: any) => { licenseApi.getLicense(loading).then((res: any) => {
licenseInfo.value = res.data?.license licenseInfo.value = res.data?.license
console.log(licenseInfo.value)
}) })
} }

View File

@ -13,14 +13,15 @@ export default {
edition: { edition: {
label: 'Edition', label: 'Edition',
community: 'Community Edition', community: 'Community Edition',
professional: 'Professional Edition' professional: 'Professional Edition',
enterprise: 'Enterprise Edition',
}, },
version: 'Version', version: 'Version',
serialNo: 'Serial No.', serialNo: 'Serial No.',
remark: 'Remarks', remark: 'Remarks',
update: 'Update', update: 'Update',
authorize: 'Authorized', authorize: 'Authorized',
}, },
time: { time: {
daysLater: 'days later', daysLater: 'days later',

View File

@ -13,7 +13,8 @@ export default {
edition: { edition: {
label: '版本', label: '版本',
community: '社区版', community: '社区版',
professional: '专业版' professional: '专业版',
enterprise: '企业版',
}, },
version: '版本号', version: '版本号',
serialNo: '序列号', serialNo: '序列号',

View File

@ -14,7 +14,8 @@ export default {
edition: { edition: {
label: '版本', label: '版本',
community: '社群版', community: '社群版',
professional: '專業版' professional: '專業版',
enterprise: '企業版'
}, },
version: '版本號', version: '版本號',
serialNo: '序列號', serialNo: '序列號',