function setTab(name,cursel,n){ for(i=1;i<=n;i++){ var menu=document.getElementById(name+i); var con=document.getElementById("con_"+name+"_"+i); menu.className=i==cursel?"active":""; con.style.display=i==cursel?"block":"none"; } } function removeHtmlTab(tab) { return tab.replace(/<[^<>]+?>/g,'');//删除所有HTML标签 } function getpara(key) {// 获取参数的函数 var url = document.URL; var rtn = ""; if (url.lastIndexOf("?") > 0) { var para = url.substring(url.lastIndexOf("?") + 1, url.length); var arr = para.split("&"); for ( var i = 0; i < arr.length; i++) { var id = arr[i].split("=")[0]; if (id == key) { rtn = arr[i].split("=")[1]; break; } } } return rtn; } function getNowFormatDate() { var date = new Date(); var seperator1 = "-"; var seperator2 = ":"; var month = date.getMonth() + 1; var strDate = date.getDate(); if (month >= 1 && month <= 9) { month = "0" + month; } if (strDate >= 0 && strDate <= 9) { strDate = "0" + strDate; } var currentdate = /*date.getFullYear() + seperator1 + month + seperator1 + strDate + " " + */ date.getHours() + seperator2 + date.getMinutes() + seperator2 + date.getSeconds(); return currentdate; } var robot = robot||{ robotName:"",//机器人名称 logoUrl:"",//LOGO地址 pictureUrl:"",//图标地址 greeting:"",//欢迎词 unknownWords:"",//未知说辞 unknownWords1:"", //连续未知说辞 url:"", config:{ logoID:"weblogo", path:"http://127.0.0.1:8080/robot", contentID:"left_content", inputID:"text-in", textMaxNum:100, wordremain:"wordremain", problemsID:"topQuestionDiv",//常见问题 SystemInfoID:"Contact_us", quickServiceID:"rservlist",//快捷服务 configurationId:"DD20BE1E6200D8D713970D5354ED0CF6", greetingHTMLID:"jqrhyc",//欢迎html模板 userSendHTMLID:"yhfs", //用户发送HTML replyHTMLID:"reply"//机器人回复模板 } }; robot.initialize = function(config){ robot.config=config; //alert(config.configurationId); $.ajax({ url : config.path+"/znwd/ajaxInitialize/"+config.configurationId+"?ajax",//"/u/solicitation/ajaxToplist/"+code+"?ajax", type : "GET", data : { }, // dataType : "json", dataType : "jsonp", jsonp : "JsonpCallBack", jsonpCallback : "ajaxInitialize", beforeSend: function(){ $("booy").append(' 加载中.'); }, success : function(json) { if (!jQuery.isEmptyObject(json)){ robot.robotName = json.setting.robotName; robot.logoUrl = json.setting.logoUrl; robot.pictureUrl = json.setting.pictureUrl; robot.greeting = json.setting.greeting; robot.unknownWords = json.setting.unknownWords; robot.unknownWords1 = json.setting.unknownWords1; //设置页面title $(document).attr("title",robot.robotName); //设置logo $("#"+config.logoID).attr("src",robot.logoUrl); var greetingHTML = $("#"+config.greetingHTMLID).html(); var re = /{robotName}/ig; greetingHTML = greetingHTML.replace(re,robot.robotName); re = /{pictureUrl}/ig; greetingHTML = greetingHTML.replace(re,''); re = /{greeting}/ig; greetingHTML = greetingHTML.replace(re,robot.greeting); re = /{time}/ig; greetingHTML = greetingHTML.replace(re,getNowFormatDate()); //设置欢迎词 $("#"+config.contentID).append(greetingHTML); robot.url=json.system.url; //获取单位信息 var html = '