Преглед на файлове

Merge remote-tracking branch 'origin/master'

luoyali преди 9 месеца
родител
ревизия
826d089239
променени са 1 файла, в които са добавени 27 реда и са изтрити 16 реда
  1. 27 16
      src/layout/components/CheckUpdates.vue

+ 27 - 16
src/layout/components/CheckUpdates.vue

@@ -14,12 +14,15 @@ const props = defineProps({
 const lastVersionTag = ref('')
 let isCheckingUpdates = false
 let timer: ReturnType<typeof setInterval>
+const entrance = import.meta.env.VITE_PUBLIC_PATH
+let last_notify = null
 async function getVersionTag() {
 	try {
 		if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
 			return null
 		}
-		const response = await fetch('/', {
+
+		const response = await fetch(entrance, {
 			cache: 'no-cache',
 			method: 'HEAD'
 		})
@@ -53,23 +56,31 @@ const handleNotice = versionTag => {
 		lastVersionTag.value = versionTag
 		window.location.reload()
 	}
+	if (last_notify) return
+
 	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>
-			),
-			position: 'bottom-right',
-			duration: 0
-		})
+			</div>
+		),
+		position: 'bottom-right',
+		duration: 0,
+		onClose
+	})
+	last_notify = notify
+	function onClose() {
+		notify.close()
+		last_notify = null
+	}
 }
 
 function start() {