|
@@ -14,12 +14,15 @@ const props = defineProps({
|
|
const lastVersionTag = ref('')
|
|
const lastVersionTag = ref('')
|
|
let isCheckingUpdates = false
|
|
let isCheckingUpdates = false
|
|
let timer: ReturnType<typeof setInterval>
|
|
let timer: ReturnType<typeof setInterval>
|
|
|
|
+const entrance = import.meta.env.VITE_PUBLIC_PATH
|
|
|
|
+let last_notify = null
|
|
async function getVersionTag() {
|
|
async function getVersionTag() {
|
|
try {
|
|
try {
|
|
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
|
|
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
|
|
return null
|
|
return null
|
|
}
|
|
}
|
|
- const response = await fetch('/', {
|
|
|
|
|
|
+
|
|
|
|
+ const response = await fetch(entrance, {
|
|
cache: 'no-cache',
|
|
cache: 'no-cache',
|
|
method: 'HEAD'
|
|
method: 'HEAD'
|
|
})
|
|
})
|
|
@@ -53,23 +56,31 @@ const handleNotice = versionTag => {
|
|
lastVersionTag.value = versionTag
|
|
lastVersionTag.value = versionTag
|
|
window.location.reload()
|
|
window.location.reload()
|
|
}
|
|
}
|
|
|
|
+ if (last_notify) return
|
|
|
|
+
|
|
const notify = ElNotification({
|
|
const notify = ElNotification({
|
|
- title: t('le.layout.checkUpdatesTitle'),
|
|
|
|
- customClass: 'le-notification--check-app',
|
|
|
|
- message: (
|
|
|
|
- <div>
|
|
|
|
- {t('le.layout.checkUpdatesDescription')}
|
|
|
|
- <div class="text-right mt-[12px]">
|
|
|
|
- <ElButton onClick={() => notify.close()}>{t('le.btn.cancel')}</ElButton>
|
|
|
|
- <ElButton type="primary" onClick={onOk}>
|
|
|
|
- {t('le.refresh')}
|
|
|
|
- </ElButton>
|
|
|
|
- </div>
|
|
|
|
|
|
+ title: t('le.layout.checkUpdatesTitle'),
|
|
|
|
+ customClass: 'le-notification--check-app',
|
|
|
|
+ message: (
|
|
|
|
+ <div>
|
|
|
|
+ {t('le.layout.checkUpdatesDescription')}
|
|
|
|
+ <div class="text-right mt-[12px]">
|
|
|
|
+ <ElButton onClick={onClose}>{t('le.btn.cancel')}</ElButton>
|
|
|
|
+ <ElButton type="primary" onClick={onOk}>
|
|
|
|
+ {t('le.refresh')}
|
|
|
|
+ </ElButton>
|
|
</div>
|
|
</div>
|
|
- ),
|
|
|
|
- position: 'bottom-right',
|
|
|
|
- duration: 0
|
|
|
|
- })
|
|
|
|
|
|
+ </div>
|
|
|
|
+ ),
|
|
|
|
+ position: 'bottom-right',
|
|
|
|
+ duration: 0,
|
|
|
|
+ onClose
|
|
|
|
+ })
|
|
|
|
+ last_notify = notify
|
|
|
|
+ function onClose() {
|
|
|
|
+ notify.close()
|
|
|
|
+ last_notify = null
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
function start() {
|
|
function start() {
|