diff --git a/packages/gui/src/bridge/update/backend.js b/packages/gui/src/bridge/update/backend.js index d534eef..5354e1b 100644 --- a/packages/gui/src/bridge/update/backend.js +++ b/packages/gui/src/bridge/update/backend.js @@ -162,11 +162,11 @@ function updateHandle (app, api, win, beforeQuit, quit, log) { } else { message = '检查更新失败: ' + (bodyObj && bodyObj.message ? bodyObj.message : body) } - win.webContents.send('update', { key: 'error', error: message }) + win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: message }) } } catch (e) { log.error('检查更新失败:', e) - win.webContents.send('update', { key: 'error', error: '检查更新失败:' + e.message }) + win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: '检查更新失败:' + e.message }) } }) } diff --git a/packages/gui/src/bridge/update/front.js b/packages/gui/src/bridge/update/front.js index c471b5e..cac0dc3 100644 --- a/packages/gui/src/bridge/update/front.js +++ b/packages/gui/src/bridge/update/front.js @@ -31,6 +31,7 @@ function install (app, api) { const type = message.key if (type === 'available') { updateParams.checking = false + updateParams.newVersionData = message.value foundNewVersion(message.value) } else if (type === 'notAvailable') { updateParams.checking = false @@ -45,8 +46,13 @@ function install (app, api) { } else if (type === 'error') { updateParams.checking = false updateParams.downloading = false - const error = message.error - app.$message.error((error == null ? '未知错误' : (error.stack || error).toString())) + if (message.action === 'checkForUpdate' && updateParams.newVersionData) { + // 如果检查更新报错了,但刚才成功拿到过一次数据,就拿之前的数据 + foundNewVersion(updateParams.newVersionData) + } else { + const error = message.error + app.$message.error((error == null ? '未知错误' : (error.stack || error).toString())) + } } }