var basepath = window["p_basepath"] || ""; var loadinghtml = '
加载中...
'; base = { local:function(){ return base.cookie("local") || 'zh'; }, //控制台日志记录 logger : { log:function(msg){ if(!!window.console){ window.console.log(msg); } }, info:function(msg){ if(!!window.console){ window.console.info(msg); } }, warn:function(msg){ if(!!window.console){ window.console.warn(msg); } }, error:function(msg){ if(!!window.console){ window.console.error(msg); } //base.logger.log2server(" [error] " + msg); } , log2server:function(content){ //base.ajax.post(window["p_basepath"] + "/service/behaviorlog/record",true,{ // info:"[web] "+ content //},"json", function(){},function(){}); } }, handleuri : function(uri){ return uri; } }; base.dialog = { _mask_classid:"_mask_classid", _zindex:100, _getzindex:function(){ return base.dialog._zindex++; }, //显示遮罩 // .blank{ position:fixed; background:#000000; width:100%; height:100%; z-index:1; display:none; // filter:alpha(opacity=30); /*ie滤镜,透明度50%*/ // -moz-opacity:0.3; /*firefox私有,透明度50%*/ // opacity:0.3;/*其他,透明度50%*/} showmask:function(zindex){ // if($("."+base.dialog._mask_classid,document.body).length == 0){ var mask = $("
", { "class":base.dialog._mask_classid, css: { "position": "fixed", "background": "#000000", "width": "100%", "height": "100%", "z-index": zindex || 999, "filter": "alpha(opacity=30)", /*ie滤镜,透明度50%*/ "-moz-opacity": 0.3, /*firefox私有,透明度50%*/ "opacity": 0.3/*其他,透明度50%*/ } }); $(document.body).prepend(mask); // }else{ // $("."+base.dialog._mask_classid,document.body).show(); // } }, hidemask:function(){ var $masks = $("."+base.dialog._mask_classid, document.body); var $currentmask = null; for(var i= 0,len=$masks.length; i < len; i++){ if($currentmask == null){ $currentmask = $($masks[i]); }else if(parseint($currentmask.css("z-index")) < parseint($($masks[i]).css("z-index"))){ $currentmask = $($masks[i]); } } if($currentmask != null){ $currentmask.remove(); } }, /** * 加载内容 * @param uri 请求uri * @param params {} * @param callback 回调函数 */ openhtml:function(uri, params, callback, choicecls){ uri = base.handleuri(uri); var $loadcontainer = $(".loadhtml_classid",document.body); if($loadcontainer.length == 0){ $(document.body).append($("
", { "class": "loadhtml_classid", css: { clear: "both", height: "0px", "overflow": "hidden"} })); $loadcontainer = $(".loadhtml_classid",document.body); } if($("."+choicecls, $loadcontainer).length > 0){ $("."+choicecls, $loadcontainer).remove(); } var uricontainer = $("
", {"class":"_container " + choicecls, css:{display:"none"}}); uricontainer.data("uri", uri); uricontainer.data("params", params); $loadcontainer.append(uricontainer); base.dialog.showmask(base.dialog._getzindex()); base.tip.showloading($(document.body), true); base.ajax.load(uri, params, function(){ base.tip.showloading($(document.body), false); uricontainer.css("z-index", base.dialog._getzindex()); uricontainer.show(); if (callback) { callback.call(this); } }, uricontainer); }, closehtml:function(choicecls){ base.dialog.hidemask(); var $loadcontainer = $(".loadhtml_classid",document.body); if($("."+choicecls, $loadcontainer).length > 0){ $("."+choicecls, $loadcontainer).remove(); } }, /** * 打开iframe * @param url * @param choicecls * @param config {width, height} */ openiframe: function (url, choicecls, config) { url = base.handleuri(url); config = config || {width:400, height:260}; var $loadcontainer = $(".loadiframe_classid",document.body); if($loadcontainer.length == 0){ $(document.body).append($("
", { "class": "loadiframe_classid", css: { clear: "both", height: "0px", "overflow": "hidden"} })); $loadcontainer = $(".loadiframe_classid",document.body); } if($("iframe."+choicecls, $loadcontainer).length > 0){ $("iframe."+choicecls, $loadcontainer).remove(); } base.tip.showloading($(document.body), true); var height = parseint(config.height); var width = parseint(config.width); var top = "-" + parseint(height/2) + "px"; var left = "-" + parseint(width/2) + "px"; var iframecontainer = $("