85 lines
2.1 KiB
JavaScript
85 lines
2.1 KiB
JavaScript
apiready = function() {
|
|
var ctrl = {
|
|
init : {},
|
|
frames : [],
|
|
bind : {},
|
|
switchFrame : {},
|
|
frameX : 0,
|
|
frameY : 0,
|
|
frameWidth : 0,
|
|
frameHeight : 0
|
|
};
|
|
ctrl.init = function() {
|
|
// 适配安卓状态栏
|
|
CommonModel.fitInStatusBar();
|
|
//初始化frame信息
|
|
ctrl.frames["inspect-new"] = { // 新版巡检日志
|
|
"title" : "巡检日志",
|
|
"url" : "widget://html/feature/logQuery/inspectLogListNew.html",
|
|
};
|
|
|
|
ctrl.frames["inspect"] = { // 旧版巡检日志
|
|
"title" : "巡检日志(旧版)",
|
|
"url" : "widget://html/feature/logQuery/inspectLogList.html",
|
|
};
|
|
|
|
ctrl.frames["repair"] = {
|
|
"title" : "抢修日志",
|
|
"url" : "widget://html/feature/logQuery/repairLogList.html",
|
|
};
|
|
ctrl.frames["operate"] = {
|
|
"title" : "操作票",
|
|
"url" : "widget://html/feature/logQuery/operateTicketList.html",
|
|
};
|
|
ctrl.frames["work"] = {
|
|
"title" : "工作票",
|
|
"url" : "widget://html/feature/logQuery/workTicketList.html",
|
|
};
|
|
ctrl.frames["inspectBug"] = {
|
|
"title" : "设备缺陷",
|
|
"url" : "widget://html/feature/logQuery/inspectBugList.html",
|
|
};
|
|
//计算frame显示的位置和尺寸
|
|
var windowWidth = parseInt($api.cssVal($api.dom("body"), "width"));
|
|
var windowHeight = parseInt($api.cssVal($api.dom("body"), "height"));
|
|
var headerHeight = parseInt($api.cssVal($api.dom("#header"), "height"));
|
|
ctrl.frameX = 0;
|
|
ctrl.frameY = headerHeight;
|
|
ctrl.frameWidth = windowWidth;
|
|
ctrl.frameHeight = windowHeight - headerHeight;
|
|
ctrl.page = api.pageParam.page ;
|
|
ctrl.bind();
|
|
ctrl.switchFrame(ctrl.page);
|
|
|
|
}
|
|
ctrl.bind = function() {
|
|
//点击返回按钮
|
|
$api.addEvt($api.dom("#back"), "touchend", function() {
|
|
api.closeWin();
|
|
})
|
|
|
|
}
|
|
|
|
//切换frame
|
|
ctrl.switchFrame = function(frameName){
|
|
var _this = ctrl;
|
|
var frame = _this.frames[frameName];
|
|
//显示对应的标题
|
|
$api.text($api.dom("#title"), frame.title);
|
|
//切换frame
|
|
api.openFrame({
|
|
name: "indexFrame",
|
|
url: frame.url,
|
|
rect: {
|
|
x:_this.frameX,
|
|
y:_this.frameY,
|
|
w:_this.frameWidth,
|
|
h:_this.frameHeight
|
|
}
|
|
});
|
|
|
|
}
|
|
ctrl.init();
|
|
|
|
}
|