提交 9b790e98 编写于 作者: 蔡祥熠

Merge branch 'fix/Attandence.baidu_account' into 'wrdp'

Merge of fix/Attandence.baidu_account 考勤工作场所增加百度认证账号设置 to wrdp

See merge request o2oa/o2oa!2167
......@@ -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"
}
}
\ No newline at end of file
......@@ -14,5 +14,18 @@
},{
"id": "wpContent",
"styles" : "toolbarContent"
},{
"styles" : "toolbarSep"
},
{
"title": "设置百度开发者认证",
"text" : "设置工作场所需要用到百度开发者认证",
"id": "2.1",
"action": "setBiduAccount",
"icon": "create.png",
"expand": false,
"position" : "right",
"styles" : "toolbarItemRightNode",
"sub": []
}
]
\ No newline at end of file
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],
......@@ -55,6 +56,10 @@ MWF.xApplication.Attendance.AddressExplorer = new Class({
}.bind(this));
},
setBiduAccount: function(){
var baiduAccountForm = new MWF.xApplication.Attendance.AddressExplorer.BaiduAccountForm( this );
baiduAccountForm.edit();
},
reloadList: function(){
this.actions.listWorkplace( function(json){
this.wpContent.empty();
......@@ -65,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", {
......@@ -110,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";
......@@ -155,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 () {
......@@ -438,3 +446,44 @@ 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>" +
" <td styles='formTableValue' colspan='2'>工作场所设置使用了百度地图开放平台的服务,你可以注册百度开发者认证来提高地图的并发量。认证完成后,请将密钥填至下方的输入框。</td>"+
"</tr>" +
"<tr>" +
" <td styles='formTableValue' colspan='2'><a href='http://lbsyun.baidu.com/apiconsole/auth' target='_blank'>点击此打开认证通道</a></td>"+
"</tr>" +
"<tr>" +
" <td styles='formTableTitle' lable='ak'></td>"+
" <td styles='formTableValue' item='ak'></td>"+
//" <td styles='formTableValue' item='action'></td>"+
"</tr>" +
"</table>";
this.formTableArea.set("html",html);
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 ){
debugger;
MWF.UD.putPublicData("baiduAccountKey", data.ak, function (json) {
if(callback)callback(json);
// this.close();
}.bind(this));
}
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册