소스 검색

百度地图增加百度认证账号设置

unknown 5 년 전
부모
커밋
4f45beb2ba

+ 80 - 0
o2web/source/x_component_Attendance/$AddressExplorer/default/css.wcss

@@ -457,5 +457,85 @@
   "checkBox" : {
     "margin-right" : "5px",
     "font-size" : "14px"
+  },
+
+  "formMaskNode": {
+    "width": "100%",
+    "height": "100%",
+    "opacity": 0.6,
+    "position": "absolute",
+    "background-color": "#CCC",
+    "top": "0px",
+    "left": "0px"
+  },
+  "formAreaNode": {
+    "position": "absolute",
+    "opacity": 0,
+    "top": "0px"
+  },
+  "formNode": {
+    "background-color": "#FFF",
+    "width": "80%",
+    "max-width": "600px",
+    "box-shadow": "0px 0px 20px #999",
+    "margin": "auto",
+    "border-radius": "8px",
+    "border": "6px solid #666",
+    "overflow": "hidden"
+  },
+  "formNewNode": {
+    "width": "47px",
+    "height": "47px",
+    "background": "url(../x_component_Template/$Explorer/default/icon/new.png) no-repeat"
+  },
+  "formIconNode": {
+    "width": "47px",
+    "height": "47px"
+  },
+  "formEditNode": {
+    "width": "47px",
+    "height": "47px"
+  },
+  "formFormNode": {
+    "border-radius": "8px",
+    "border": "0px solid #666",
+    "width": "70%",
+    "margin": "auto",
+    "font-size": "16px",
+    "color": "#666",
+    "font-family": "Microsoft YaHei"
+  },
+  "formOkActionNode": {
+    "height": "30px",
+    "width": "85px",
+    "cursor": "pointer",
+    "float": "right",
+    "line-height": "30px",
+    "padding-left": "65px",
+    "font-size": "16px",
+    "font-family": "Microsoft YaHei",
+    "border-radius": "3px",
+    "border": "1px solid #354f67",
+    "color": "#FFF",
+    "margin-right": "20px",
+    "margin-top": "20px",
+    "box-shadow": "0px 0px 0px #666",
+    "background": "url(../x_component_Template/$Explorer/default/icon/editOk_bg.png) no-repeat"
+  },
+  "formCancelActionNode": {
+    "height": "30px",
+    "width": "60px",
+    "cursor": "pointer",
+    "float": "right",
+    "line-height": "30px",
+    "padding-left": "40px",
+    "font-size": "16px",
+    "font-family": "Microsoft YaHei",
+    "border-radius": "3px",
+    "color": "#FFF",
+    "margin-top": "20px",
+    "box-shadow": "0px 0px 0px #666",
+    "border": "1px solid #999",
+    "background": "url(../x_component_Template/$Explorer/default/icon/editCancel_bg.png) no-repeat"
   }
 }

+ 3 - 1
o2web/source/x_component_Attendance/$AddressExplorer/toolbar.json

