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
/**
 * 纠错按钮
 * 
 * @author haoml
 */
define([ "dojo", "dojo/_base/declare", "base/AppEvent","dojo/_base/lang",
        "controls/toolbar/tools/BaseTool", "dojo/dom-style", "base/ConfigData" ], function(dojo,
        declare, AppEvent, lang, BaseTool, domStyle, ConfigData) {
    var RL = declare([ BaseTool ],
            {
                constructor : function(args) {
                    this._normalIconClass = "tool-errcorrect-normal";
                    this._overIconClass = "tool-errcorrect-over";
                    this._selectedIconClass = "tool-errcorrect-select";
                    this._disableClass = "";
                    this.tooltip = "地图纠错";
                    
                    AppEvent.addAppEventListener(AppEvent.ERRCORRECT_RUN, lang.hitch(this,function(data){
                        this.activate();
                    }));
                    AppEvent.addAppEventListener(AppEvent.ERRCORRECT_CLOSE,lang.hitch(this,function(){
                        this.deactivate();
                    }));
                },
                deactivate : function(args) {
                    this.inherited(arguments);
                    AppEvent.dispatchAppEvent(AppEvent.RUN_WIDGET,
                            "IndexWidget");
                },
                activate : function(args) {
                    if(typeof(ConfigData["userInfo"]) == "undefined" || ConfigData["userInfo"] == ""){
                        alert("请先登录");
                        return;
                    }
                    
                    this.inherited(arguments);
                    AppEvent.dispatchAppEvent(AppEvent.RUN_WIDGET,"ErrCorrectWidget");
                }
            });
    return RL;
});