/**
* 单页面应用
*/
define(
"check-app",
[
'mk7/app'
],
function (app) {
var $$ = Dom7;
var _autoLoading = function () {
var e = $$('.ui-loading-block');
if (0 == e.length) {
//
$$('.view-main').html('
');
window['waitingTime'] = 10000; // 显示重新加载的等待时间,默认10s
if (window['loaderTimer']) {
clearTimeout(window['loaderTimer']);
}
window['loaderTimer'] = setTimeout(function () {
var loaderTips = document.getElementById('loader-inner');
var tips = document.createElement('p');
tips.className = 'notice';
if (loaderTips) {
tips.innerHTML = '加载速度太慢?试试重新加载';
loaderTips.appendChild(tips);
}
}, window['waitingTime']);
}
};
var fromOutside = true; // 标记是否从外部进来
app.name = 'check',//用来 smart 和 index-controller 构成完整的命名空间 smart/index-controller
app.routes = {
'index': function () {
fromOutside = false;
_autoLoading();
return app.runController('index');
},
'*': function () {
fromOutside = false;
_autoLoading();
return app.runController('index');
},
'scan-count/:uuid/:scancount': function (uuid, scancount) {
fromOutside = false;
_autoLoading();
return app.runController('scan-count',{uuid: uuid, scancount: scancount});
},
'warning/:uuid': function (uuid) {
fromOutside = false;
_autoLoading();
return app.runController('warning',{uuid: uuid});
},
}
return app;
}
);