标签:
baseTools.js
var _BaseTools = { showid : function(idname) { var isIE = (document.all) ? true : false; var isIE6 = isIE && !window.XMLHttpRequest; var newbox = document.getElementById(idname); newbox.style.zIndex = "9999999"; newbox.style.display = "block"; newbox.style.position = !isIE6 ? "fixed" : "absolute"; newbox.style.top = newbox.style.left = "50%"; newbox.style.marginTop = -newbox.offsetHeight / 2 + "px"; newbox.style.marginLeft = -newbox.offsetWidth / 2 + "px"; var layer = document.createElement("div"); layer.id = "layer"; layer.style.width = layer.style.height = "100%"; layer.style.position = !isIE6 ? "fixed" : "absolute"; layer.style.top = layer.style.left = 0; layer.style.backgroundColor = "#888"; layer.style.zIndex = "9999998"; layer.style.opacity = "0.6"; document.body.appendChild(layer); function layer_iestyle() { layer.style.width = Math.max(document.documentElement.scrollWidth, document.documentElement.clientWidth) + "px"; layer.style.height = Math.max( document.documentElement.scrollHeight, document.documentElement.clientHeight) + "px"; } function newbox_iestyle() { newbox.style.marginTop = document.documentElement.scrollTop - newbox.offsetHeight / 2 + "px"; newbox.style.marginLeft = document.documentElement.scrollLeft - newbox.offsetWidth / 2 + "px"; } if (isIE) { layer.style.filter = "alpha(opacity=60)"; } if (isIE6) { layer_iestyle(); newbox_iestyle(); window.attachEvent("onscroll", function() { newbox_iestyle(); }); window.attachEvent("onresize", layer_iestyle); } }, setErrorMessage : function(code, desc) { if (code != null && code != "") { $("#wrongTc div.wrong_tc_l").children(‘span‘).html("错误编码" + code); } if (desc != null) { $("#wrongTc div.wrong_tc_r").children(‘p‘).html(desc); } }, checkErrorMessage : function() { var c = $("#wrongTc div.wrong_tc_r").children(‘p‘).html(); if (c != null && c != "") { return true; } return false; }, // 未登录加载温馨提示 loadReminderNotLogin : function(province) { var prefix = "/e3/reminder2"; var channel = "111000002"; // 读导航实现 var menuid = _BaseTools.getNaviId(); var url = prefix + "/" + channel + "/" + province + "/" + menuid + "/112/1.html?=" + (new Date()).getTime(); $("#reminderdd").load(url, function(response, status) { if ("success" == status) { if ($("#reminderdd").html() != "") { $("#reminderli").show(); } else { $("#reminderli").hide(); } }else{ $("#reminderli").hide(); $("#ShowContent2").hide(); } }); }, // 登陆后载温馨提示 loadReminderLogin : function(province, nettype, paytype) { var prefix = "/e3/reminder2"; var channel = "111000002"; // 读导航实现 var menuid = _BaseTools.getNaviId(); var url = prefix + "/" + channel + "/" + province + "/" + menuid + "/" + nettype + paytype + "/1.html?=" + (new Date()).getTime(); $("#reminderdd").load(url, function(response, status) { if ("success" == status) { if ($("#reminderdd").html() != "") { $("#reminderli").show(); } } else { $("#reminderli").hide(); } }); }, loadSuccess : function(message) { if (message != null) { $("#transmessage").html(message); } }, getThreeProvinceCodeFromCookie : function()// 获取cookie中三位省份编码 { var provinceAndCityCode = jQuery.cookie("mallcity"); var provinceCode = provinceAndCityCode.split("|")[0]; return "0" + provinceCode; }, getEightProvinceCodeFromCookie : function()// 获取cookie中八位省份编码 { var provinceAndCityCode = jQuery.cookie("mallcity"); var provinceCode = provinceAndCityCode.split("|")[0]; return scommondqry.scommondqry[provinceCode]; }, loading_url_menuId : function() { // 根据页面解析导航的menuId var partUrl = GetParam.getUrlNoParameter();// 获取除掉?和参数之外的路径 $("#in_login_menu").find("a").each( function() { if ($(this).attr("href") != null && $(this).attr("href").indexOf(partUrl) >= 0) { getMenuId = $(this).attr("id"); if (getMenuId == "" && getMenuId == null && getMenuId == undefined) { } else { $.cookie(‘MII‘, $(this).attr(‘id‘),{ path: ‘/‘,domain:‘10010.com‘}); } } }); }, loadImgAndDescription : function() { // 业务图标和描述显示 var thisMenuId = _BaseTools.getNaviId(); $("#showBusiDesc").html($("#des_" + thisMenuId ).html()); $("#showBusiImg").attr("src", $("#img_"+ thisMenuId).text()); }, userAppraise : function() { var url = E3CommonsVariables.RequestPrefix() + "/transact/publishappraise/?_=" + new Date().getTime(); var score = $("#bizscore").children("span[class=‘on‘]").length; var content = null; if (score > 2) { content = $("#reviewcontent").val(); } else { var idx = $("#userappraise").children("li[class=‘on‘]").index(); if (idx != 3) { content = $("#userappraise").children("li[class=‘on‘]").text(); } else { content = $("#reviewcontent").val(); } } $.ajax({ url : url, data : { reviewcontent : content, score : $("#bizscore").children("span[class=‘on‘]").length, busCode : _BaseTools.getNaviId() }, type : "POST", dataType : "json", success : function(data) { window.location.reload(true); } }); },// 分享方法 share : function(type, content) { var link = ‘‘; switch (type) { // 新浪 case ‘sina‘: link = ‘http://v.t.sina.com.cn/share/share.php?&url={url}&title={title}&pic={pic:|}‘; break; // qq微博 case ‘qqt‘: link = ‘http://v.t.qq.com/share/share.php?title={title}&url={url}&pic={pic:|}‘; break; // 人人网 case ‘renren‘: link=‘http://widget.renren.com/dialog/share?resourceUrl={url}&title={title}&pic={pic:|}‘; break; // qq空间 case ‘qzone‘: link = ‘http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={url}&title={title}&pics={pic:|}‘; break; // souhu case ‘souhu‘: link = ‘http://t.sohu.com/third/post.jsp?content=utf-8&url={url}&title={title}&pic={pic:|}‘; break; // kaixin case ‘kaixin‘: link=‘http://www.kaixin001.com/repaste/share.php?rtitle={title}&rurl={url}&rcontent={title}&pic={pic:|}‘; break; // douban case ‘douban‘: link = ‘http://www.douban.com/share/service?image=&href={url}&name={title}‘; break; } // $(‘img‘).each(function(i, n) { // pics.push(n.src); // }); if (content) { if (content.length > 200) { content = content.substring(0, 200); } link = link.replace(‘{title}‘, encodeURIComponent(content)); } else { link = link .replace( ‘{title}‘, encodeURIComponent(‘新版中国联通网上营业厅 ,速度更快,功能更全,服务更贴心,还有各种优惠活动,快去体验一下吧。‘)); } link = link.replace(‘{url}‘, ‘http://www.10010.com‘); link = link .replace(‘{pic:|}‘, ‘http://res.mall.10010.com/mall/front/images/logo.png?resVer=20120817000102‘); window.open(link); }, // 获取导航id getNaviId : function() { return $.cookie(‘MII‘); }, isLoginNoshow : function() { //检查是否登录 var isLogin = myLoginObj.isLogin; //没登陆发送请求 if(!isLogin){ isLogin = myLoginObj.sendRequest(); } return isLogin; }, // 检查登录,针对多弹层 isLogin : function() { if (this.isLoginNoshow()) { return true; } else { jQuery(‘#login_iframe‘).attr(‘src‘,‘http://uac.10010.com/portal/hallLogin‘); var pathName=window.document.location.pathname; if (pathName.indexOf("/e3/internationl_roaming") != -1) { return false; } _BaseTools.showid(‘login_footer‘); return false; } }, // 显示登录框 showLoginframe : function() { var url = E3CommonsVariables.RequestPrefix() + "/check/checklogin/?_=" + new Date().getTime(); $.ajax({ url : url, async : false, data : {}, type : "POST", dataType : "json", success : function(data) { if (data != null && !data.isLogin) { //测试:统一认证提供改造后的测试环境,该测试环境连接生产接口支撑4G固网路由 //jQuery(‘#login_iframe‘).attr(‘src‘,‘http://authtest.uac.10010.com/portal/hallLogin‘); // 测试 //jQuery(‘#login_iframe‘).attr(‘src‘,‘http://authdev.uac.10010.com/portal/popLogin‘); // 生产 jQuery(‘#login_iframe‘).attr(‘src‘,‘http://uac.10010.com/portal/hallLogin‘); _BaseTools.showid(‘login_footer‘); } } }); }, // 判断是不是固网 isFixNum : function(netType) { var isnetType = false; if (netType == "03" || netType == "04" || netType == "05" || netType == "06") { isnetType = true; } return isnetType; }, //加载查询错误提示 loadQueryErrorMessage:function(id,code,message){ var ErrorOject=new Object(); if(code == ‘2114030172‘ || code == ‘2114030166‘ || code == ‘2114030170‘ || code == ‘2114030167‘){ ErrorOject.errorCode = ‘编码‘+code; ErrorOject.errorDesc = message; QueryMain.processTemplateData("#"+id,"queryErrorTemplate_special",ErrorOject); return; } if(code != null){ ErrorOject.errorCode="错误编码"+code; } ErrorOject.errorDesc = message; QueryMain.processTemplateData("#"+id,"queryErrorTemplate",ErrorOject); }, //加载错误查询提示(对象) queryErrorMessageObj:function(id,data){ this.loadQueryErrorMessage(id,data.errorMessage.respCode,data.errorMessage.respDesc); }, /* *校验身份证号 */ checkIdcard:function(idcard) { var Errors = new Array( "验证通过", "身份证号码位数不对", "身份证号码出生日期超出范围或含有非法字符", "身份证号码校验位错误", "身份证地区非法", "身份证输入字符类型不对,允许输入15位数字、18位数字、17位数字加最后一位X三种" ); var certTypeReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; //身份证正则表达式 var area = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外" }; var Y, JYM; var S, M; var idcard_array = new Array(); idcard=$.trim(idcard); idcard_array = idcard.split(""); if(idcard.length!=15 && idcard.length!=18){ return Errors[1]; } if(!certTypeReg.test(idcard)){ return Error[5]; } //地区检验 if (area[parseInt(idcard.substr(0, 2))] == null) return Errors[4]; //身份号码位数及格式检验 switch (idcard.length) { case 15: if ((parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0 || ((parseInt(idcard.substr(6, 2)) + 1900) % 100 == 0 && (parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0)) { ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/; //测试出生日期的合法性 } else { ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/; //测试出生日期的合法性 } if (ereg.test(idcard)) return "OK";//Errors[0]; else return Errors[2]; break; case 18: //18位身份号码检测 //出生日期的合法性检查 //闰年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9])) //平年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8])) if (parseInt(idcard.substr(6, 4)) % 4 == 0 || (parseInt(idcard.substr(6, 4)) % 100 == 0 && parseInt(idcard.substr(6, 4)) % 4 == 0)) { ereg = /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$/; //闰年出生日期的合法性正则表达式 } else { ereg = /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$/; //平年出生日期的合法性正则表达式 } if (ereg.test(idcard) && _BaseTools.checkBirthDay(idcard)) {//测试出生日期的合法性 //计算校验位 S = (parseInt(idcard_array[0]) + parseInt(idcard_array[10])) * 7 + (parseInt(idcard_array[1]) + parseInt(idcard_array[11])) * 9 + (parseInt(idcard_array[2]) + parseInt(idcard_array[12])) * 10 + (parseInt(idcard_array[3]) + parseInt(idcard_array[13])) * 5 + (parseInt(idcard_array[4]) + parseInt(idcard_array[14])) * 8 + (parseInt(idcard_array[5]) + parseInt(idcard_array[15])) * 4 + (parseInt(idcard_array[6]) + parseInt(idcard_array[16])) * 2 + parseInt(idcard_array[7]) * 1 + parseInt(idcard_array[8]) * 6 + parseInt(idcard_array[9]) * 3; Y = S % 11; M = "F"; JYM = "10X98765432"; M = JYM.substr(Y, 1); //判断校验位 if (M == idcard_array[17]) return "OK";//Errors[0]; //检测ID的校验位 else return Errors[3]; } else return Errors[2]; break; default: return Errors[1]; break; } }, //检查身份证出生日期 checkBirthDay:function(card){ var timeStr=card.substring(6,14); var month=parseInt(timeStr.substring(4,6))-1; var cardDate=new Date(timeStr.substring(0,4),month,timeStr.substring(6,8)); var currDate=new Date(); if(cardDate.getTime()>currDate.getTime()){ return false; }else{ return true; } }, // 将参数值为0,0元,0元/月,0元/日,纯文字保留数字去掉文字 replaceData:function(fee){ if (( (fee.substr(-3) == "元/月") && (fee.indexOf("元/月") > -1)) || ((fee.substr(-3) == "元/日") && (fee.indexOf("元/日") > -1)) || ((fee.substr(-1) == "元") && (fee.indexOf("元") > -1))){ fee = fee.replace("元/月",""); fee = fee.replace("元/日",""); fee = fee.replace("元",""); } return fee; } }; var myLoginObj = { isLogin :false, sendRequest:function(){ var url = E3CommonsVariables.RequestPrefix() + "/check/checklogin/?_=" + new Date().getTime(); $.ajax({ url : url, async : false, data : {}, type : "POST", dataType : "json", success : function(data) { if (data != null && data.isLogin) { myLoginObj.isLogin = true; } } }); return this.isLogin; } }; var chartTool = { getPrecent : function(array, maxdivheight) { if (array != null) { // 取得最大值 var maxNum = Math.max.apply(Math, array); var arr = new Array(array.length); jQuery.each(array, function(idx, rst) { arr[idx] = (array[idx] / maxNum) * maxdivheight; }); return arr; } return null; } }; var ImgCode = { img : function(imgId) { if(imgId!="" && imgId!=null && imgId!=undefined){ jQuery("#"+imgId).src = "/e3/sinova.jsp"; var imgSrc = jQuery("#"+imgId); var src = imgSrc.attr("src"); imgSrc.attr("src", ImgCode.chgUrl(src)); }else{ jQuery("#_img").src = "/e3/sinova.jsp"; var imgSrc = jQuery("#_img"); var src = imgSrc.attr("src"); imgSrc.attr("src", ImgCode.chgUrl(src)); } }, chgUrl : function(url) { var timestamp = (new Date()).valueOf(); url = url + "?timestamp=" + timestamp; return url; } }; // 三位省份编码和八位省份编码的对应关系 var scommondqry = { "scommondqry" : { "13" : "00010003", "76" : "00010023", "31" : "00010002", "74" : "00010017", "59" : "00010014", "70" : "00010020", "17" : "00010016", "90" : "00010012", "86" : "00010026", "79" : "00010032", "83" : "00010010", "88" : "00010028", "34" : "00010008", "87" : "00010030", "84" : "00010015", "91" : "00010011", "75" : "00010022", "18" : "00010025", "50" : "00010005", "97" : "00010013", "51" : "00010004", "19" : "00010018", "30" : "00010019", "71" : "00010024", "10" : "00010029", "89" : "00010021", "85" : "00010027", "81" : "00010009", "36" : "00010007", "38" : "00010006", "11" : "00010001" } }; var CurrentCityUtil = { city : function () { var mallcity = jQuery.trim(jQuery.cookie("mallcity")); var provinceCode = "0"+mallcity.split("|")[0]; return provinceCode; } }; /** * 公告活动 */ var NoticeAndActivity = { msgUrl : function (id,placeDivId,areaId) { return "http://m1.ad.10010.com/noticeMag/ad/simpleAdvertise.ad?id="+id+"&sysid=WT&placeDivId="+placeDivId+"&areaid="+areaId+"&_="+(new Date()).getTime();; }, notice : function () { if ( jQuery("#_noticeMsgId").length > 0 ) { var provinceCode = CurrentCityUtil.city(); var cx =NoticeAndActivity.msgUrl("WT_NT_001", "_noticeMsgId", provinceCode); jQuery.getScript(cx,function(){}); } }, activity : function () { if ( jQuery("#_activityMsgId").length > 0 ) { var provinceCode = CurrentCityUtil.city(); var cx =NoticeAndActivity.msgUrl("WT_NT_002", "_activityMsgId", provinceCode); jQuery.getScript(cx,function(){}); } } }; function printdiv(printpage){ window.open(window.location.pathname); /* window.open(window.location.pathname);*/ var style = "<style>.score_text_dl dd {float: left;width: 232px;text-align: left;line-height: 18px;font-family: ‘微软雅黑‘;}" + ".score_text_dl {float: left;font-size: 16px;color: #333;padding-bottom: 16px;width: 398px;text-align: center;overflow: hidden;}</style>"; //style=""; var headstr = "<html><head><title></title>"+style+"</head><body>"; var footstr = "</body></html>"; var newstr = $("#"+printpage).html(); //获得 div 里的所有 html 数据 var oldstr = document.body.innerHTML; document.body.innerHTML = headstr+newstr+footstr; window.print(); document.body.innerHTML = oldstr; //window.opener.location.reload(); //window.parent.document.close(); window.parent.close(); return true; } jQuery(document).ready(function() { NoticeAndActivity.notice(); NoticeAndActivity.activity(); });
commonsBase.js var radomT = "?_=" + (new Date()).getTime(); document.domain = "10010.com"; //zhaohailong start 2015/02/10 //记录loadding蒙层标示 var flag = "0"; //记录个别业务加载loadding蒙层(信息总览、升级4G组合套餐、3G流量包) var recordFlag = undefined; //加载次数记录 当第一次加载完成后,记录reqFlag为1,当第二次加载时,这时候记录reqFlag为2 var commonReqFlag = "1"; //记录加载次数 当第一次加载完成后,记录reqFlag为1,当第二次加载时,这时候记录reqFlag为2 zhaohailong 2015/02/10 var headerReqFlag = "1"; //zhaohailong end var wt2BaseCommon = { loginSuccess : function() { $(‘#login_iframe‘).removeAttr(‘src‘); CommonMain.loadData("/l",null,‘Login.on(data)‘); } }; var mallWebBaseCommon = { loginSuccess : function() { $(‘#login_iframe‘).removeAttr(‘src‘); CommonMain.loadData("/l",null,‘Login.on(data)‘); } }; String.prototype.endWith=function(s){ if(s==null||s==""||this.length==0||s.length>this.length) return false; if(this.substring(this.length-s.length)==s) return true; else return false; return true; }; var Login={ on:function(data){ if(data.result){ //如果是邮箱登录,未绑定手机号码 if(data.binding){ $(‘#login_footer‘).hide(); _BaseTools.showid("bondingArry"); //window.location.href= E3CommonsVariables.BindingPage(); }else{ if(window.location.href.indexOf(‘/e3/index.html‘) !=-1 || window.location.href.endWith(‘/e3/‘)){ if("12" ==data.nettype|| "13" ==data.nettype|| "14" ==data.nettype|| "03" ==data.nettype|| "04" ==data.nettype|| "05" ==data.nettype){ window.location.href=‘/e3/query/personal_xx.html‘; }else{ window.location.href=‘/e3/index_server.html‘; } }else{ $(‘#login_footer‘).hide(); $(‘div#layer‘).remove(); window.location.reload(true); } } } else { var message = "登录失败,请稍后再试。"; _BaseTools.setErrorMessage("", message); _BaseTools.showid(‘wrongTc‘); } } }; /** * 获取URL请求参数 */ var GetParam = { getURLParameter : function(name) { return decodeURIComponent((new RegExp(‘[?|&]‘ + name + ‘=‘ + ‘([^&;]+?)(&|#|;|$)‘).exec(window.location.search) || [ , "" ])[1] .replace(/\+/g, ‘%20‘)) || null; }, getParamsByMonth : function() { return GetParam.getURLParameter("monthDate"); },getUrlNoParameter:function(){ var thisurl =window.location.href; var indexOfUrlAfter=thisurl.indexOf("?"); var partUrl=""; if(indexOfUrlAfter==-1){ partUrl=thisurl; }else { partUrl= thisurl.substring(0,indexOfUrlAfter); } return partUrl; } }; /** * This is Commons Variables For e3 * * Can be expanded as needed */ var E3CommonsVariables = { // Unified request prefix RequestPrefix : function() { return "/e3/static"; }, RequestPrefixCommon : function() { return "/e3/static/common"; }, RequestPrefixQuery : function() { return "/e3/static/query"; }, RequestPrefixTran : function() { return "/e3/static/transact"; }, RequestPrefixLife : function() { return "/e3/static/life"; }, BindingPage:function(){ return "/e3/query/binding_number.html"; } }; var theBaseMain={ loadData : function(argUrl, paramdata, fun) { if(!_BaseTools.isLogin()){ return; } var url = E3CommonsVariables.RequestPrefix() + argUrl + "?_=" + (new Date()).getTime(); jQuery.ajax({ url : url, type : "POST", data : paramdata, async : true, dataType : "JSON", contentType : "application/x-www-form-urlencoded;charset=UTF-8", complete : closeMask, success : function(data) { if (null != data && "" != data) { // if (null != data.versionValidate) { // if (data.versionValidate.forward) { // window.location.href=data.versionValidate.url; // return; // } // } if (null != data.acclimit) { if ("true"==data.acclimit) { window.location.href="/e3/query/baocuo3.html"; return; } } if( data.ipValidate != null ){ window.location.href="/e3/ipbaocuo.html"; return; } } eval(fun); } }); }, // 处理数据,加载jstemplate模板 processTemplateData : function(show, templateId, data) { $(show).setTemplateElement(templateId).processTemplate(data); } }; var searchMain={ loadData : function(argUrl, paramdata, fun) { var url = E3CommonsVariables.RequestPrefix() + argUrl + "?_=" + (new Date()).getTime(); jQuery.ajax({ url : url, type : "POST", data : paramdata, async : true, dataType : "JSON", contentType : "application/x-www-form-urlencoded;charset=UTF-8", complete : closeMask, success : function(data) { if (null != data.acclimit) { if ("true"==data.acclimit) { window.location.href="/e3/query/baocuo3.html"; return; } } if (null != data && "" != data) { if( data.ipValidate != null ){ window.location.href="/e3/ipbaocuo.html"; return; } } eval(fun); }, error:function(){ $("#queryError").show(); var obj =new Object(); obj.errorMessage=new Object(); obj.errorMessage.respCode=""; obj.errorMessage.respDesc="尊敬的客户,由于同一时间使用该业务人数较多,暂时无法为您提供服务,为您带来的不便敬请谅解。"; _BaseTools.queryErrorMessageObj("queryError",obj); } }); }, // 处理数据,加载jstemplate模板 processTemplateData : function(show, templateId, data) { $(show).setTemplateElement(templateId,null, {filter_data : false}).processTemplate(data); } }; var CommonMain = { loadData : function(argUrl, paramdata, fun) { var menuid = jQuery("#menu_right_top").find("li[class=‘on‘]").children( "a").attr("id"); radomT = "?_=" + (new Date()).getTime(); var url = E3CommonsVariables.RequestPrefixCommon() + argUrl + radomT; if (menuid != undefined) { url += "&menuid=" + menuid; } jQuery.ajax({ url : url, type : "POST", data : paramdata, async : true, dataType : "JSON", contentType : "application/x-www-form-urlencoded;charset=UTF-8", complete : closeMask, success : function(data) { if (null != data && "" != data) { /* if (null != data.versionValidate) { if (data.versionValidate.forward) { window.location.href=data.versionValidate.url; return; } }*/ if (null != data.acclimit) { if ("true"==data.acclimit) { window.location.href="/e3/query/baocuo3.html"; return; } } if( data.ipValidate != null ){ window.location.href="/e3/ipbaocuo.html"; return; } } eval(fun); } }); }, // 处理数据,加载jstemplate模板 processTemplateData : function(show, templateId, data) { $(show).setTemplateElement(templateId).processTemplate(data); } }; var QueryMain = { loadData : function(argUrl, paramdata, fun) { if(!_BaseTools.isLogin()){ return; } var menuid = _BaseTools.getNaviId(); /*var menuid = jQuery("#menu_right_top").find("li[class=‘on‘]").children( "a").attr("id");*/ radomT = "?_=" + (new Date()).getTime(); var url = E3CommonsVariables.RequestPrefixQuery() + argUrl + radomT; if (menuid != undefined) { url += "&menuid=" + menuid; } jQuery.ajax({ url : url, type : "POST", data : paramdata, async : true, dataType : "JSON", contentType : "application/x-www-form-urlencoded;charset=UTF-8", //complete : closeMask, complete:function(){ $("#center_loadingBg").hide(); $("#center_loadingGif").hide(); }, beforeSend : function() { // 可加载loding框 $("#center_loadingBg").show(); $("#center_loadingGif").show(); }, success : function(data) { if (null != data && "" != data) { /* if (null != data.versionValidate) { if (data.versionValidate.forward) { window.location.href=data.versionValidate.url; return; } }*/ if(data.limited == "00"){ $(".wapContent_r").setTemplateElement("queryErrorTemplate_menuCheck").processTemplate(data); $(‘#menuCheck_limitedmessage‘).html("尊敬的用户,您当前省份暂时未开放此业务,您可关注其他业务"); return; } if(data.limited == "01"){ $(".wapContent_r").setTemplateElement("queryErrorTemplate_menuCheck").processTemplate(data); $(‘#menuCheck_limitedmessage‘).html("尊敬的用户,您目前采用随机码登录,此业务暂时无法提供服务,请使用服务密码登录后再使用此业务。"); return; } if (null != data.acclimit) { if ("true"==data.acclimit) { window.location.href="/e3/query/baocuo3.html"; return; } } if( data.ipValidate != null ){ window.location.href="/e3/ipbaocuo.html"; return; } } eval(fun); }, error:function(){ //报错页面 var ErrorOject=new Object(); ErrorOject.errorCode=""; ErrorOject.errorDesc="很抱歉,网络异常了,请查看是否需要您重新登录或者稍后再试。"; QueryMain.processTemplateData("#queryError","queryErrorTemplate",ErrorOject); } }); }, // 处理数据,加载jstemplate模板 processTemplateData : function(show, templateId, data) { $(show).setTemplateElement(templateId).processTemplate(data); } }; var TransactMain = { loadData : function(argUrl, paramdata, fun) { var menuid = _BaseTools.getNaviId(); radomT = "?_=" + (new Date()).getTime(); var url = E3CommonsVariables.RequestPrefixTran() + argUrl + radomT; if (menuid != undefined) { url += "&menuid=" + menuid; } jQuery.ajax({ url : url, type : "POST", data : paramdata, async : true, dataType : "JSON", contentType : "application/x-www-form-urlencoded;charset=UTF-8", complete:function(){ $("#center_loadingBg").hide(); $("#center_loadingGif").hide(); }, beforeSend : function() { // 可加载loding框 $("#center_loadingBg").show(); $("#center_loadingGif").show(); }, success : function(data) { if (null != data && "" != data) { /*if (null != data.versionValidate) { if (data.versionValidate.forward) { window.location.href=data.versionValidate.url; return; } }*/ if(data.limited == "00"){ $(".wapContent_r").setTemplateElement("queryErrorTemplate_menuCheck").processTemplate(data); $(‘#menuCheck_limitedmessage‘).html("尊敬的用户,您当前省份暂时未开放此业务,您可关注其他业务"); return; } if(data.limited == "01"){ $(".wapContent_r").setTemplateElement("queryErrorTemplate_menuCheck").processTemplate(data); $(‘#menuCheck_limitedmessage‘).html("尊敬的用户,您目前采用随机码登录,此业务暂时无法提供服务,请使用服务密码登录后再使用此业务。"); return; } if (null != data.acclimit) { if ("true"==data.acclimit) { window.location.href="/e3/query/baocuo3.html"; return; } } if( data.ipValidate != null ){ window.location.href="/e3/ipbaocuo.html"; return; } } eval(fun); } }); } }; var LifeMain = { loadData : function(argUrl, paramdata, fun,errorfun) { var menuid = jQuery("#menu_right_top").find("li[class=‘on‘]").children( "a").attr("id"); radomT = "?_=" + (new Date()).getTime(); var url = E3CommonsVariables.RequestPrefixLife() + argUrl + radomT; if (menuid != undefined) { url += "&menuid=" + menuid; } jQuery.ajax({ url : url, type : "POST", data : paramdata, async : true, dataType : "JSON", contentType : "application/x-www-form-urlencoded;charset=UTF-8", complete:function(){ $("#center_loadingBg").hide(); $("#center_loadingGif").hide(); }, beforeSend : function() { // 可加载loding框 $("#center_loadingBg").show(); $("#center_loadingGif").show(); }, success : function(data) { if (null != data.acclimit) { if ("true"==data.acclimit) { window.location.href="/e3/query/baocuo3.html"; return; } } if( data.ipValidate != null ){ window.location.href="/e3/ipbaocuo.html"; return; } eval(fun); }, error:function(){ //公共报错页面 if(errorfun!=null) { eval(errorfun); } $("#queryError").show(); _BaseTools.queryErrorMessageObj("queryError","尊敬的客户,由于同一时间使用该业务人数较多,暂时无法为您提供服务,为您带来的不便敬请谅解。"); } }); } }; function logout(){ CommonMain.loadData("/logout", null, ‘logout_ballback()‘); } function logout_ballback(){ $.cookie(‘JUT‘, null, { path: ‘/‘ }); $.cookie(‘MIE‘, null, { path: ‘/‘ }); $.cookie(‘MII‘, null, { path: ‘/‘ }); window.location=‘http://iservice.10010.com/e3/index.html‘; } $(document).ready(function(){ if($.cookie(‘JUT‘)!=null){ $(‘#header2islogin‘).html(‘欢迎来到中国联通!<a href="javascript:;" onclick="logout()">[退出]</a>‘); }else{ var _log_html = ‘欢迎来到中国联通!<a href="javascript:;">[登录]</a> <a href="javascript:;" style=" color:#ff6600;">[免费注册]</a>‘; $(‘#header2islogin‘).html(_log_html); } }); //手机密令 window.parent.wt2BaseCommon.secureAuth = function(secure_token,secure_tool,user_number) { jQuery.ajax({ url:E3CommonsVariables.RequestPrefixQuery()+"/checkmapExtraParamResult?_=" + (new Date()).getTime(), type:"POST", data:{ secure_token:secure_token, secure_tool:secure_tool, user_number:user_number }, dataType:"JSON", success:function(data){ if(data){ var cookie_usermail = jQuery.cookie(‘usermiliauth‘); if(null==cookie_usermail||""==cookie_usermail){ cookie_usermail=usermiliauth; }else{ cookie_usermail+=usermiliauth; } jQuery.cookie(‘usermiliauth‘, cookie_usermail, {domain: ‘.10010.com‘}); usermiliauth=""; OverScreenPass(0); }else{ alert(‘尊敬的用户您好:系统忙请稍后再试‘); $("#secureIframe").attr("src",""); } } }); } window.parent.wt2BaseCommon.closeMiliAuth = function() { //jQuery.cookie(‘usermiliauth‘, ‘usermiliauth‘, {domain: ‘.10010.com‘}); OverScreenPass(0); } function checkmapExtraParam(menuId,fun,v,s,t){ var check_bol = false; jQuery.ajax({ url:E3CommonsVariables.RequestPrefixQuery()+"/checkmapExtraParam?_=" + (new Date()).getTime(), type:"POST", data:{ menuId:menuId }, async:false, dataType:"JSON", success:function(data){ if(data.morder){ var cookie_usermail = jQuery.cookie(‘usermiliauth‘); if(null==cookie_usermail||""==cookie_usermail){ var secureIframe="http://uac.10010.com/secure/securecenter/ylsc"+data.morderCode+"yzche/securelayer?redirect_url=http://iservice.10010.com"; jQuery("#secureIframe").attr("src",secureIframe); showpassover(); usermiliauth=data.miliauth+"$"; }else{ var usermil = cookie_usermail.split("$"); for (var i=0;i<usermil.length;i++) { if(usermil[i]==data.miliauth){ fun(v,s,t); check_bol = true; } } if(!check_bol){ var secureIframe="http://uac.10010.com/secure/securecenter/ylsc"+data.morderCode+"yzche/securelayer?redirect_url=http://iservice.10010.com"; jQuery("#secureIframe").attr("src",secureIframe); showpassover(); usermiliauth=data.miliauth+"$"; } } }else{ usermiliauth=""; fun(v,s,t); check_bol = true; } } }); return check_bol; } var CoverLayerID = ‘CoverLayer‘; function showpassover(){ /*if((jQuery.cookie(‘usermiliauthMorder‘)==null||jQuery.cookie(‘usermiliauthMorder‘)=="")&&(jQuery.cookie(‘usermiliauth‘)==""||jQuery.cookie(‘usermiliauth‘)==null)){ jQuery(‘#password_layer_id‘).show(); OverScreenPass(1); return false; } return true;*/ window.document.domain=‘10010.com‘; jQuery(‘#password_layer_id‘).show(); OverScreenPass(1); return false; } function OverScreenPass(tag){ if(jQuery(‘#‘+CoverLayerID).length>0){ with(jQuery(‘#‘+CoverLayerID)){ if(tag==1){ LayoutAttr(jQuery(‘#‘+CoverLayerID)); }else{ jQuery(‘#password_layer_id‘).hide(); jQuery(‘.closeT‘).removeAttr(‘click‘); css(‘display‘,‘none‘); } } }else if(tag==1){ var CoverLayer = jQuery(‘<div></div>‘); CoverLayer.appendTo(‘body‘); with(CoverLayer){ attr(‘id‘,CoverLayerID); LayoutAttr(CoverLayer); } } } function LayoutAttr(obj){ with(obj){ css(‘position‘,‘absolute‘); css(‘min-width‘,‘100%‘); css(‘background-color‘,‘#CCC‘); css(‘z-index‘,‘99988‘); css(‘width‘,window.screen.width-30); css(‘left‘,‘0px‘); css(‘top‘,‘0px‘); css(‘display‘,‘block‘); css(‘opacity‘,0.8); css(‘height‘,jQuery(document).height()); } } //关闭蒙层 zhaohailong 2015/02/10 function closeMask(XMLHttpRequest, textStatus){ //当flag为0时,说明用户信息还未加载,这时候记录flag为1,说明请求业务数据逻辑层已加载完毕,记录flag为1, if (flag == "0") { flag = "1"; //记录reqFlag为2时,说明已经加载过业务数据逻辑层了 commonReqFlag = "2";//第一次请求 } else { //当reqFlag为2时,说明已经加载过了,这时候只需要还原成1就可以 if (commonReqFlag == "2") { if (headerReqFlag == "2") { if (recordFlag) { setTimeout("$(‘#loadingGif,#loadingBg‘).hide();",1000); recordFlag = undefined; commonReqFlag = "1"; } } else { commonReqFlag = "3"; } } else { commonReqFlag = "2"; if (!recordFlag) { setTimeout("$(‘#loadingGif,#loadingBg‘).hide();",1000); } //当第一次请求时,并且flag为1时,说明用户信息已加载完毕,关闭蒙层就可以 } } }
//接口返回错误码处理 var sombRule ={ //不支持 notsupport:function(){ return "尊敬的客户,您当前使用的套餐暂不能变更为其他套餐,为您带来不便敬请谅解。"; }, //变更过 alreadychange:function(){ return "尊敬的客户,您本月已变更过4G套餐,本月不能再次变更,感谢您的使用。"; }, //合约期并且不是一体化 contract:function(){ return "尊敬的客户,您当前为合约用户,合约期内暂不能变更为其他4G套餐,感谢您的使用。"; }, //不支持变更为共享 notshare:function(){ return "尊敬的客户,您当前使用的套餐暂不能变更为4G共享组合套餐,为您带来不便敬请谅解。"; }, //全国组合 diy4g:function(operCode,producttype){ var msg =""; if("09" == operCode || "03" == producttype){ msg = this.notsupport(); }else if("01" == operCode){ msg = this.alreadychange(); }else if("02" == operCode && "02" != producttype){ msg = this.contract(); } return msg; }, //本地套餐 diylocal:function(operCode,producttype){ var msg =""; if("09" == operCode || "03" == producttype){ msg = this.notsupport(); }else if("01" == operCode){ msg = this.alreadychange(); }else if("02" == operCode && "05" != producttype){ msg = this.contract(); } return msg; }, //共享套餐 diyShare:function(operCode,producttype){ var msg =""; if("09" == operCode || "03" != producttype){ msg = this.notshare(); } return msg; }, //一体化 scomb4g:function(operCode,producttype){ var msg =""; if("09" == operCode || "03" == producttype){ msg = this.notsupport(); }else if("01" == operCode){ msg = this.alreadychange(); }else if("02" == operCode && "01" != producttype){ msg = this.contract(); } return msg; }, //校园 school:function(operCode,producttype){ var msg =""; if("09" == operCode || "03" == producttype){ msg = this.notsupport(); }else if("01" == operCode){ msg = this.alreadychange(); }else if("02" == operCode && "04" != producttype){ msg = this.contract(); } return msg; } };
jquery.cookie.js /*! * jQuery Cookie Plugin v1.3.1 * https://github.com/carhartl/jquery-cookie * * Copyright 2013 Klaus Hartl * Released under the MIT license */ (function ($, document, undefined) { var pluses = /\+/g; function raw(s) { return s; } function decoded(s) { return unRfc2068(decodeURIComponent(s.replace(pluses, ‘ ‘))); } function unRfc2068(value) { if (value.indexOf(‘"‘) === 0) { // This is a quoted cookie as according to RFC2068, unescape value = value.slice(1, -1).replace(/\\"/g, ‘"‘).replace(/\\\\/g, ‘\\‘); } return value; } function fromJSON(value) { return config.json ? JSON.parse(value) : value; } var config = $.cookie = function (key, value, options) { // write if (value !== undefined) { options = $.extend({}, config.defaults, options); if (value === null) { options.expires = -1; } if (typeof options.expires === ‘number‘) { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } value = config.json ? JSON.stringify(value) : String(value); return (document.cookie = [ encodeURIComponent(key), ‘=‘, config.raw ? value : encodeURIComponent(value), options.expires ? ‘; expires=‘ + options.expires.toUTCString() : ‘‘, // use expires attribute, max-age is not supported by IE options.path ? ‘; path=‘ + options.path : ‘‘, options.domain ? ‘; domain=‘ + options.domain : ‘‘, options.secure ? ‘; secure‘ : ‘‘ ].join(‘‘)); } // read var decode = config.raw ? raw : decoded; var cookies = document.cookie.split(‘; ‘); var result = key ? null : {}; for (var i = 0, l = cookies.length; i < l; i++) { var parts = cookies[i].split(‘=‘); var name = decode(parts.shift()); var cookie = decode(parts.join(‘=‘)); if (key && key === name) { result = fromJSON(cookie); break; } if (!key) { result[name] = fromJSON(cookie); } } return result; }; config.defaults = {}; $.removeCookie = function (key, options) { if ($.cookie(key) !== null) { $.cookie(key, null, options); return true; } return false; }; })(jQuery, document);
remender.js /** * */ var _morningArray = ["清晨,一个微笑,给自己加油打气。","浅笑吧,美妙的一天又开始了。","亮起的不只是阳光,还有你的好心情哦!","每一天,努力让梦想更近一些。","忙碌中别忘了给心灵一点空间和营养。","让喜悦与平静自然滋长,随时给生命来个深呼吸。"]; var _noorArray = ["饮食清淡少油腻,水果蔬菜补维C。","午餐后,溜达溜达再投入到下午的工作中。","在太阳最温暖的时候,许一个心愿,让你的笑容永远温暖。"]; var _afternoonArray = ["喝杯茶吧,让精神抖擞起来。","中午养足精神了吗?让我们一起度过一个愉快的下午吧!"]; var _nightArray = ["思绪沉浸在晚风中,为你扫去一日的忙碌与疲惫。","今晚温馨笑一笑,舒舒服服睡个觉。","夜幕降临,繁星点点,愿你拥有一个惬意而宁静的夜晚。","夜深了,让心沉淀,静静享受美梦时光吧。"]; var WarmGreetings = { greetings : function () { jQuery("#_greetionTime_no").html(WarmGreetings.currentTime()); var warmGreetion = ""; if ("早上好"==WarmGreetings.currentTime()) { warmGreetion = _morningArray[WarmGreetings.random(0,_morningArray.length)]; } else if ("上午好"==WarmGreetings.currentTime()) { warmGreetion = _morningArray[WarmGreetings.random(0,_morningArray.length)]; } else if ("中午好"==WarmGreetings.currentTime()) { warmGreetion = _noorArray[WarmGreetings.random(0,_noorArray.length)]; } else if ("下午好"==WarmGreetings.currentTime()) { warmGreetion = _afternoonArray[WarmGreetings.random(0,_afternoonArray.length)]; } else if ("晚上好"==WarmGreetings.currentTime()) { warmGreetion = _nightArray[WarmGreetings.random(0,_nightArray.length)]; } jQuery("#_warmGreetion_no").html(warmGreetion); }, random : function (min,max){ return Math.floor(min+Math.random()*(max-min)); }, currentTime : function () { var hour = new Date().getHours(); if (hour >= 6 && hour < 11) { return "上午好"; } else if (hour >= 11 && hour < 13) { return "中午好"; } else if (hour >= 13 && hour < 19) { return "下午好"; } else { return "晚上好"; } } };
标签:
原文地址:http://www.cnblogs.com/sunxuchu/p/5424429.html