hrefLink() {
var that =this
//判断终端
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
var appcode=''
if(isAndroid){
appcode='1002'
}else if(isiOS){
appcode='2002'
}
mui.ajax(commonPath + '/common/checkVersion',{
data:{
appcode:appcode,
version:appVersion// '1.0.3'
},
dataType:'json',
type:'post',
contentType: "application/json",
headers:{'token': localStorage.getItem('token'),LoginOrigin:'APP'},
crossDomain: true,
async: true,
cache: false,
success:function(data){
if(data.status==200){
if(data.data.isUpdate){
if(isAndroid){
plus.runtime.openURL('https://a.app.qq.com/o/simple.jsp?pkgname=996');//调用浏览器打开网址
}else if(isiOS){
plus.runtime.openURL('https://itunes.apple.com/cn/app/007');//调用浏览器打开网址
}
}else{
mui.alert('您使用的已是最新版本!')
}
}
},
error:function(xhr,type,errorThrown){
//异常处理;
if(xhr.status == 401) {
window.location.href = '../login.html';
} else if(xhr.status == 443){
mui.alert('您的账号在另一地点登录,您被迫下线。');
window.location.href = '../login.html';
}else {
console.log('服务异常')
}
}
});
},
H5+ APP实现检测更新
最新推荐文章于 2024-05-05 01:43:32 发布