feat: 关于页面更新

This commit is contained in:
wangdan-fit2cloud 2024-07-17 15:24:53 +08:00
parent 958c815ec2
commit 7c3f8884be
6 changed files with 197 additions and 121 deletions

24
ui/src/api/license.ts Normal file
View File

@ -0,0 +1,24 @@
import { Result } from '@/request/Result'
import { get, post, del, put } from '@/request/index'
import { type Ref } from 'vue'
const prefix = '/license'
/**
* license信息
*/
const getLicense: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
return get(`${prefix}/profile`, undefined, loading)
}
/**
* license信息
* @param license_file:file
*/
const putLicense: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (data, loading) => {
return put(`${prefix}/profile`, data, undefined, loading)
}
export default {
getLicense,
putLicense
}

View File

@ -14,3 +14,8 @@ export enum ValidCount {
Dataset = 50,
User = 2
}
export enum EditionType {
Standard = '社区版',
Enterprise = '专业版'
}

View File

@ -9,31 +9,55 @@
<LogoFull height="59px" />
</div>
</template>
<div class="about-ui">
<el-card shadow="hover" class="mb-16" @click="toUrl('https://maxkb.cn/docs/')">
<div class="flex align-center cursor">
<AppIcon iconName="app-reading" class="mr-16 ml-8" style="font-size: 24px"></AppIcon>
<span>{{ $t('layout.topbar.wiki') }}</span>
<div class="about-ui" v-loading="loading">
<div class="flex">
<span class="label">授权给</span><span>{{ licenseInfo?.corporation || '-' }}</span>
</div>
</el-card>
<el-card shadow="hover" class="mb-16" @click="toUrl('https://github.com/1Panel-dev/MaxKB')">
<div class="flex align-center cursor">
<AppIcon iconName="app-github" class="mr-16 ml-8" style="font-size: 24px"></AppIcon>
<span>{{ $t('layout.topbar.github') }}</span>
<div class="flex">
<span class="label">ISV</span><span>{{ licenseInfo?.isv || '-' }}</span>
</div>
</el-card>
<el-card shadow="hover" class="mb-16" @click="toUrl('https://bbs.fit2cloud.com/c/mk/11')">
<div class="flex align-center cursor">
<AppIcon iconName="app-help" class="mr-16 ml-8" style="font-size: 24px"></AppIcon>
<span>{{ $t('layout.topbar.forum') }}</span>
<div class="flex">
<span class="label">过期时间</span><span>{{ licenseInfo?.expired || '-' }}</span>
</div>
</el-card>
<div class="flex">
<span class="label">版本</span
><span>{{
licenseInfo?.edition ? EditionType[licenseInfo.edition as keyof typeof EditionType] : '-'
}}</span>
</div>
<div class="text-center">{{ $t('layout.topbar.avatar.version') }}:{{ user.version }}</div>
<div class="flex">
<span class="label">版本号</span><span>{{ licenseInfo?.licenseVersion || '-' }}</span>
</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>
<div class="mt-16 flex align-center" v-hasPermission="new Role('ADMIN')">
<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>
</div>
<!-- <div class="text-center">{{ $t('layout.topbar.avatar.version') }}:{{ user.version }}</div> -->
</el-dialog>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import licenseApi from '@/api/license'
import { EditionType } from '@/enums/common'
import { Role } from '@/utils/permission/type'
import useStore from '@/stores'
const { user } = useStore()
const isDefaultTheme = computed(() => {
@ -41,12 +65,29 @@ const isDefaultTheme = computed(() => {
})
const aboutDialogVisible = ref(false)
const loading = ref(false)
const licenseInfo = ref<any>(null)
const open = () => {
getLicenseInfo()
aboutDialogVisible.value = true
}
function toUrl(url: string) {
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/'
window.open(url, '_blank')
}
@ -69,13 +110,15 @@ defineExpose({ open })
box-sizing: border-box;
}
.about-ui {
width: 360px;
width: 450px;
margin: 0 auto;
font-weight: 400;
font-size: 16px;
font-size: 14px;
margin-top: 24px;
line-height: 36px;
.label {
width: 180px;
width: 150px;
text-align: left;
color: var(--app-text-color-secondary);
}
@ -86,6 +129,4 @@ defineExpose({ open })
}
}
}
</style>

View File

@ -12,7 +12,7 @@ export default {
MenuItem: {
application: "应用",
dataset: "知识库",
setting: "系统设置"
setting: "系统管理"
},
avatar: {
resetPassword: "修改密码",

View File

@ -299,6 +299,10 @@ h5 {
.border-t-dashed {
border-top: 1px dashed var(--el-border-color);
}
.border-primary {
border: 1px solid var(--el-color-primary);
color: var(--el-color-primary);
}
.cursor {
cursor: pointer;

View File

@ -22,6 +22,7 @@
<h5 class="mb-16">页面预览</h5>
<el-button type="primary" link @click="resetForm"> 恢复默认 </el-button>
</div>
<el-scrollbar>
<div class="theme-preview">
<el-row :gutter="8">
<el-col :span="16">
@ -107,7 +108,8 @@
<el-text type="info"> 显示在网页 Tab 的平台名称 </el-text>
</el-form-item>
<el-form-item label="欢迎语" prop="slogan">
<el-input v-model="themeForm.slogan" placeholder="请输入欢迎语"> </el-input>
<el-input v-model="themeForm.slogan" placeholder="请输入欢迎语">
</el-input>
<el-text type="info"> 产品 Logo 下的 欢迎语 </el-text>
</el-form-item>
</el-form>
@ -115,7 +117,7 @@
>
</el-row>
</div>
</el-scrollbar>
<div class="mt-16">
<el-text type="info">默认为 MaxKB 登录界面支持自定义设置</el-text>
</div>