shish 4 лет назад
Родитель
Сommit
ef139634c0
1 измененных файлов с 31 добавлено и 8 удалено
  1. 31 8
      hdPad/src/mixins/autoUpdate.js

+ 31 - 8
hdPad/src/mixins/autoUpdate.js

@@ -23,30 +23,53 @@ export default {
     },
     },
 	methods: {
 	methods: {
         androidCheckUpdate(){
         androidCheckUpdate(){
+            let that = this
             getApkVersion().then(res=>{
             getApkVersion().then(res=>{
+                console.log(res)
                 if(res.code == 1){
                 if(res.code == 1){
                     let version = res.data.version
                     let version = res.data.version
                     let mustUpdate = res.data.mustUpdate
                     let mustUpdate = res.data.mustUpdate
                     let singer = mustUpdate == 1 ? true : false
                     let singer = mustUpdate == 1 ? true : false
-                    if(version <= this.version){
+                    if(version <= that.version){
                         return false
                         return false
                     }
                     }
                     if(plus.networkinfo.getCurrentType()!=3){
                     if(plus.networkinfo.getCurrentType()!=3){
-                        let that = this
-                        that.$util.confirmModal({content:'新版本更新',cancelText:'稍后',okText:'使用流量更新'},() => {
-                          this.install(version)
+
+                        uni.showModal({
+                            title: '提示',
+                            content: '有新的版本可以更新',
+                            cancelText: "取消",
+                            confirmText: "使用流量更新",
+                            showCancel: false,
+                            success: (res) => {
+                                if(res.confirm) {  
+                                    that.install(version)
+                                }
+                            } 
                         })
                         })
+
                     }else{
                     }else{
-                        let that = this
-                        that.$util.confirmModal({content:'新版本更新',singer:singer},() => {
-                          this.install(version)
+
+                        uni.showModal({
+                            title: '提示',
+                            content: '有新的版本可以更新',
+                            cancelText: "取消",
+                            confirmText: "确认",
+                            showCancel: false,
+                            success: (res) => {
+                                if(res.confirm) {  
+                                    that.install(version)
+                                }
+                            } 
                         })
                         })
+
                     }
                     }
                 }
                 }
             })            
             })            
         },
         },
         install(version){
         install(version){
             uni.showToast({ title: '后台下载中...', mask: false, duration: 1200,icon:"none"})
             uni.showToast({ title: '后台下载中...', mask: false, duration: 1200,icon:"none"})
+            console.log(APIHOST+'/apk/pad'+version+'.apk')
             var dtask = plus.downloader.createDownload( APIHOST+'/apk/pad'+version+'.apk', {}, function ( d, status ) {  
             var dtask = plus.downloader.createDownload( APIHOST+'/apk/pad'+version+'.apk', {}, function ( d, status ) {  
                 // 下载完成  
                 // 下载完成  
                 if ( status == 200 ) {   
                 if ( status == 200 ) {   
@@ -56,7 +79,7 @@ export default {
                 } else {  
                 } else {  
                     uni.showToast({ title: '安装失败', mask: false, duration: 1500,icon:"none" })
                     uni.showToast({ title: '安装失败', mask: false, duration: 1500,icon:"none" })
                 }
                 }
-            });
+            })
             dtask.start()
             dtask.start()
         }
         }
 	}
 	}