mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
update url
This commit is contained in:
46
src/main.ts
46
src/main.ts
@@ -1,5 +1,5 @@
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import { BASE_API } from '@/data/constants'
|
||||
import { BASE_API, apiFail } from '@/data/constants'
|
||||
import { createApp, h } from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
@@ -9,25 +9,33 @@ import { NText, createDiscreteApi } from 'naive-ui'
|
||||
|
||||
createApp(App).use(router).mount('#app')
|
||||
|
||||
GetSelfAccount()
|
||||
GetNotifactions()
|
||||
let currentVersion: string
|
||||
const { notification } = createDiscreteApi(['notification'])
|
||||
QueryGetAPI<string>(BASE_API + 'vtsuru/version').then((version) => {
|
||||
if (version.code == 200) {
|
||||
currentVersion = version.data
|
||||
const savedVersion = localStorage.getItem('Version')
|
||||
QueryGetAPI<string>(BASE_API() + 'vtsuru/version')
|
||||
.then((version) => {
|
||||
if (version.code == 200) {
|
||||
currentVersion = version.data
|
||||
const savedVersion = localStorage.getItem('Version')
|
||||
|
||||
if (currentVersion && savedVersion && savedVersion !== currentVersion) {
|
||||
//alert('发现新的版本更新, 请按 Ctrl+F5 强制刷新页面')
|
||||
notification.info({
|
||||
title: '发现新的版本更新',
|
||||
content: '请按 Ctrl+F5 强制刷新页面',
|
||||
duration: 5000,
|
||||
meta: () => h(NText, { depth: 3 }, () => currentVersion),
|
||||
})
|
||||
if (currentVersion && savedVersion && savedVersion !== currentVersion) {
|
||||
//alert('发现新的版本更新, 请按 Ctrl+F5 强制刷新页面')
|
||||
notification.info({
|
||||
title: '发现新的版本更新',
|
||||
content: '请按 Ctrl+F5 强制刷新页面',
|
||||
duration: 5000,
|
||||
meta: () => h(NText, { depth: 3 }, () => currentVersion),
|
||||
})
|
||||
}
|
||||
|
||||
localStorage.setItem('Version', currentVersion)
|
||||
}
|
||||
|
||||
localStorage.setItem('Version', currentVersion)
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
apiFail.value = true
|
||||
console.log('默认API调用失败, 切换至故障转移节点')
|
||||
})
|
||||
.finally(() => {
|
||||
//加载其他数据
|
||||
GetSelfAccount()
|
||||
GetNotifactions()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user