| | |
| | | //#endif |
| | | }, |
| | | methods: { |
| | | update() { |
| | | update(index=0) { |
| | | var _this = this; |
| | | uni.request({ |
| | | url:_this.serverUrl + '/LMES/AppUpdate', |
| | |
| | | // "HotVersionNumber": "最新版本", |
| | | // "Content": "" |
| | | if (result.data.count == 1) { |
| | | var datas = result.data.data[0] |
| | | var datas = result.data.data[index] |
| | | let dataLength = result.data.data.length |
| | | uni.setStorageSync('remarkURL',datas.DowloadPath) |
| | | plus.runtime.getProperty(plus.runtime.appid, function(inf) { |
| | | console.log(inf) |
| | |
| | | success: (downloadResult) => { |
| | | if (downloadResult.statusCode === 200) { |
| | | uni.hideLoading() |
| | | uni.showLoading({ |
| | | title:'下载完成,正在更新...', |
| | | mask:true, |
| | | }) |
| | | plus.runtime.install(downloadResult.tempFilePath, { |
| | | force: false |
| | | }, function() { |
| | | uni.hideLoading() |
| | | console.log('install success...'); |
| | | plus.runtime.restart(); |
| | | }, function(e) { |
| | | uni.hideLoading() |
| | | console.error('install fail...'); |
| | | |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | uni.hideLoading() |
| | | console.error('install fail...'); |
| | | if(index < dataLength){ |
| | | // 如果有多个请求地址,则请求下一个地址 |
| | | _this.update(index + 1) |
| | | } |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | uni.hideLoading() |
| | | console.error('install fail...'); |
| | | if(index < dataLength){ |
| | | // 如果有多个请求地址,则请求下一个地址 |
| | | _this.update(index + 1) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |