zengh
2022-05-16 63ad2c3598400370dd7da5534659fd7e768a0a4a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
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: 0,
            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 () {
            },
            _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");
            },
            onSiderContainerShow: function () {
                this.resize();
            },
            onSiderContainerHide: function () {
                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 () {
                AppEvent.dispatchAppEvent(AppEvent.APPLICATION_RESIZE, {});
            },
            onFullScreen: function (data) {
                
                this.resize();
            }
        });
    });