refactor: license
This commit is contained in:
parent
a08dd98ffb
commit
dca1df59fc
24
ui/src/api/system/license.ts
Normal file
24
ui/src/api/system/license.ts
Normal 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
|
||||
}
|
||||
@ -16,12 +16,13 @@
|
||||
</div>
|
||||
<div class="flex">
|
||||
<span class="label">{{ $t('layout.about.expiredTime') }}</span>
|
||||
<!-- <span
|
||||
>{{ licenseInfo?.expired || '-' }}
|
||||
<span class="color-danger" v-if="licenseInfo?.expired && fromNowDate(licenseInfo?.expired)"
|
||||
>({{ fromNowDate(licenseInfo?.expired) }})</span
|
||||
></span
|
||||
> -->
|
||||
<!-- <span-->
|
||||
<!-- >{{ licenseInfo?.expired || '-' }}-->
|
||||
<!-- <span class="color-danger"-->
|
||||
<!-- v-if="licenseInfo?.expired && fromNowDate(licenseInfo?.expired)"-->
|
||||
<!-- >({{ fromNowDate(licenseInfo?.expired) }})</span-->
|
||||
<!-- ></span-->
|
||||
<!-- >-->
|
||||
</div>
|
||||
<div class="flex">
|
||||
<span class="label">{{ $t('layout.about.edition.label') }}</span>
|
||||
@ -53,7 +54,8 @@
|
||||
v-hasPermission="new Role('ADMIN')"
|
||||
>
|
||||
<el-button class="border-primary mr-16"
|
||||
>{{ $t('layout.about.update') }} License</el-button
|
||||
>{{ $t('layout.about.update') }} License
|
||||
</el-button
|
||||
>
|
||||
</el-upload>
|
||||
</div>
|
||||
@ -65,10 +67,11 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {ref, computed, watch} from 'vue'
|
||||
// import licenseApi from '@/api/license'
|
||||
import licenseApi from '@/api/system/license'
|
||||
//import {fromNowDate} from '@/utils/time'
|
||||
import {Role} from '@/utils/permission/type'
|
||||
import useStore from '@/stores'
|
||||
|
||||
const {user, theme} = useStore()
|
||||
const isDefaultTheme = computed(() => {
|
||||
return theme.isDefaultTheme()
|
||||
@ -98,15 +101,16 @@ const open = () => {
|
||||
const onChange = (file: any) => {
|
||||
const fd = new FormData()
|
||||
fd.append('license_file', file.raw)
|
||||
// licenseApi.putLicense(fd, loading).then((res: any) => {
|
||||
// getLicenseInfo()
|
||||
// isUpdate.value = true
|
||||
// })
|
||||
licenseApi.putLicense(fd, loading).then((res: any) => {
|
||||
getLicenseInfo()
|
||||
isUpdate.value = true
|
||||
})
|
||||
}
|
||||
|
||||
function getLicenseInfo() {
|
||||
// licenseApi.getLicense(loading).then((res: any) => {
|
||||
// licenseInfo.value = res.data?.license
|
||||
// })
|
||||
licenseApi.getLicense(loading).then((res: any) => {
|
||||
licenseInfo.value = res.data?.license
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({open})
|
||||
@ -116,20 +120,24 @@ defineExpose({ open })
|
||||
padding: 0 0 24px 0;
|
||||
width: 620px;
|
||||
font-weight: 400;
|
||||
|
||||
.el-dialog__header {
|
||||
background: var(--app-header-bg-color);
|
||||
margin-right: 0;
|
||||
height: 140px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px 4px 0 0;
|
||||
|
||||
&.show-close {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.el-dialog__title {
|
||||
height: 140px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.about-ui {
|
||||
margin: 0 auto;
|
||||
font-weight: 400;
|
||||
@ -144,6 +152,7 @@ defineExpose({ open })
|
||||
color: var(--app-text-color-secondary);
|
||||
}
|
||||
}
|
||||
|
||||
&.dialog-custom-header {
|
||||
.el-dialog__header {
|
||||
background: var(--el-color-primary-light-9) !important;
|
||||
|
||||
@ -88,8 +88,8 @@
|
||||
</el-dropdown>
|
||||
<APIKeyDialog :user-id="user.userInfo?.id" ref="APIKeyDialogRef"/>
|
||||
<ResetPassword ref="resetPasswordRef"></ResetPassword>
|
||||
<!-- <AboutDialog ref="AboutDialogRef"></AboutDialog>
|
||||
-->
|
||||
<AboutDialog ref="AboutDialogRef"></AboutDialog>
|
||||
|
||||
<!-- <UserPwdDialog ref="UserPwdDialogRef" /> -->
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@ -97,7 +97,7 @@ import { ref, onMounted } from 'vue'
|
||||
import useStore from '@/stores'
|
||||
import {useRouter} from 'vue-router'
|
||||
import ResetPassword from './ResetPassword.vue'
|
||||
// import AboutDialog from './AboutDialog.vue'
|
||||
import AboutDialog from './AboutDialog.vue'
|
||||
// import UserPwdDialog from '@/views/user-manage/component/UserPwdDialog.vue'
|
||||
import APIKeyDialog from './APIKeyDialog.vue'
|
||||
import {ComplexPermission} from '@/utils/permission/type'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user