授权
This commit is contained in:
@ -44,6 +44,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { inject, shallowRef, ref } from 'vue'
|
||||
import { AuthApi } from '@/api/setting/auth'
|
||||
import Headers from '../components/headers/index.vue'
|
||||
import Tree from '../components/tree/index.vue'
|
||||
import addStandText from '../components/propertyBox/addStandText.vue'
|
||||
@ -256,8 +257,28 @@ const uploadFile = (event) => {
|
||||
})
|
||||
}
|
||||
}
|
||||
const getAuthInfo = async () => {
|
||||
const res = await AuthApi.showAuth()
|
||||
if (typeof res.data === 'object') {
|
||||
let time = res.data.expireTime
|
||||
getStatus(time)
|
||||
}
|
||||
}
|
||||
|
||||
const getStatus = (time) => {
|
||||
const timestamp = new Date(time).getTime()
|
||||
|
||||
const currentTimestamp = Date.now()
|
||||
|
||||
if (timestamp > currentTimestamp) {
|
||||
window.checkAuthIsValid = true
|
||||
} else {
|
||||
window.checkAuthIsValid = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
getAuthInfo()
|
||||
await YJ.on()
|
||||
createEarth()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user