mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
update version check
This commit is contained in:
18
src/main.ts
18
src/main.ts
@@ -1,3 +1,5 @@
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import { BASE_API } from '@/data/constants'
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
@@ -5,15 +7,17 @@ import { GetSelfAccount } from './api/account'
|
||||
import { GetNotifactions } from './data/notifactions'
|
||||
|
||||
let currentVersion
|
||||
import('@/version.js').then((versionModule) => {
|
||||
currentVersion = versionModule.version
|
||||
const savedVersion = localStorage.getItem('Version')
|
||||
QueryGetAPI(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 强制刷新页面')
|
||||
if (currentVersion && savedVersion && savedVersion !== currentVersion) {
|
||||
alert('发现新的版本更新, 请按 Ctrl+F5 强制刷新页面')
|
||||
}
|
||||
|
||||
localStorage.setItem('Version', currentVersion)
|
||||
}
|
||||
|
||||
localStorage.setItem('Version', currentVersion)
|
||||
})
|
||||
|
||||
createApp(App).use(router).mount('#app')
|
||||
|
||||
Reference in New Issue
Block a user