优化。
parent
6d40299c3f
commit
678b8e06cb
|
@ -162,11 +162,11 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
} else {
|
} else {
|
||||||
message = '检查更新失败: ' + (bodyObj && bodyObj.message ? bodyObj.message : body)
|
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) {
|
} catch (e) {
|
||||||
log.error('检查更新失败:', e)
|
log.error('检查更新失败:', e)
|
||||||
win.webContents.send('update', { key: 'error', error: '检查更新失败:' + e.message })
|
win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: '检查更新失败:' + e.message })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ function install (app, api) {
|
||||||
const type = message.key
|
const type = message.key
|
||||||
if (type === 'available') {
|
if (type === 'available') {
|
||||||
updateParams.checking = false
|
updateParams.checking = false
|
||||||
|
updateParams.newVersionData = message.value
|
||||||
foundNewVersion(message.value)
|
foundNewVersion(message.value)
|
||||||
} else if (type === 'notAvailable') {
|
} else if (type === 'notAvailable') {
|
||||||
updateParams.checking = false
|
updateParams.checking = false
|
||||||
|
@ -45,10 +46,15 @@ function install (app, api) {
|
||||||
} else if (type === 'error') {
|
} else if (type === 'error') {
|
||||||
updateParams.checking = false
|
updateParams.checking = false
|
||||||
updateParams.downloading = false
|
updateParams.downloading = false
|
||||||
|
if (message.action === 'checkForUpdate' && updateParams.newVersionData) {
|
||||||
|
// 如果检查更新报错了,但刚才成功拿到过一次数据,就拿之前的数据
|
||||||
|
foundNewVersion(updateParams.newVersionData)
|
||||||
|
} else {
|
||||||
const error = message.error
|
const error = message.error
|
||||||
app.$message.error((error == null ? '未知错误' : (error.stack || error).toString()))
|
app.$message.error((error == null ? '未知错误' : (error.stack || error).toString()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function noNewVersion () {
|
function noNewVersion () {
|
||||||
updateParams.newVersion = false
|
updateParams.newVersion = false
|
||||||
|
|
Loading…
Reference in New Issue