@@ -14,11 +14,13 @@
   },{
   "id": "wpContent",
   "styles" : "toolbarContent"
+  },{
+    "styles" : "toolbarSep"
   },
   {
     "title": "设置百度开发者认证",
     "text" : "设置工作场所需要用到百度开发者认证",
-    "id": "1.1",
+    "id": "2.1",
     "action": "setBiduAccount",
     "icon": "create.png",
     "expand": false,

+ 29 - 22
o2web/source/x_component_Attendance/AddressExplorer.js

@@ -1,5 +1,6 @@
 MWF.xDesktop.requireApp("Attendance", "Explorer", null, false);
 MWF.xDesktop.requireApp("Template", "Explorer", null, false);
+o2.require("MWF.widget.UUID", null, false);
 MWF.xApplication.Attendance.AddressExplorer = new Class({
     Extends: MWF.xApplication.Attendance.Explorer,
     Implements: [Options, Events],
@@ -56,7 +57,8 @@ MWF.xApplication.Attendance.AddressExplorer = new Class({
 
     },
     setBiduAccount: function(){
-
+        var baiduAccountForm = new MWF.xApplication.Attendance.AddressExplorer.BaiduAccountForm( this );
+        baiduAccountForm.edit();
     },
     reloadList: function(){
         this.actions.listWorkplace( function(json){
@@ -68,7 +70,7 @@ MWF.xApplication.Attendance.AddressExplorer = new Class({
         this.wdList = new Element("div", {
             styles : this.css.wdList
         }).inject( this.wpContent );
-        this.wdList.setStyle( "width" , this.toolbarNode.getSize().x - 200 + "px" );
+        this.wdList.setStyle( "width" , this.toolbarNode.getSize().x - 370 + "px" );
 
         data.each( function( d ){
             var placeItem = new Element( "div", {
@@ -113,7 +115,7 @@ MWF.xApplication.Attendance.AddressExplorer = new Class({
         }
     },
     _setContentSize: function(){
-        this.wdList.setStyle( "width" , this.toolbarNode.getSize().x - 200 + "px" );
+        this.wdList.setStyle( "width" , this.toolbarNode.getSize().x - 370 + "px" );
     },
     openList : function( e ){
         this.arrow = "down";
@@ -158,17 +160,20 @@ MWF.xApplication.Attendance.AddressExplorer.BaiduMap = new Class({
             height : "99%"
         }}).inject(this.container);
         setTimeout( function(){
-            this.loadResource( );
+            MWF.UD.getPublicData("baiduAccountKey", function (json) {
+                this.loadResource(null, json );
+            }.bind(this))
         }.bind(this) , 200 )
     },
-    loadResource: function (callback) {
+    loadResource: function (callback, ak) {
         window.BMap_loadScriptTime = (new Date).getTime();
         //var apiPath = "http://api.map.baidu.com/api?v=2.0&ak=Qac4WmBvHXiC87z3HjtRrbotCE3sC9Zg";
         var apiPath;
+        var accountkey = ak || "Qac4WmBvHXiC87z3HjtRrbotCE3sC9Zg";
         if( window.location.protocol.toLowerCase() === "https" ){
-            apiPath = "https://api.map.baidu.com/getscript?v=2.0&ak=Qac4WmBvHXiC87z3HjtRrbotCE3sC9Zg&services=&t=20161219171637";
+            apiPath = "https://api.map.baidu.com/getscript?v=2.0&ak="+accountkey+"&services=&t=20161219171637";
         }else{
-            apiPath = "http://api.map.baidu.com/getscript?v=2.0&ak=Qac4WmBvHXiC87z3HjtRrbotCE3sC9Zg&services=&t=20161219171637";
+            apiPath = "http://api.map.baidu.com/getscript?v=2.0&ak="+accountkey+"&services=&t=20161219171637";
         }
         if( !window.BDMapApiLoaded ){
             COMMON.AjaxModule.loadDom(apiPath, function () {
@@ -445,7 +450,6 @@ MWF.xApplication.Attendance.AddressExplorer.BaiduMap = new Class({
 MWF.xApplication.Attendance.AddressExplorer.BaiduAccountForm = new Class({
     Extends: MWF.xApplication.Attendance.Explorer.PopupForm,
     _createTableContent: function(){
-
         var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+
             "<tr><td colspan='2' styles='formTableHead'>百度开发者认证</td></tr>" +
             "<tr>" +
@@ -462,21 +466,24 @@ MWF.xApplication.Attendance.AddressExplorer.BaiduAccountForm = new Class({
             "</table>";
         this.formTableArea.set("html",html);
 
-        MWF.xDesktop.requireApp("Template", "MForm", function(){
-            this.form = new MForm( this.formTableArea, {ak : layout.desktop.session.user.distinguishedName }, {
-                isEdited : true,
-                itemTemplate : {
-                    ak : {  "text" : "密钥" }
-                }
-            }, this.app );
-            this.form.load();
-        }.bind(this), true);
-
+        MWF.UD.getPublicData("baiduAccountKey", function (json) {
+            debugger;
+            MWF.xDesktop.requireApp("Template", "MForm", function(){
+                this.form = new MForm( this.formTableArea, {ak : json || "" }, {
+                    isEdited : true,
+                    itemTemplate : {
+                        ak : {  "text" : "密钥" }
+                    }
+                }, this.app );
+                this.form.load();
+            }.bind(this), true);
+        }.bind(this))
     },
     _ok: function( data, callback ){
-        this.app.restActions.exportSelfHoliday( data.startDate, data.endDate, function(json){
-            if( callback )callback(json);
-        }.bind(this) );
-        this.close();
+        debugger;
+        MWF.UD.putPublicData("baiduAccountKey",  data.ak, function (json) {
+            if(callback)callback();
+            this.close();
+        }.bind(this));
     }
 });