mac不强制更新

This commit is contained in:
2026-03-13 17:48:00 +08:00
parent 1dd64988ba
commit 44df456240
5 changed files with 218 additions and 87 deletions

View File

@@ -76,10 +76,24 @@
<p class="text-gray-600 text-sm whitespace-pre-wrap">{{ updateInfo.releaseNotes }}</p>
</div>
<button @click="downloadUpdate"
class="w-full py-3 bg-gradient-to-r from-blue-600 to-blue-500 text-white rounded-lg font-medium hover:from-blue-700 hover:to-blue-600 transition-all shadow-sm">
立即下载更新
</button>
<!-- Mac 用户跳转下载页面 -->
<template v-if="isMac">
<p class="text-amber-600 text-sm bg-amber-50 p-3 rounded-lg text-center">
Mac 版本请前往官网下载最新安装包
</p>
<button @click="openDownloadPage"
class="w-full py-3 bg-gradient-to-r from-blue-600 to-blue-500 text-white rounded-lg font-medium hover:from-blue-700 hover:to-blue-600 transition-all shadow-sm">
前往下载
</button>
</template>
<!-- Windows 用户正常下载更新 -->
<template v-else>
<button @click="downloadUpdate"
class="w-full py-3 bg-gradient-to-r from-blue-600 to-blue-500 text-white rounded-lg font-medium hover:from-blue-700 hover:to-blue-600 transition-all shadow-sm">
立即下载更新
</button>
</template>
<p class="text-center text-gray-400 text-xs">
必须更新后才能使用程序
@@ -185,6 +199,7 @@ const {
progress,
error,
currentVersion,
isMac,
checkForUpdates,
downloadUpdate,
installUpdate
@@ -304,6 +319,15 @@ function formatBytes(bytes) {
return `${(bytes / Math.pow(k, i)).toFixed(1)} ${sizes[i]}`
}
// 打开下载页面Mac 用户)
function openDownloadPage() {
if (isElectronEnv) {
window.electronAPI.openExternal?.('https://yolozs.com/')
} else {
window.open('https://yolozs.com/', '_blank')
}
}
onUnmounted(() => {
if (timeoutTimer) clearTimeout(timeoutTimer)
if (countdownTimer) clearInterval(countdownTimer)