Skip to content

Commit fd73ede

Browse files
committed
refactor: license ui
1 parent 5237f8b commit fd73ede

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

ui/src/layout/layout-header/avatar/AboutDialog.vue

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,18 @@
1616
</div>
1717
<div class="flex">
1818
<span class="label">{{ $t('layout.about.expiredTime') }}</span>
19-
<!-- <span-->
20-
<!-- >{{ licenseInfo?.expired || '-' }}-->
19+
<span
20+
>{{ licenseInfo?.expired || '-' }}
2121
<!-- <span class="color-danger"-->
2222
<!-- v-if="licenseInfo?.expired && fromNowDate(licenseInfo?.expired)"-->
23-
<!-- >({{ fromNowDate(licenseInfo?.expired) }})</span-->
24-
<!-- ></span-->
25-
<!-- >-->
23+
<!-- >({{ fromNowDate(licenseInfo?.expired) }})</span>-->
24+
</span
25+
>
2626
</div>
2727
<div class="flex">
2828
<span class="label">{{ $t('layout.about.edition.label') }}</span>
2929
<span>{{
30-
user.showXpack()
31-
? $t('layout.about.edition.professional')
32-
: $t('layout.about.edition.community')
30+
editionText
3331
}}</span>
3432
</div>
3533
<div class="flex">
@@ -71,7 +69,7 @@ import licenseApi from '@/api/system/license'
7169
//import {fromNowDate} from '@/utils/time'
7270
import {Role} from '@/utils/permission/type'
7371
import useStore from '@/stores'
74-
72+
import { t } from '@/locales'
7573
const {user, theme} = useStore()
7674
const isDefaultTheme = computed(() => {
7775
return theme.isDefaultTheme()
@@ -98,6 +96,7 @@ const open = () => {
9896
aboutDialogVisible.value = true
9997
}
10098
99+
101100
const onChange = (file: any) => {
102101
const fd = new FormData()
103102
fd.append('license_file', file.raw)
@@ -107,9 +106,20 @@ const onChange = (file: any) => {
107106
})
108107
}
109108
109+
const editionText = computed(() => {
110+
if (!user) return '-'
111+
if (user.isPE()) {
112+
return t('layout.about.edition.professional')
113+
} else if (user.isEE()) {
114+
return t('layout.about.edition.enterprise')
115+
} else {
116+
return t('layout.about.edition.community')
117+
}
118+
})
110119
function getLicenseInfo() {
111120
licenseApi.getLicense(loading).then((res: any) => {
112121
licenseInfo.value = res.data?.license
122+
console.log(licenseInfo.value)
113123
})
114124
}
115125

ui/src/locales/lang/en-US/layout.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ export default {
1313
edition: {
1414
label: 'Edition',
1515
community: 'Community Edition',
16-
professional: 'Professional Edition'
16+
professional: 'Professional Edition',
17+
enterprise: 'Enterprise Edition',
1718
},
1819
version: 'Version',
1920
serialNo: 'Serial No.',
2021
remark: 'Remarks',
2122
update: 'Update',
2223
authorize: 'Authorized',
23-
24+
2425
},
2526
time: {
2627
daysLater: 'days later',

ui/src/locales/lang/zh-CN/layout.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export default {
1313
edition: {
1414
label: '版本',
1515
community: '社区版',
16-
professional: '专业版'
16+
professional: '专业版',
17+
enterprise: '企业版',
1718
},
1819
version: '版本号',
1920
serialNo: '序列号',

ui/src/locales/lang/zh-Hant/layout.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export default {
1414
edition: {
1515
label: '版本',
1616
community: '社群版',
17-
professional: '專業版'
17+
professional: '專業版',
18+
enterprise: '企業版'
1819
},
1920
version: '版本號',
2021
serialNo: '序列號',

0 commit comments

Comments
 (0)