Commit 12b8c64c authored by 上官's avatar 上官

增加版本号的显示

parent 4321843b
...@@ -99,7 +99,12 @@ function checkUpdateData(inf){ ...@@ -99,7 +99,12 @@ function checkUpdateData(inf){
}else{ }else{
if(is_invoke_from_setting){ if(is_invoke_from_setting){
alert('您的APP版本已经是最新的.') plus.runtime.getProperty(plus.runtime.appid,function(inf){
inf.version;
alert('您的APP版本已经是最新的. 版本号: '+ compareVersion_big(curVer,inf.version))
});
} }
} }
...@@ -167,6 +172,37 @@ function compareVersion(ov,nv){ ...@@ -167,6 +172,37 @@ function compareVersion(ov,nv){
return true; return true;
} }
} }
/**
* 比较版本大小,返回大的版本号
* @param {String} ov
* @param {String} nv
* @return {Boolean}
*/
function compareVersion_big(ov,nv){
if(!ov || !nv || ov == "" || nv == ""){
return "9.9.9.9";
}
var b = false,
ova = ov.split(".",4),
nva = nv.split(".",4),
j = ova.length,
k = nva.length;
// console.log("ova:"+ova+"nva:"+nva);
for(var i =0;i < j && i < k;i += 1){
var so = ova[i],
no = parseInt(so),
sn = nva[i],
nn = parseInt(sn);
if(nn > no || sn.length > so.length){
return nv;
}else if(nn < no){
return ov;
}
}
if(k > j && 0 == nv.indexOf(ov)){
return nv;
}
}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"id" : "H544710A8", /*应用的标识,创建应用时自动生成,勿手动修改*/ "id" : "H544710A8", /*应用的标识,创建应用时自动生成,勿手动修改*/
"name" : "飞天兔MES", /*应用名称,程序桌面图标名称*/ "name" : "飞天兔MES", /*应用名称,程序桌面图标名称*/
"version" : { "version" : {
"name" : "1.0.0.29", /*应用版本名称*/ "name" : "1.0.0.31", /*应用版本名称*/
"code" : "338" "code" : "338"
}, },
"description" : "飞天兔MES平板版", /*应用描述信息*/ "description" : "飞天兔MES平板版", /*应用描述信息*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment