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