From 4cbbf2ac81f567b06aa7ca7152e1eacdc73a50d7 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Wed, 4 Sep 2019 00:31:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=89=88=E6=9C=AC=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=B6=85=E6=97=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/App.vue | 15 +++++++++++++++ src/renderer/store/actions.js | 8 +++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 08b2d1ba..850eb176 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -37,6 +37,7 @@ export default { globalObj: { apiSource: 'messoer', }, + updateTimeout: null, } }, computed: { @@ -98,19 +99,29 @@ export default { }) rendererOn('update-error', () => { this.setVersionModalVisible({ isError: true }) + this.clearUpdateTimeout() this.$nextTick(() => { this.showUpdateModal() }) }) rendererOn('update-downloaded', () => { + this.clearUpdateTimeout() this.showUpdateModal() }) rendererOn('update-not-available', () => { if (this.setting.ignoreVersion) this.setSetting(Object.assign({}, this.setting, { ignoreVersion: null })) + this.clearUpdateTimeout() this.setNewVersion({ version: this.version.version, }) }) + this.updateTimeout = setTimeout(() => { + this.updateTimeout = null + this.setVersionModalVisible({ isError: true }) + this.$nextTick(() => { + this.showUpdateModal() + }) + }, 180000) this.initData() this.globalObj.apiSource = this.setting.apiSource @@ -174,6 +185,10 @@ export default { body.removeEventListener('mouseleave', this.enableIgnoreMouseEvents) } }, + clearUpdateTimeout() { + clearTimeout(this.updateTimeout) + this.updateTimeout = null + }, } diff --git a/src/renderer/store/actions.js b/src/renderer/store/actions.js index dde1d7c6..10fd284a 100644 --- a/src/renderer/store/actions.js +++ b/src/renderer/store/actions.js @@ -6,7 +6,13 @@ export default { getVersionInfo() { return new Promise((resolve, reject) => { httpGet(`https://raw.githubusercontent.com/${author.name}/${name}/master/publish/version.json`, (err, resp, body) => { - if (err) return reject(err) + if (err) { + return resolve({ + version: '0.0.0', + desc: '

版本获取失败

', + history: [], + }) + } resolve(body) }) })