app.vue里面写
onLaunch: function(launch) {
let that = this
// #ifdef APP-PLUS
uni.getSystemInfo({
success(res) {
console.log(res)
console.log(res.platform)
console.log(res.version)
that.platform = res.platform
that.version = res.version
}
});
if(this.platform == 'android'){
this.$util.request({//获取轮播
url: '/mobile/index.php?act=index&op=apk_version',
method: 'get',
data: {},
}).then((res)=> {
console.log(res)
if(res.error_code == 0 && res.datas.url != ""){
console.log(res.datas.version,"版本号")
if(res.datas.version != that.version){
uni.showModal({
title: '版本更新',
content: '是否更新到最新版本'+res.datas.version,
success: (res2)=> {
if (res2.confirm) {
// 下载最新的版本
console.log(res.datas.url,"下载链接")
that.doUpData(res.datas.url)
} else if (res2.cancel) {
}
}
});
}
}
})
}
if(this.platform == 'ios'){
this.$util.request({//获取轮播
url: '/mobile/index.php?act=index&op=ios_version',
method: 'get',
data: {},
}).then((res)=> {
console.log(res,123456)
if(res.error_code == 0 && res.datas.url != ""){
console.log(res.datas.version,"版本号")
if(res.datas.version != that.version ){
uni.showModal({
title: '版本更新',
content: '是否更新到最新版本'+res.datas.version,
success: (res2)=> {
if (res2.confirm) {
// 下载最新的版本
console.log(res.datas.url,"下载链接")
that.doUpData(res.datas.url)
} else if (res2.cancel) {
}
}
});
}
}
})
}
// #endif
},