update version check

This commit is contained in:
2023-11-20 19:06:06 +08:00
parent 849d1594a5
commit b46aa8e8cf
2 changed files with 17 additions and 12 deletions

View File

@@ -1,3 +1,5 @@
import { QueryGetAPI } from '@/api/query'
import { BASE_API } from '@/data/constants'
import { createApp } from 'vue' import { createApp } from 'vue'
import App from './App.vue' import App from './App.vue'
import router from './router' import router from './router'
@@ -5,15 +7,17 @@ import { GetSelfAccount } from './api/account'
import { GetNotifactions } from './data/notifactions' import { GetNotifactions } from './data/notifactions'
let currentVersion let currentVersion
import('@/version.js').then((versionModule) => { QueryGetAPI(BASE_API + 'vtsuru/version').then((version) => {
currentVersion = versionModule.version if (version.code == 200) {
const savedVersion = localStorage.getItem('Version') currentVersion = version.data
const savedVersion = localStorage.getItem('Version')
if (currentVersion && savedVersion && savedVersion !== currentVersion) { if (currentVersion && savedVersion && savedVersion !== currentVersion) {
alert('新的版本更新, 请按 Ctrl+F5 强制刷新页面') alert('发现新的版本更新, 请按 Ctrl+F5 强制刷新页面')
}
localStorage.setItem('Version', currentVersion)
} }
localStorage.setItem('Version', currentVersion)
}) })
createApp(App).use(router).mount('#app') createApp(App).use(router).mount('#app')

View File

@@ -825,6 +825,12 @@ onUnmounted(() => {
<NAlert type="warning" v-else title="你尚未注册并登录 VTsuru.live, 大部分规则设置将不可用 (因为我懒得在前段重写一遍逻辑"> <NAlert type="warning" v-else title="你尚未注册并登录 VTsuru.live, 大部分规则设置将不可用 (因为我懒得在前段重写一遍逻辑">
<NButton @click="$router.push({ name: 'manage-index' })" type="primary"> 前往登录或注册 </NButton> <NButton @click="$router.push({ name: 'manage-index' })" type="primary"> 前往登录或注册 </NButton>
</NAlert> </NAlert>
<NAlert type="warning" closable>
不要同时开多个页面, 会导致点歌重复! 可以考虑使用
<NButton text type="primary" tag="a" href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p" target="_blank"> VtsuruEventFetcher </NButton>
, 部署后还可以记录SC和上舰历史
</NAlert>
<br /> <br />
<NCard size="small"> <NCard size="small">
<NSpace align="center"> <NSpace align="center">
@@ -834,11 +840,6 @@ onUnmounted(() => {
</template> </template>
{{ configCanEdit ? '' : '登陆后才可以使用此功能' }} {{ configCanEdit ? '' : '登陆后才可以使用此功能' }}
</NTooltip> </NTooltip>
<NAlert type="warning">
不要同时开多个页面, 会导致点歌重复! 可以考虑使用
<NButton text type="primary" tag="a" href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p" target="_blank"> VtsuruEventFetcher </NButton>
, 部署后还可以记录SC和上舰历史
</NAlert>
</NSpace> </NSpace>
</NCard> </NCard>
<br /> <br />