You've already forked qlg.frontend
改进更新功能
This commit is contained in:
59
js/index.js
59
js/index.js
@ -9,6 +9,7 @@ function plusReady() { // 获取本地应用资源版本号
|
||||
//休眠方法
|
||||
var ver;
|
||||
//获取数据
|
||||
|
||||
function sleep(numberMillis) {
|
||||
var now = new Date();
|
||||
var exitTime = now.getTime() + numberMillis;
|
||||
@ -32,12 +33,12 @@ mui.back = function() {
|
||||
}, 2000);
|
||||
return false;
|
||||
} else {
|
||||
if (new Date().getTime() - firstBackbutton < 2000) {
|
||||
if (mui.os.ios) {
|
||||
if (new Date().getTime() - firstBackbutton < 2000){
|
||||
if (mui.os.ios){
|
||||
const threadClass = plus.ios.importClass("NSThread");
|
||||
const mainThread = plus.ios.invoke(threadClass, "mainThread");
|
||||
plus.ios.invoke(mainThread, "exit");
|
||||
} else {
|
||||
} else{
|
||||
plus.runtime.quit();
|
||||
}
|
||||
}
|
||||
@ -56,20 +57,46 @@ mui.plusReady(function() {
|
||||
|
||||
if (!localStorage.getItem('isFirstDownlodad')) {
|
||||
localStorage.setItem('isFirstDownlodad', true);
|
||||
|
||||
}
|
||||
// clearInterval(timer);
|
||||
localStorage.setItem('cssUrl', "../css/");
|
||||
localStorage.setItem('jsUrl', "../js/");
|
||||
$('nav').css('display', 'block');
|
||||
$('#bg').css('display', 'none');
|
||||
var ipxSizeTop = 0;
|
||||
var ipxSizeBottom = 0;
|
||||
localStorage.setItem('ipxSizeTop', ipxSizeTop);
|
||||
localStorage.setItem('ipxSizeBottom', ipxSizeBottom);
|
||||
// TODO: 这个就是检测新版本的方法 -> init@start.js 先注释了,避免打不开
|
||||
// init(data);
|
||||
jumpPage(ipxSizeBottom);
|
||||
nav(0);
|
||||
mui.ajax('http://qlg.tsgz.moe:233/get_version_new.php?' + Math.random(), {
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;clearInterval(timer)
|
||||
// clearInterval(timer);
|
||||
localStorage.setItem('version', data.version);
|
||||
if (0 == is_juzi_online) {
|
||||
localStorage.setItem('cssUrl', "../css/");
|
||||
localStorage.setItem('jsUrl', "../js/");
|
||||
} else {
|
||||
localStorage.setItem('cssUrl', data.cssUrl ? data.cssUrl : "../css/");
|
||||
localStorage.setItem('jsUrl', data.jsUrl ? data.jsUrl : "../js/");
|
||||
}
|
||||
$('nav').css('display', 'block');
|
||||
$('#bg').css('display', 'none');
|
||||
var ipxSizeTop = 0;
|
||||
var ipxSizeBottom = 0;
|
||||
if (/iphone/gi.test(navigator.userAgent) && ((screen.height == 812 && screen.width == 375) || (screen.height ==
|
||||
896 && screen.width == 414) || (screen.height == 1792 / 3 && screen.width == 828 / 3))) {
|
||||
|
||||
ipxSizeTop = 24;
|
||||
ipxSizeBottom = 34;
|
||||
//$('.mui-bar').attr('style', "bottom: 34px;")
|
||||
};
|
||||
|
||||
localStorage.setItem('ipxSizeTop', ipxSizeTop);
|
||||
localStorage.setItem('ipxSizeBottom', ipxSizeBottom);
|
||||
init(data);
|
||||
jumpPage(ipxSizeBottom);
|
||||
nav(0);
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
mui.toast("网络异常,请检查网络设置!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user