define(["base/AppEvent",
|
"manager/configmanager",
|
"manager/widgetsmanager",
|
"manager/mapmanager",
|
"manager/querymanager",
|
"manager/routemanager",
|
"dojo/dom",
|
"base/ConfigData",
|
"dojo/_base/declare",
|
"dojo/on",
|
"dojo/_base/lang",
|
"dojo/dom-style",
|
"dojo/dom-class",
|
"dojo/dom-attr",
|
"dojo/dom-construct",
|
"controls/loader/Loader",
|
"dojo/query",
|
"dojo/window"
|
],
|
function (AppEvent,
|
configmanager,
|
widgetsmanager,
|
mapmanager,
|
querymanager,
|
routemanager,
|
dom,
|
ConfigData,
|
declare,
|
on,
|
lang,
|
domStyle,
|
domClass,
|
domAttr,
|
domConstruct,
|
Loader,
|
query,
|
win) {
|
return declare("Framework", null, {
|
_configmanager: null,
|
_widgetmanager: null,
|
_mapmanager: null,
|
_querymanager: null,
|
_showsider: true,
|
_loader: null,
|
/**
|
* 头部的高度
|
*/
|
headerHeight: 0,
|
/**
|
* 侧边栏的宽度
|
*/
|
siderWidth: 350,
|
popupWindow: null,
|
|
constructor: function () {
|
var thisObj = this;
|
_configmanager = new configmanager();
|
_widgetmanager = new widgetsmanager();
|
_mapmanager = new mapmanager();
|
_querymanager = new querymanager();
|
_routemanager = new routemanager();
|
_widgetmanager.MapManager = _mapmanager;
|
var fun = lang.hitch(this, this.onConfigLoaded);
|
AppEvent.addAppEventListener(AppEvent.CONFIG_LOADED, fun);
|
AppEvent.dispatchAppEvent(AppEvent.APPLICATION_LOAD, {}); //派发应用加载事件
|
AppEvent.addAppEventListener(AppEvent.BASE_MAP_LAYER_LOADED, this.onMapLoaded);
|
AppEvent.addAppEventListener(AppEvent.BASE_MAP_LAYER_LOADED_ERROR, this.onMapLoadedError);
|
AppEvent.addAppEventListener(AppEvent.SHOW_LOAD, lang.hitch(this, this.onShowLoad));
|
AppEvent.addAppEventListener(AppEvent.HIDE_LOAD, lang.hitch(this, function (evt) {
|
this._loader.hide();
|
}));
|
AppEvent.addAppEventListener(AppEvent.APPLICATION_FULLSCREEN, lang.hitch(this, this.onFullScreen));
|
_configmanager.loadconfig("config.json");
|
this._loader = new Loader();
|
//注册窗体变化事件
|
window.onload = lang.hitch(thisObj, function () {
|
this.resize();
|
});
|
window.onresize = lang.hitch(thisObj, function () {
|
this.resize();
|
});
|
},
|
onShowLoad: function (data) {
|
this._loader.show(data.text);
|
},
|
onConfigLoaded: function () {
|
//dom.byId("copyrightspan").innerHTML += ConfigData.copyright;
|
var siderbutton = dom.byId("siderbutton");
|
if (siderbutton != undefined || siderbutton != null) {
|
on(siderbutton, "click", lang.hitch(this, this.onSiderButtonClick));
|
}
|
|
},
|
_onClickShowPlatform: function () {
|
require(["controls/popupwindow/PopupWindow"], function (PopupWindow) {
|
if (!this.popupWindow) {
|
this.popupWindow = new PopupWindow;
|
}
|
this.popupWindow.show({
|
"title": "关于平台",
|
"width": "749",
|
"height": "654",
|
"parent": this.body
|
});
|
this.popupWindow.setContent('<iframe style="border:none;width:100%;height:100%;" src="../main/aboutplatform.html"></div>');
|
});
|
|
},
|
_onClickShowAboutus: function () {
|
require(["controls/popupwindow/PopupWindow"], function (PopupWindow) {
|
if (!this.popupWindow) {
|
this.popupWindow = new PopupWindow;
|
}
|
this.popupWindow.show({
|
"title": "关于我们",
|
"width": "749",
|
"height": "654",
|
"parent": this.body
|
});
|
this.popupWindow.setContent('<iframe style="border:none;width:100%;height:100%;" src="../main/about.html"></div>');
|
});
|
},
|
_onClickShowDisclaimer: function () {
|
require(["controls/popupwindow/PopupWindow"], function (PopupWindow) {
|
if (!this.popupWindow) {
|
this.popupWindow = new PopupWindow;
|
}
|
this.popupWindow.show({
|
"title": "免责声明",
|
"width": "749",
|
"height": "654",
|
"parent": this.body
|
});
|
this.popupWindow.setContent('<iframe style="border:none;width:100%;height:100%;" src="../main/disclaimer.html"></div>');
|
});
|
},
|
createPopupWindow: function () {
|
require(["controls/popupwindow/PopupWindow"], function (PopupWindow) {
|
|
});
|
},
|
_onClickMobileMap: function () {
|
AppEvent.dispatchAppEvent(AppEvent.RUN_WIDGET, "MobileMapWidget");
|
},
|
_onClickShixianZhitong: function () {
|
AppEvent.dispatchAppEvent(AppEvent.RUN_WIDGET, "CityExpressWidget");
|
},
|
_onClickZonghe: function () {
|
AppEvent.dispatchAppEvent(AppEvent.RUN_WIDGET, "ThematicWidget");
|
},
|
onSiderButtonClick: function () {//侧边栏隐藏按钮点击事件
|
var tabcontainer = dom.byId("tabcontainer");
|
var siderbutton = dom.byId("siderbutton");
|
if (this._showsider) {
|
domStyle.set(tabcontainer, "display", "none");
|
if ($('#module-side-container').is(':visible')) {
|
domClass.remove(siderbutton, "siderbutton-normal-plus");
|
domClass.add(siderbutton, "siderbutton-shrink-plus");
|
this.siderWidth = 50;
|
} else {
|
domClass.remove(siderbutton, "siderbutton-normal");
|
domClass.add(siderbutton, "siderbutton-shrink");
|
this.siderWidth = 0;
|
}
|
} else {
|
domStyle.set(tabcontainer, "display", "");
|
if ($('#module-side-container').is(':visible')) {
|
domClass.remove(siderbutton, "siderbutton-shrink-plus");
|
domClass.add(siderbutton, "siderbutton-normal-plus");
|
this.siderWidth = 400;
|
} else {
|
domClass.remove(siderbutton, "siderbutton-shrink");
|
domClass.add(siderbutton, "siderbutton-normal");
|
this.siderWidth = 350;
|
}
|
}
|
this._showsider = !this._showsider;
|
this.resize();
|
},
|
onSiderContainerShow: function () {
|
// domStyle.set(dom.byId("tabcontainer"), "left", "50px");
|
domClass.add(dom.byId("siderbutton"), "siderbutton-normal-plus");
|
this.siderWidth += 50;
|
this.resize();
|
},
|
onSiderContainerHide: function () {
|
domStyle.set(dom.byId("tabcontainer"), "left", "0px");
|
this.siderWidth -= 50;
|
this.resize();
|
},
|
onGetLogUser: function (data) {
|
//需要确认权限
|
if (window.parent.LoginManager != undefined && window.parent.LoginManager != null) {
|
this._loader.show("正在获取用户信息...");
|
window.parent.LoginManager.checkLogInfo(dojo.hitch(this, function (userInfo) {
|
this._loader.hide();
|
if (data.callback) {
|
data.callback(userInfo);
|
}
|
}));
|
} else {
|
if (data.callback) {
|
data.callback({
|
status: false,
|
errmsg: "请联系系统管理员,缺少认证模块!"
|
});
|
}
|
}
|
},
|
onMapLoaded: function () {
|
/*setTimeout(function() {
|
var bgDom = dom.byId("loadbg");
|
domConstruct.destroy(bgDom);
|
}, 1000);*/
|
//domStyle.set(dom.byId("siderbutton"), "display", "block");
|
},
|
onMapLoadedError: function (errMsg) {
|
/*setTimeout(function() {
|
var bgDom = dom.byId("loadbg");
|
domConstruct.destroy(bgDom);
|
}, 1000);*/
|
//console.log("加载底图有误"errMsg);
|
},
|
resize: function () {
|
this.headerHeight = 0;
|
domStyle.set(dom.byId("app_content"), "top", this.headerHeight + "px");
|
domStyle.set(dom.byId("app_content"), "height", (win.getBox().h - this.headerHeight) + "px");
|
domStyle.set(dom.byId("mapcontentClass"), "width", (win.getBox().w - this.siderWidth) + "px");
|
// domStyle.set(dom.byId("mapcontentClassBox"), "width", (win.getBox().w - this.siderWidth) + "px");
|
domStyle.set(dom.byId("mapcontentClass"), "left", this.siderWidth + "px");
|
// domStyle.set(dom.byId("mapcontentClassBox"), "left", this.siderWidth + "px");
|
domStyle.set(dom.byId("siderbutton"), "top", ((win.getBox().h - this.headerHeight) / 2 - 45 + this.headerHeight) + "px");
|
AppEvent.dispatchAppEvent(AppEvent.APPLICATION_RESIZE, {});
|
},
|
onFullScreen: function (data) {
|
var siderbutton = dom.byId("siderbutton");
|
if (data.fullscreen) {
|
//调整头部的高度,隐藏侧边框、侧边框收缩按钮、logo和logo顶部的菜单
|
this.headerHeight = 114;
|
this.siderWidth = 0;
|
domStyle.set(tabcontainer, "display", "none");
|
domStyle.set(siderbutton, "display", "none");
|
domStyle.set(dom.byId("logo-top"), "display", "none");
|
domStyle.set(dom.byId("topmenu-right"), "display", "none");
|
domStyle.set(dom.byId("tabbuttonbar"), "display", "none");
|
domStyle.set(dom.byId("topWidgetContainer"), "top", "0px");
|
domStyle.set(query(".logo")[0], "display", "none"); //隐藏tab标签
|
domStyle.set(dom.byId("topWidgetContainer"), "left", "0px"); //顶部widget跟随政区导航移动
|
this._showsider = false;
|
} else {
|
//调整头部的高度,显示侧边框、侧边框收缩按钮、logo和logo顶部的菜单
|
this.headerHeight = 114;
|
this.siderWidth = 350;
|
domStyle.set(tabcontainer, "display", "");
|
domStyle.set(siderbutton, "display", "block");
|
domStyle.set(dom.byId("logo-top"), "display", "block");
|
domStyle.set(dom.byId("topmenu-right"), "display", "block");
|
domStyle.set(dom.byId("tabbuttonbar"), "display", "block"); //显示tab标签
|
domStyle.set(dom.byId("topWidgetContainer"), "top", this.headerHeight - 45 + "px");
|
domStyle.set(query(".logo")[0], "display", "block");
|
//默认打开侧边栏
|
domClass.remove(siderbutton, "siderbutton-shrink");
|
domClass.add(siderbutton, "siderbutton-normal");
|
domStyle.set(dom.byId("topWidgetContainer"), "left", "370px"); //顶部widget移动
|
this._showsider = true;
|
}
|
//重新设置头部的高度
|
domStyle.set(dom.byId("app-header"), "height", this.headerHeight + "px");
|
//domStyle.set(query(".header")[0],"height",this.headerHeight+"px");
|
//通知框架重新计算侧边栏和地图控件的高度
|
this.resize();
|
}
|
});
|
});
|