|
@@ -7,11 +7,9 @@
|
|
<script setup>
|
|
<script setup>
|
|
import { nextTick, ref, watch } from 'vue'
|
|
import { nextTick, ref, watch } from 'vue'
|
|
import { useAppStore } from '~src/store'
|
|
import { useAppStore } from '~src/store'
|
|
-import { detectionBrowser, useOsTheme } from 'hc-vue3-ui'
|
|
|
|
|
|
+import { detectionBrowser, getAppVersion, useOsTheme } from 'hc-vue3-ui'
|
|
import { getObjValue, setElementMainColor } from 'js-fast-way'
|
|
import { getObjValue, setElementMainColor } from 'js-fast-way'
|
|
-import { getStoreValue, setStoreValue } from '~uti/storage'
|
|
|
|
import { addDocumentsJs } from '~uti/tools'
|
|
import { addDocumentsJs } from '~uti/tools'
|
|
-import { getVersionJson } from '~api/other'
|
|
|
|
import split from 'split.js'
|
|
import split from 'split.js'
|
|
|
|
|
|
//初始变量
|
|
//初始变量
|
|
@@ -35,36 +33,10 @@ nextTick(()=> {
|
|
addDocumentsJs()
|
|
addDocumentsJs()
|
|
//生产环境下,检测更新
|
|
//生产环境下,检测更新
|
|
if (import.meta.env.PROD) {
|
|
if (import.meta.env.PROD) {
|
|
- getVersionJsonApi()
|
|
|
|
- //检测新版本
|
|
|
|
- setInterval(() => {
|
|
|
|
- getVersionJsonApi()
|
|
|
|
- }, 1000 * 60)
|
|
|
|
|
|
+ getAppVersion()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
-//获取版本更新信息
|
|
|
|
-const getVersionJsonApi = async () => {
|
|
|
|
- const cache_version = getStoreValue('version')
|
|
|
|
- const { res } = await getVersionJson()
|
|
|
|
- const version = getObjValue(res)?.value
|
|
|
|
- setStoreValue('version', version)
|
|
|
|
- if (cache_version && cache_version !== version) {
|
|
|
|
- window?.$messageBox?.alert('检测到有新版本更新,请点击更新,或手动刷新网页更新,如果不更新,将无法使用相关功能', '更新提醒', {
|
|
|
|
- showCancelButton: true,
|
|
|
|
- confirmButtonText: '立即更新',
|
|
|
|
- cancelButtonText: '暂不更新',
|
|
|
|
- type: 'warning',
|
|
|
|
- callback: (action) => {
|
|
|
|
- if (action === 'confirm') {
|
|
|
|
- //刷新页面
|
|
|
|
- window.location.reload()
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
//设置主题
|
|
//设置主题
|
|
const setUserTheme = (theme, appColor) => {
|
|
const setUserTheme = (theme, appColor) => {
|
|
const colorVal = getObjValue(appColor)
|
|
const colorVal = getObjValue(appColor)
|