优化更新弹窗

This commit is contained in:
lyswhut
2019-09-26 00:06:02 +08:00
parent f3dd306f54
commit 6bd18e8078
10 changed files with 50 additions and 22 deletions
+6 -4
View File
@@ -3,15 +3,17 @@ import { httpGet } from '../utils/request'
import { author, name } from '../../../package.json'
export default {
getVersionInfo() {
getVersionInfo(state, retryNum = 0) {
return new Promise((resolve, reject) => {
httpGet(`https://raw.githubusercontent.com/${author.name}/${name}/master/publish/version.json`, (err, resp, body) => {
httpGet(`https://raw.githubusercontent.com/${author.name}/${name}/master/publish/version.json`, {
timeout: 20000,
}, (err, resp, body) => {
if (err) {
return resolve({
return ++retryNum > 3 ? resolve({
version: '0.0.0',
desc: '<h3>版本信息获取失败</h3><ul><li>更新信息获取失败,可能是无法访问Github导致的,请手动检查更新!</li><li>检查方法:去设置-关于洛雪音乐打开<strong>开源地址</strong>或<strong>网盘地址</strong>查看<strong>版本号</strong>与当前版本对比是否最新</li></ul>',
history: [],
})
}) : this.dispatch('getVersionInfo', retryNum).then(ver => resolve(ver))
}
resolve(body)
})