|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- var AppVersion = "1.0.1";
-
- function CheckUpdate() {
- var vd = AppVersion;
- plus.nativeUI.showWaiting("检查更新...");
- //获取最新用户信息
- // var xhr = new plus.net.XMLHttpRequest();
- // xhr.responseType = "json";
- // xhr.onreadystatechange = function() {
- // switch(xhr.readyState) {
- // case 4:
- // if(xhr.status == 200) {
- // if(xhr.response.Status==1) {
- // var versioninfo = xhr.response;
- // if(vd != versioninfo.Ver) {
- // var btnArray = ['是', '否'];
- // mui.confirm('新版本:' + versioninfo.Ver + '', '是否更新', btnArray, function(e) {
- // if(e.index == 0) {
- // //down
- // plus.runtime.openURL(versioninfo.Urls);
- // return true;
- // } else {
-
- // }
- // });
- // }
- // } else {
- // plus.nativeUI.toast('服务器错误,稍后重试。');
- // }
- // plus.nativeUI.closeWaiting();
- // } else {
- // plus.nativeUI.closeWaiting();
- // plus.nativeUI.toast('您的网络不给力。');
- // }
- // break;
- // default:
- // break;
- // }
- // }
- // xhr.open("GET", encodeURI(serverdomain + "/WebService/UserService.ashx?Action=GetAppSettingStudent"));
- // xhr.send();
- mui.post(api+'/user/getEditionInfo',{data:"student"},function(res){
- plus.nativeUI.closeWaiting();
- if(res.code=="200"){
-
- var versioninfo = res.data;
- console.log(vd+JSON.stringify(res))//
- if(vd != versioninfo.Editon) {
- var btnArray = ['是', '否'];
- mui.confirm('新版本:' + versioninfo.Editon + '', '是否更新', btnArray, function(e) {
- if(e.index == 0) {
- //down
- plus.runtime.openURL(web+ versioninfo.Url);
- return true;
- } else {
-
- }
- });
- }
- else
- {
- plus.nativeUI.toast('当前已是最新版本。');
- }
- }
- },'json')
- }
-
- function CheckUpdateManual() {
- var vd = AppVersion;
- plus.nativeUI.showWaiting("检查更新...");//
- //获取最新用户信息
- // var xhr = new plus.net.XMLHttpRequest();
- // xhr.responseType = "json";
- // xhr.onreadystatechange = function() {
- // switch(xhr.readyState) {
- // case 4:
- // if(xhr.status == 200) {
- // if(xhr.response.Status==1) {
- // var versioninfo = xhr.response;
- // if(vd != versioninfo.Ver) {
- // var btnArray = ['是', '否'];
- // mui.confirm('新版本:' + versioninfo.Ver + '', '是否更新', btnArray, function(e) {
- // if(e.index == 0) {
- // //down
- // plus.runtime.openURL(versioninfo.Urls);
- // return true;
- // } else {
-
- // }
- // });
- // }
- // else
- // {
- // plus.nativeUI.toast('当前已是最新版本。');
- // }
- // } else {
- // plus.nativeUI.toast('服务器错误,稍后重试。');
- // }
- // plus.nativeUI.closeWaiting();
- // } else {
- // plus.nativeUI.closeWaiting();
- // plus.nativeUI.toast('您的网络不给力。');
- // }
- // break;
- // default:
- // break;
- // }
- // }
- // xhr.open("GET", encodeURI(serverdomain + "/WebService/UserService.ashx?Action=GetAppSettingStudent"));
- // xhr.send();
-
- mui.post(api+'/user/getEditionInfo',{data:"student"},function(res){
- plus.nativeUI.closeWaiting();
- if(res.code=="200"){
- var versioninfo = xhr.response;
- if(vd != versioninfo.Ver) {
- var btnArray = ['是', '否'];
- mui.confirm('新版本:' + versioninfo.Editon + '', '是否更新', btnArray, function(e) {
- if(e.index == 0) {
- //down
- plus.runtime.openURL(web+ versioninfo.Url);
- return true;
- } else {
-
- }
- });
- }
- else
- {
- plus.nativeUI.toast('当前已是最新版本。');
- }
- }
- },'json')
- }
|