mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-15 14:24:39 +00:00
perf(licenseExpired): 优化license过期提醒
This commit is contained in:
@@ -722,7 +722,10 @@
|
||||
"userGuideUrl": "用户向导URL",
|
||||
"username": "用户名",
|
||||
"usernamePlaceholder": "请输入用户名",
|
||||
"refreshLdapCache":"刷新Ldap缓存,请稍后"
|
||||
"refreshLdapCache":"刷新Ldap缓存,请稍后",
|
||||
"LicenseExpired": "许可证已经过期",
|
||||
"LicenseWillBe": "许可证即将在 ",
|
||||
"Expire": " 过期"
|
||||
},
|
||||
"settings": {
|
||||
"setting": "设置"
|
||||
|
||||
@@ -720,7 +720,10 @@
|
||||
"userGuideUrl": "User Guide URL",
|
||||
"username": "Username",
|
||||
"usernamePlaceholder": "Please input username",
|
||||
"refreshLdapCache":"Refreshing Ldap cache "
|
||||
"refreshLdapCache":"Refreshing Ldap cache ",
|
||||
"LicenseExpired": "License expired",
|
||||
"LicenseWillBe": "License will expire at ",
|
||||
"Expire": ""
|
||||
},
|
||||
"settings": {
|
||||
"setting": "Setting"
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<div v-if="!loading">
|
||||
<el-alert v-if="isExpire" type="error">
|
||||
{{ isExpire }}
|
||||
</el-alert>
|
||||
<el-alert v-if="!isValidateLicense" type="success">
|
||||
{{ this.$t('setting.ImportLicenseTip') }}
|
||||
</el-alert>
|
||||
@@ -30,6 +33,7 @@ import { QuickActions, Dialog } from '@/components'
|
||||
import DetailCard from '@/components/DetailCard/index'
|
||||
import { importLicense } from '@/api/settings'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { toSafeLocalDateStr } from '@/utils/common'
|
||||
|
||||
export default {
|
||||
name: 'License',
|
||||
@@ -85,6 +89,16 @@ export default {
|
||||
}
|
||||
return true
|
||||
},
|
||||
isExpire() {
|
||||
const intervalDays = this.getIntervalDays(this.licenseData.date_expired)
|
||||
if (intervalDays < 0) {
|
||||
return this.$t('setting.LicenseExpired')
|
||||
}
|
||||
if (intervalDays < 7) {
|
||||
return this.$t('setting.LicenseWillBe') + this.licenseData.date_expired + this.$t('setting.Expire')
|
||||
}
|
||||
return false
|
||||
},
|
||||
cardTitle() {
|
||||
return ''
|
||||
},
|
||||
@@ -158,6 +172,12 @@ export default {
|
||||
},
|
||||
fileChange(e) {
|
||||
this.licenseFile['file'] = e.target.files[0]
|
||||
},
|
||||
getIntervalDays(date) {
|
||||
const dateExpired = new Date(toSafeLocalDateStr(date))
|
||||
const dateNow = new Date()
|
||||
const intervalTime = dateExpired.getTime() - dateNow.getTime()
|
||||
return Math.floor(intervalTime / (24 * 3600 * 1000))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user