//---------------------------------------------------------------------- //@files: 首都之窗(2017年改造)-便民服务用户操作js文件 //@brief: 便民服务栏目用户体验 //@date: 2017/09/14 //---------------------------------------------------------------------- function getCookie(objName){ var arrStr = document.cookie.split("; "); for(var i = 0;i < arrStr.length;i ++){ var temp=arrStr[i].split("="); if(temp[0]==objName){ return unescape(temp[1]); } } return "undefined"; } function setCookie(name,value) { var Days = 1000; var exp = new Date(); exp.setTime(exp.getTime()+Days*24*60*60*1000); document.cookie=name+"="+escape(value)+";path=/;domain=.beijing.gov.cn; expires="+exp.toGMTString(); } function delCookie(name){ var exp = new Date(); exp.setTime(exp.getTime() - 1); var cval=getCookie(name); document.cookie = name+"="+cval+"; expires="+exp.toGMTString(); } var siteId = 1; var rfPath = "http://banshi.beijing.gov.cn/pubservice"; rfPath="http://banshi.beijing.gov.cn/pubservice"; var ubaPath = "http://map.beijing.gov.cn/uba"; var pageType = 2; var catalogs = $("meta[name=ColumnId]").attr("content"); var catelogName = $("meta[name=ColumnName]").attr("content"); var contentid = $("meta[name=ArticleTitle]").attr("content"); if(typeof(contentid)!=undefined && contentid!=null && contentid!=""){ pageType = 1; } var title = $('title').text(); var localUrl = window.location.href; var userName = ""; $(function(){ jQuery.ajax({ url : rfPath + "/user/userIslogin", type : "GET", dataType: "jsonp", jsonp: "callbackparam", jsonpCallback: "callbackparam", success : function(ldata, textStatus, XMLHttpRequest) { if (ldata.isLogin == true) { if($("#userAtag").length>0){ $("#userAtag").attr("href",rfPath+"/user/myspace"); $("#userAtag").attr("class","dzfw1"); } userName=ldata.userName; if(userName==""){ userName=ldata.cName; } } else { if($("#grdl").length>0){ $("#grdl").empty(); $("#grdl").append("个人登录"); } if($("#frdl").length>0){ $("#frdl").empty(); $("#frdl").append("个人登录"); } if($("#userAtag").length>0){ $("#userAtag").attr("href","http://www.beijing.gov.cn/fuwu/bmfw/default_7922.htm"); $("#userAtag").attr("class","dzfw"); } userName=""; } if(userName!=""){ setCookie('userName',userName); }else{ userName = getCookie("userName"); } var userOpId = getCookie("userOpId"); jQuery.ajax({ url : ubaPath+"/opLogs/op.gif", type : "GET", dataType : "jsonp", data : {"userName":userName,"title":title,"pageType":pageType,"channelId":catalogs,"channelName":catelogName,"docId":contentid,"opUrl":localUrl,"siteId":siteId,"userCookie":userOpId}, jsonp : "cb", jsonpCallback : "cb", xhrFields: { withCredentials: true }, crossDomain: true, success : function(opdata, textStatus, XMLHttpRequest) { if(opdata.status=="success"){ setCookie('userOpId',opdata.code); if(typeof opJumpUrl !="undefined"){ window.location.href=opJumpUrl ; } jQuery.ajax({ url:ubaPath+"/opLogs/gInfos", type:"GET", scriptCharset:"utf-8", dataType:"jsonp", data : {"uc":userOpId,"siteId":siteId}, jsonp: "cb", jsonpCallback: "cb", success : function(infodata, textStatus, XMLHttpRequest) { $("#fontlist").empty(); for(var i = 0; i < infodata.length; i++){ var docServerName = infodata[i].serverName; var docTitle = infodata[i].docName; var channelName= infodata[i].channelName; if(channelName.indexOf("便民-")>-1)channelName=channelName.replace("便民-","") if(channelName.indexOf("-")>-1)channelName=channelName.substring(0,channelName.indexOf("-")); var str = "
  • "+channelName+""; if(typeof docTitle !="undefined" && docTitle!=""){ if(docTitle.length>24)docTitle=docTitle.substring(0,24)+"..."; str+="("+docTitle+""; } if(typeof docServerName!="undefined" && docServerName!=""){ if(docServerName.length>8)docServerName=docServerName.substring(0,8)+"..."; str+=";"+docServerName+""; } str+=")
  • "; $("#fontlist").append(str); } } }); } }, error : function() { console.log("oplogs请求失败"); } }); }, error : function() { if($("#userAtag").length>0){ $("#userAtag").attr("href","http://www.beijing.gov.cn/fuwu/bmfw/default_7922.htm"); $("#userAtag").attr("class","dzfw"); } console.log("userIslogin请求失败"); } }); });