|
|
@@ -9,15 +9,17 @@ export default {
|
|
|
onLoad(){
|
|
|
// #ifdef APP-PLUS
|
|
|
plus.runtime.getProperty(plus.runtime.appid,(wgtinfo)=>{
|
|
|
- this.version = wgtinfo.version
|
|
|
+ this.version = wgtinfo.versionCode
|
|
|
+ console.log(this.version)
|
|
|
+ console.log(wgtinfo)
|
|
|
});
|
|
|
uni.getSystemInfo({
|
|
|
success:(res) => {
|
|
|
- //检测当前平台,如果是安卓则启动安卓更新
|
|
|
- if(res.platform=="android"){
|
|
|
- this.androidCheckUpdate()
|
|
|
- }
|
|
|
- }
|
|
|
+ //检测当前平台,如果是安卓则启动安卓更新
|
|
|
+ if(res.platform=="android"){
|
|
|
+ this.androidCheckUpdate()
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
// #endif
|
|
|
},
|
|
|
@@ -43,21 +45,21 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
+ })
|
|
|
},
|
|
|
install(version){
|
|
|
uni.showToast({ title: '后台下载中...', mask: false, duration: 1200,icon:"none"})
|
|
|
- var dtask = plus.downloader.createDownload( APIHOST+'/apk/'+version+'.apk', {}, function ( d, status ) {
|
|
|
- // 下载完成
|
|
|
- if ( status == 200 ) {
|
|
|
- plus.runtime.install(plus.io.convertLocalFileSystemURL(d.filename),{},{},function(error){
|
|
|
+ var dtask = plus.downloader.createDownload( APIHOST+'/apk/'+version+'.apk', {}, function ( d, status ) {
|
|
|
+ // 下载完成
|
|
|
+ if ( status == 200 ) {
|
|
|
+ plus.runtime.install(plus.io.convertLocalFileSystemURL(d.filename),{},{},function(error){
|
|
|
uni.showToast({ title: '安装失败', mask: false, duration: 1500,icon:"none" })
|
|
|
- })
|
|
|
- } else {
|
|
|
+ })
|
|
|
+ } else {
|
|
|
uni.showToast({ title: '更新失败', mask: false, duration: 1500,icon:"none" })
|
|
|
}
|
|
|
});
|
|
|
dtask.start()
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|