You've already forked qlg.frontend
Init Repo
This commit is contained in:
74
js/index.js
Normal file
74
js/index.js
Normal file
@ -0,0 +1,74 @@
|
||||
var wgtVer = null;
|
||||
var is_juzi_online = 0;
|
||||
|
||||
function plusReady() { // 获取本地应用资源版本号
|
||||
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
|
||||
wgtVer = inf.version;
|
||||
});
|
||||
}
|
||||
//休眠方法
|
||||
var ver;
|
||||
//获取数据
|
||||
function sleep(numberMillis) {
|
||||
var now = new Date();
|
||||
var exitTime = now.getTime() + numberMillis;
|
||||
while (true) {
|
||||
now = new Date();
|
||||
if (now.getTime() > exitTime)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mui.init({
|
||||
swipeBack: true
|
||||
});
|
||||
var firstBackbutton = null;
|
||||
mui.back = function() {
|
||||
if (!firstBackbutton) {
|
||||
window.plus.nativeUI.toast('再按一次退出应用');
|
||||
firstBackbutton = new Date().getTime();
|
||||
setTimeout(function() {
|
||||
firstBackbutton = null
|
||||
}, 2000);
|
||||
return false;
|
||||
} else {
|
||||
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 {
|
||||
plus.runtime.quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
//获取cid用于推送
|
||||
mui.plusReady(function() {
|
||||
// var cid = plus.push.getClientInfo().clientid;
|
||||
var timer = 0;
|
||||
timer = setInterval(function() {
|
||||
getData();
|
||||
}, 3000)
|
||||
getData();
|
||||
|
||||
function getData() {
|
||||
|
||||
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);
|
||||
init(data);
|
||||
jumpPage(ipxSizeBottom);
|
||||
nav(0);
|
||||
}
|
||||
|
||||
})
|
Reference in New Issue
Block a user