新增版本更新超时功能
parent
a035a2525a
commit
4cbbf2ac81
|
@ -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
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -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: '<h3>版本获取失败</h3><ul><li>更新信息获取失败,可能是无法访问Github导致的,请手动检查更新!</li><li>检查方法:去设置-关于洛雪音乐打开<strong>开源地址</strong>或<strong>网盘地址</strong>查看<strong>版本号</strong>与当前版本对比是否最新</li></ul>',
|
||||
history: [],
|
||||
})
|
||||
}
|
||||
resolve(body)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue