福田皮卡火星7+火星9
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

headerAndFooter.js 50KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676
  1. var irobot_commonUrl = "/fotonpts/"; // 小机器人后台请求路径
  2. //var irobot_commonUrl = "http://10.100.53.14/fotonpts/";// 小机器人后台请求路径
  3. var irobot_pageNum = 1; // 当前页数
  4. var irobot_totalCount = 9; // 数据条数
  5. var irobot_pageCount = 1; // 总页数
  6. var irobot_answer = ""; // 用于存储咨询小i机器人的问题
  7. var irobot_nodeId = ""; // 用于存储咨询小i机器人回复答案的nodeId
  8. this.foton = this.foton || {};
  9. var $url = "/tunland/";
  10. var $baseUrl = window.$baseUrl || {};
  11. // var ip = returnCitySN["cip"];
  12. var ip="";
  13. $baseUrl.config = '//' + document.location.host + $url;
  14. //会员中心接口
  15. var $mcBaseUrl = window.$mcBaseUrl || {};
  16. $mcBaseUrl = '//' + document.location.host + $url;
  17. //$mcBaseUrl = 'http://172.24.222.8:8080/'+$url;
  18. (function() {
  19. var HeaderAndFooter = function(i) {
  20. new foton.Header();
  21. this.footer = new foton.Footer();
  22. this.initScroll();
  23. new foton.irobot();
  24. new foton.links(i);
  25. new foton.vistNum();
  26. this.gototop();
  27. };
  28. var p = HeaderAndFooter.prototype;
  29. p.initScroll = function() {
  30. var cur = this;
  31. $(window).bind("scroll", function() {
  32. var top = $(document).scrollTop();
  33. var temp = top + $(window).innerHeight();
  34. });
  35. };
  36. p.gototop = function() {
  37. $("#infortop").click(function() {
  38. $('html,body').animate({
  39. scrollTop: '0px'
  40. }, 500);
  41. return false;
  42. });
  43. };
  44. foton.HeaderAndFooter = HeaderAndFooter;
  45. })();
  46. (function() {
  47. var Header = function() {
  48. this.initDom();
  49. this.initNav();
  50. this.initCar();
  51. this.initSearch();
  52. this.initTool();
  53. this.judgeLoad();
  54. this.initSearchOut();
  55. this.navul(2);
  56. };
  57. var p = Header.prototype;
  58. p.initDom = function() {
  59. this.$nav = $(".header .navPanel a");
  60. this.$subNavMask = $(".subNavMask");
  61. this.$subNavScrollPanel = $(".subNavMask .subNavScrollPanel");
  62. this.$subNavGroup = $(".subNavMask .subNavScrollPanel .subNavGroup");
  63. //
  64. this.$carNavPanel = $(".header .carNavPanel");
  65. this.$carNav = $(".header .carNavPanel .carNav");
  66. this.$carMask = $(".header .carMask");
  67. this.$carScrollPanel = $(".header .carMask .carScrollPanel");
  68. this.carNav_index = $("a.carNav").prevAll().length;
  69. //
  70. this.$rightPanel = $(".header .rightPanel");
  71. this.$searchIcon = $(".header .searchIcon");
  72. this.$searchPanel = $(".header .searchPanel");
  73. this.$searchInput = $(".header .searchPanel .searchInput");
  74. this.$searchBtn = $(".header .searchPanel .searchBtn");
  75. this.$searchClose = $(".header .searchPanel .searchClose");
  76. //
  77. this.$codeIcon = $(".toolPanel .toolGroup .codeIcon");
  78. this.$codePanel = $(".toolPanel .codePanel");
  79. // 修改
  80. this.$searchInout = $("div.header input.searchInput");
  81. };
  82. // 修改
  83. p.initSearchOut = function() {
  84. this.$searchInout.focus(function() {
  85. if($(this).val() == "search") {
  86. $(this).val("");
  87. }
  88. }).blur(function() {
  89. if($.trim($(this).val()) == "") {
  90. $(this).val("search");
  91. }
  92. });
  93. };
  94. p.initNav = function() {
  95. var cur = this;
  96. this.$nav.mouseenter(function() {
  97. cur.cancelClose();
  98. var id = cur.$nav.index(this);
  99. if((id == 0)) {
  100. cur.$subNavMask.css({
  101. "height": 0
  102. });
  103. } else {
  104. var targetX = $(this).position().left;
  105. if(id == cur.carNav_index) {
  106. targetX = $(this).position().left - 250;
  107. }
  108. cur.$subNavMask.css({
  109. "left": targetX
  110. });
  111. cur.subNavScrollPanelMove(id);
  112. }
  113. $(".car_imgbox .car_name").eq(0).show().siblings().hide();
  114. $(".car_conbox1 .car_conone").eq(0).show().siblings().hide();
  115. });
  116. this.$nav.mouseleave(function() {
  117. cur.subNavClose();
  118. });
  119. this.$subNavMask.mouseenter(function() {
  120. cur.cancelClose();
  121. });
  122. this.$subNavMask.mouseleave(function() {
  123. cur.subNavClose();
  124. });
  125. };
  126. p.subNavScrollPanelMove = function(id) {
  127. var cur = this;
  128. var targetX = -this.$subNavGroup.eq(id).position().left;
  129. var targetW = this.$subNavGroup.eq(id).width();
  130. // if(id==1||id==2||id==3){
  131. if(id == 1) {
  132. var targetH = this.$subNavGroup.eq(id).children(".car_togeter").length * 280;
  133. } else {
  134. var targetH = this.$subNavGroup.eq(id).children(".subNav").length * 41;
  135. }
  136. if(id == cur.carNav_index) {
  137. targetH = 300;
  138. }
  139. this.$subNavScrollPanel.css({
  140. "left": targetX
  141. });
  142. this.$subNavMask.css({
  143. "width": targetW,
  144. "height": targetH
  145. });
  146. };
  147. p.subNavClose = function() {
  148. var cur = this;
  149. this.closeTimer = setTimeout(function() {
  150. cur.subNavCloseFun();
  151. }, 300);
  152. };
  153. p.cancelClose = function() {
  154. if(this.closeTimer) {
  155. clearTimeout(this.closeTimer);
  156. }
  157. };
  158. p.subNavCloseFun = function() {
  159. this.$subNavMask.css({
  160. "height": 0
  161. });
  162. };
  163. //
  164. p.initCar = function() {
  165. var cur = this;
  166. this.$carNav.click(function() {
  167. var id = cur.$carNav.index(this);
  168. var targetY = -id * cur.$carMask.height();
  169. cur.$carScrollPanel.stop(true, false).animate({
  170. "top": targetY
  171. }, 0);
  172. //
  173. $(this).addClass("carNav_click");
  174. cur.$carNav.not(this).removeClass("carNav_click");
  175. });
  176. };
  177. //
  178. p.initSearch = function() {
  179. var cur = this;
  180. this.$searchIcon.click(function() {
  181. cur.openSearch();
  182. });
  183. this.$searchClose.click(function() {
  184. cur.closeSearch();
  185. });
  186. };
  187. p.openSearch = function() {
  188. this.$searchPanel.fadeIn();
  189. this.$rightPanel.fadeOut();
  190. };
  191. p.closeSearch = function() {
  192. this.$searchPanel.fadeOut();
  193. this.$rightPanel.fadeIn();
  194. };
  195. //
  196. p.initTool = function() {
  197. var cur = this;
  198. this.$codeIcon.mouseenter(function() {
  199. cur.$codePanel.show();
  200. cur.$codePanel.stop(true, false).animate({
  201. "right": 50,
  202. "opacity": 1
  203. }, 300);
  204. });
  205. this.$codeIcon.mouseleave(function() {
  206. cur.$codePanel.stop(true, false).animate({
  207. "right": 150,
  208. "opacity": 0
  209. }, 300, function() {
  210. cur.$codePanel.hide();
  211. });
  212. });
  213. };
  214. p.judgeLoad = function() {
  215. var cur = this;
  216. if(!$(".loginPanel").length) {
  217. cur.initAllDom();
  218. }
  219. $.ajax({
  220. url: $mcBaseUrl + "login/getstatus",
  221. type: "get",
  222. dataType: "json",
  223. success: function(data) {
  224. if(data.status == "0") {
  225. if(!$(".mcuser").length) {
  226. //生成结构
  227. cur.initDomUser(data);
  228. }
  229. } else if(data.status == "1") {
  230. //window.location.href =$url+"/bottom/login"
  231. }
  232. }
  233. });
  234. };
  235. p.initDomUser = function(data) {
  236. $(".loginPanel").children().remove();
  237. var $loginPanelChildren = $('<div class="mcuser" style="color:#fff;float:left;"><p class="userName">' + data.data + '</p></div><div class="line"></div>' +
  238. '<div class="title"><a href="javascript:mcLogout()">退出登录</a></div>' +
  239. '<div class="line"></div>' +
  240. '<div class="title"><a class="onlineservice">在线客服</a></div>'
  241. );
  242. $(".loginPanel").append($loginPanelChildren);
  243. $(".mcuser").find("p.userName").bind("click", function(e) {
  244. window.location.href = $url + "memberreview/selfmessage";
  245. });
  246. };
  247. p.initAllDom = function() {
  248. var $loginPanel = $('<div class="loginPanel">' +
  249. '<div class="title"><a href="' + $url + 'bottom/regist">注册</a></div>' +
  250. '<div class="line"></div>' +
  251. '<div class="title"><a href="' + $url + 'bottom/login">登录</a></div>' +
  252. '<div class="line"></div>' +
  253. '<div class="title"><a class="onlineservice">在线客服</a></div>' +
  254. '</div>'
  255. );
  256. $(".header").append($loginPanel);
  257. };
  258. //生成导航
  259. //num 0 - 北京伽途
  260. //num 1 - 萨瓦纳
  261. //num 2 - 拓陆者
  262. p.navul = function(num) {
  263. var cur = this;
  264. // 加载导航车型信息
  265. // $(".car_togeter").load("/tunland/nav.html",function(){
  266. // $("ul.car_name2 li").hover(function(){
  267. // var ind = $(this).index();
  268. // $(".car_imgbox .car_name").eq(ind).stop().fadeIn(300).siblings(".car_name").hide();
  269. // });
  270. // $(".car_imgbox .car_name li a").hover(function(){
  271. // var name=$(this).attr("data-name");
  272. // $(".car_conbox1 .car_conone[data-name='"+name+"']").show().siblings(".car_conone").hide();
  273. // });
  274. // });
  275. $(".car_togeter").load("/tunland/nav.html", function() {
  276. // $("ul.car_name2 li").hover(function() {
  277. // var ind = $(this).index();
  278. // //console.log(ind);
  279. // if(ind == "0") {
  280. // // $(".car_imgbox1,.car_imgbox").show();
  281. // // $(".car_conbox2").hide();
  282. // // $(".car_imgbox1 .car_namebox").eq(ind).stop().fadeIn(300).siblings(".car_namebox").hide();
  283. // // $(".car_imgbox .car_name").eq("0").stop().fadeIn(300).siblings(".car_name").hide();
  284. // // $(".car_conbox1 .car_conone").eq("0").stop().fadeIn(300).siblings(".car_conone").hide();
  285. // // $(".car_conbox1 .car_conone[data-name='驭途9']").show().siblings(".car_conone").hide();
  286. // $(".car_imgbox1").show();
  287. // $(".car_imgbox").hide();
  288. // //$(".car_imgbox .car_name").eq("4").stop().fadeIn(300).siblings(".car_name").hide();
  289. // $(".car_conbox1 .car_conone[data-name='大将军']").show().siblings(".car_conone").hide();
  290. // }else if(ind == "2"){
  291. // $(".car_imgbox1,.car_imgbox").hide();
  292. // //$(".car_imgbox .car_name").eq("4").stop().fadeIn(300).siblings(".car_name").hide();
  293. // $(".car_conbox1 .car_conone[data-name='萨普轿卡']").show().siblings(".car_conone").hide();
  294. // } else {
  295. // $(".car_imgbox1").hide();
  296. // $(".car_imgbox").show()
  297. // $(".car_imgbox .car_name").eq("3").stop().fadeIn(300).siblings(".car_name").hide();
  298. // $(".car_imgbox1 .car_namebox").eq("3").stop().fadeIn(300).siblings(".car_namebox").hide();
  299. // $(".car_conbox1 .car_conone[data-name='福田征服者3']").show().siblings(".car_conone").hide();
  300. // }
  301. // });
  302. // $("ul.car_namebox li").hover(function() {
  303. // var ind1 = $(this).index();
  304. // if (ind1==0) {
  305. // $(".car_imgbox").hide();
  306. // $(".car_conbox1 .car_conone[data-name='大将军']").show().siblings(".car_conone").hide();
  307. // }else{
  308. // $(".car_imgbox").show();
  309. // }
  310. // $(".car_imgbox .car_name").eq(ind1-1).stop().fadeIn(300).siblings(".car_name").hide();
  311. // });
  312. // $(".car_imgbox .car_name li a").hover(function() {
  313. // var name = $(this).attr("data-name");
  314. // $(".car_conbox1 .car_conone[data-name='" + name + "']").show().siblings(".car_conone").hide();
  315. // });
  316. $("ul.car_name2 li > a").mouseenter(function() {
  317. $(this).next('.car_imgbox').addClass('show').show();
  318. $(this).next('.car_imgbox').find('li:nth-child(1) .car_imgbox').addClass('show').show()
  319. $(this).next('.car_imgbox').find('ul li').eq(0).find('.car_imgbox>ul>li:nth-child(1)>.car_conone').show().parent('li').siblings('li').find('div.car_conone').hide()
  320. $(this).parents('li').siblings('li').find('.car_imgbox').removeClass('show').hide();
  321. if($(this).next('div').hasClass('car_conone')){
  322. $(this).next('div').show().parent('li').siblings('li').find('.car_conone').hide();
  323. }
  324. })
  325. $("ul.car_name2>li:nth-child(1)>a").trigger('mouseenter')
  326. });
  327. };
  328. //newNav
  329. p.newNavfn = function() {
  330. var cur = this;
  331. };
  332. foton.Header = Header;
  333. })();
  334. (function() {
  335. var Footer = function() {
  336. this.isAppear = false;
  337. this.initDom();
  338. // this.initCode();
  339. this.initSearchInput();
  340. this.initlinkGroup();
  341. $("div.linkGroup").buildScrollBar();
  342. };
  343. var p = Footer.prototype;
  344. p.initDom = function() {
  345. this.$dom = $(".footer");
  346. // this.$codePanel = $(".footer .codePanel");
  347. // this.$codeIcon = $(".footer .codeIcon");
  348. // this.$codeIcon.data("isOpen", 0);
  349. this.$searchInput = $("div.footer input.searchInput");
  350. this.$link = $("div.footer div.linkPanel");
  351. this.$linkTitle = $("div.footer div.linkTitle");
  352. this.$linkGroupdom = $("div.footer div.linkGroup");
  353. };
  354. p.initSearchInput = function() {
  355. this.$searchInput.focus(function() {
  356. if($(this).val() == "SEARCH") {
  357. $(this).val("");
  358. }
  359. }).blur(function() {
  360. if($.trim($(this).val()) == "") {
  361. $(this).val("SEARCH");
  362. }
  363. });
  364. };
  365. // p.initCode = function() {
  366. // var cur = this;
  367. // this.$codeIcon.mouseenter(function() {
  368. // if($(this).data("isOpen") == 0) {
  369. // $(this).removeClass("codeIcon_out").addClass("codeIcon_over");
  370. // }
  371. // });
  372. // this.$codeIcon.mouseleave(function() {
  373. // if($(this).data("isOpen") == 0) {
  374. // $(this).removeClass("codeIcon_over").addClass("codeIcon_out");
  375. // }
  376. // });
  377. // $(document).mousedown(function(e) {
  378. // e.stopPropagation();
  379. // if($.inArray(cur.$codePanel[0], $(e.target).parents()) == -1) {
  380. // cur.$codeIcon.data("isOpen", 0);
  381. // cur.$codePanel.removeClass("codePanelOpen").addClass(
  382. // "codePanelClose");
  383. // cur.$codeIcon.removeClass("codeIcon_out").removeClass(
  384. // "codeIcon_click").removeClass("codeIcon_over");
  385. // }
  386. // });
  387. // this.$codeIcon.click(function(e) {
  388. // e.stopPropagation();
  389. // if($(this).data("isOpen") == 0) {
  390. // $(this).data("isOpen", 1);
  391. // $(this).removeClass("codeIcon_out")
  392. // .removeClass("codeIcon_over")
  393. // .addClass("codeIcon_click");
  394. // cur.$codePanel.removeClass("codePanelClose").addClass(
  395. // "codePanelOpen");
  396. // } else if($(this).data("isOpen") == 1) {
  397. // $(this).data("isOpen", 0);
  398. // cur.$codePanel.removeClass("codePanelOpen").addClass(
  399. // "codePanelClose");
  400. // $(this).removeClass("codeIcon_out").removeClass(
  401. // "codeIcon_click").addClass("codeIcon_over");
  402. // }
  403. // });
  404. // };
  405. p.initlinkGroup = function() {
  406. var cur = this;
  407. cur.$linkTitle.click(function(e) {
  408. e.stopPropagation();
  409. cur.$linkGroupdom.addClass("linkGroupHover");
  410. });
  411. $(document).mousedown(function(e) {
  412. if($.inArray(cur.$linkGroupdom[0], $(e.target).parents()) == -1) {
  413. cur.$linkGroupdom.removeClass("linkGroupHover");
  414. }
  415. });
  416. };
  417. foton.Footer = Footer;
  418. })();
  419. //退出登录的方法
  420. function mcLogout() {
  421. //先删除cookie在调后端的退出方法
  422. $.cookie('foton_access_token', '', {
  423. path: '/',
  424. expires: -1
  425. });
  426. $.ajax({
  427. url: $mcBaseUrl + "MemberCenter/logout",
  428. type: "get",
  429. success: function(data) {
  430. window.location.href = $url + "bottom/login";
  431. }
  432. });
  433. }
  434. // 读取cookies
  435. function getCookie(name) {
  436. var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
  437. if(arr = document.cookie.match(reg))
  438. return(arr[2]);
  439. else
  440. return null;
  441. }
  442. //链接
  443. (function() {
  444. var links = function(i) {
  445. this.init(i);
  446. };
  447. var p = links.prototype;
  448. p.init = function(i) {
  449. this.initDom();
  450. this.linkch(i);
  451. };
  452. p.initDom = function() {
  453. this.$navPanel = $("div.navPanel a");
  454. };
  455. p.linkch = function(i) {
  456. var cur = this;
  457. cur.$li.eq(i).addClass("present");
  458. };
  459. })();
  460. //小i机器人
  461. (function() {
  462. var irobot = function() {
  463. this.init();
  464. };
  465. var p = irobot.prototype;
  466. p.init = function() {
  467. //生成Dom结构
  468. this.onlineDom();
  469. //点击在线服务
  470. this.online();
  471. };
  472. p.onlineDom = function() {
  473. this.$onlineservice = $("div.loginPanel a.onlineservice , div.toolGroup a.onlineservice , p a.onlineservice, a.onlineservice");
  474. };
  475. p.online = function() {
  476. var cur = this;
  477. this.$onlineservice.click(function() {
  478. // 如果弹出框隐藏了,再次点击时,则把隐藏的显示,否则重新创建弹出框
  479. if($("div.entirety").length > 0) {
  480. $("div.entirety").fadeIn();
  481. $("#robotDialogBox").fadeIn().removeClass("rgkhIndex");
  482. $("#rgDialogBox").addClass("rgkhIndex");
  483. } else {
  484. cur.generate();
  485. }
  486. //alert("功能暂时不开放");
  487. });
  488. };
  489. p.generate = function() {
  490. var cur = this;
  491. var $entirety = $('<div class="entirety"></div>'); //整体盒子
  492. var $dialogbox = $('<div class="dialogbox" id="robotDialogBox"></div>'); //对话框盒子
  493. var $dialogue = $('<div class="dialogue" id="rgDialogBox"></div>');
  494. var $iframebox = $('<iframe name="zrgIframe" src="https://foton.custhelp.com/app/mobile/chat/chat_landing_home" width="500" height="540" class="framebox" scrolling="no"></iframe>');
  495. var $topcon = $('<div class="topcon" id="robotbox">' +
  496. '<img src="' + $url + 'static/images/robot/machine.png" width="64" height="96" class="machine"/>' +
  497. '<div class="motivational">' +
  498. '<span class="smalli">小福星</span>' +
  499. '<span class="allday">24小时竭诚为您服务</span>' +
  500. '</div>' +
  501. '<div class="closed"></div>' +
  502. '</div>'); //标题
  503. var $topcontwo = $('<div class="topcon" id="dialoguespeak">' +
  504. '<img src="' + $url + 'static/images/robot/machine.png" width="64" height="96" class="machine"/>' +
  505. '<div class="motivational">' +
  506. '<span class="smalli">福田公司人工客服</span>' +
  507. '<span class="allday">竭诚为您服务</span>' +
  508. '</div>' +
  509. '<div class="frameclosed"></div>' +
  510. '</div>'); //标题
  511. var $dialogueleft = $('<div class="dialogueleft"></div>'); //左边内容大盒子
  512. var $chatting = $('<div class="chatting"></div>'); //聊天记录
  513. var $incontent = $('<div class="incontent">' +
  514. '<div class="typeface clearfix">' +
  515. '<div class="typepic"></div>' +
  516. '<select id="selectsnum">' +
  517. '<option value="12">12</option>' +
  518. '<option value="13">13</option>' +
  519. '<option value="14">14</option>' +
  520. '<option value="15">15</option>' +
  521. '<option value="16">16</option>' +
  522. '<option value="17">17</option>' +
  523. '<option value="18">18</option>' +
  524. '</select>' +
  525. '<a href="#" class="manpower">转人工客服</a>' +
  526. '<form action="" method="" class="field">' +
  527. '<textarea name="" id="enterContent"></textarea>' +
  528. '<input type="button" name="" id="sendmessage" value="发送信息" title="点击发送"/>' +
  529. '<input type="button" name="" id="quit" value="关闭" title="点击关闭"/>' +
  530. '<div class="searchcase">' +
  531. '<ul class="warning">' +
  532. '</ul>' +
  533. '</div>' +
  534. '</form>' +
  535. '</div>' +
  536. '<div class="reminder">' +
  537. '<span class="keyword">发送内容不能为空,请重新输入.</span>' +
  538. '</div>' +
  539. '</div>'); //聊天输入框
  540. var $morecon = $('<div class="morecon"></div>'); //右边内容大盒子
  541. var $query = $('<ul class="query clearfix">' +
  542. '<li class="checked options"><a>首页</a></li>' +
  543. '<li class="options"><a>热点问题</a></li>' +
  544. '<li class="options"><a>在线留言</a></li>' +
  545. '<li><a href="https://foton.custhelp.com/ci/documents/detail/5/26/12/f9943fada86975bbd5fc99adb71121beb1e57cc3" target="_blank">问卷调查</a></li>' +
  546. '</ul>'); //导航栏
  547. var $homepage = $('<div class="switchbox homepage clearfix">' +
  548. '<div class="smallbanner">' +
  549. '<div class="smallbannerbox"></div>' +
  550. '<ul class="dotamount clearfix"></ul>' +
  551. '</div>' +
  552. '<div class="maintain clearfix">' +
  553. '<a class="subscribe" href="' + $url + 'bottom/testDrive" target="_blank">' +
  554. '<img src="' + $url + 'static/images/robot/kefu1.jpg" width="120" height="80"/>' +
  555. '<span>预约试驾</span>' +
  556. '</a>' +
  557. '<a class="subscribe" href="' + $url + 'customer/customerService" target="_blank">' +
  558. '<img src="' + $url + 'static/images/robot/kefu2.jpg" width="120" height="80"/>' +
  559. '<span>维修保养</span>' +
  560. '</a>' +
  561. '<a class="subscribe" href="' + $url + 'customer#serviceProviders" target="_blank">' +
  562. '<img src="' + $url + 'static/images/robot/kefu3.jpg" width="120" height="80"/>' +
  563. '<span>服务站/经销商查询</span>' +
  564. '</a>' +
  565. '</div>' +
  566. '</div>'); //首页
  567. var $correlation = $('<div class="switchbox correlation clearfix">' +
  568. '<ul class="hotpints"></ul>' +
  569. '<ul class="pagenum clearfix"></ul>' +
  570. '</div>'); //热点问题
  571. var $survey = $('<div class="switchbox survey clearfix">' +
  572. '<iframe src="https://foton.custhelp.com/app/Fotonhome_ask/" width="400" height="430" frameborder="0"></iframe>' +
  573. '</div>');
  574. var $servicetime = $('<div class="servicetime">' +
  575. '<div class="umbrbox"></div>' +
  576. '<div class="timewicket">' +
  577. '<div class="wickettitle"><div class="colse"></div></div>' +
  578. '<p class="presentation">很抱歉,暂时无法转接人工客服<br />人工客服的服务时间为:上午 ' +
  579. '<span class="clock">8:30</span> -- 下午<span class="clock">21:00</span>' +
  580. '</p>' +
  581. '<button class="sureok">确定</button>' +
  582. '</div>' +
  583. '</div>'); //客服工作时间窗口
  584. $("body").append($entirety);
  585. $entirety.append($dialogbox).fadeIn();
  586. $entirety.append($dialogue);
  587. $dialogbox.append($topcon, $dialogueleft, $morecon, $servicetime);
  588. $dialogue.append($topcontwo, $iframebox);
  589. $dialogueleft.append($chatting, $incontent);
  590. $morecon.append($query, $homepage, $correlation, $survey);
  591. cur.initmove();
  592. $(document).on("click", function() {
  593. cur.moverot();
  594. });
  595. };
  596. p.moverot = function() {
  597. var cur = this;
  598. //获取拖拽的对象
  599. var boxDom = document.getElementById("robotbox");
  600. var robotDialogBox = document.getElementById("robotDialogBox");
  601. var boxtDom = document.getElementById("dialoguespeak");
  602. var rgDialogBox = document.getElementById("rgDialogBox");
  603. //点击切换层级
  604. $(".topcon").on("click", function() {
  605. $(this).parent().addClass("rgkhIndex").siblings().removeClass("rgkhIndex");
  606. });
  607. //绑定拖拽事件
  608. boxDom.onmousedown = function(e) {
  609. //获取元素的坐标
  610. var x = e.clientX - robotDialogBox.offsetLeft - 450;
  611. var y = e.clientY - robotDialogBox.offsetTop;
  612. var maxW = window.innerWidth - robotDialogBox.offsetWidth + 430;
  613. var maxH = window.innerHeight - robotDialogBox.offsetHeight;
  614. //拖到
  615. document.onmousemove = function(e) {
  616. var left = e.clientX - x;
  617. var top = e.clientY - y;
  618. //如果left值小于等于0的时候就让他等于0;
  619. if(left <= 450) {
  620. left = 450;
  621. }
  622. //如果top值小于等于0的时候就让他等于0;
  623. if(top <= 35) {
  624. top = 35;
  625. }
  626. //如果left值大于等于浏览器当前最大的宽度的时候就让他等于宽度;
  627. if(left >= maxW) {
  628. left = maxW;
  629. }
  630. //如果left值大于等于浏览器当前最大的高度的时候就让他等于当前高度;
  631. if(top >= maxH) {
  632. top = maxH;
  633. }
  634. robotDialogBox.style.left = left + "px";
  635. robotDialogBox.style.top = top + "px";
  636. };
  637. };
  638. boxtDom.onmousedown = function(e) {
  639. //获取元素的坐标
  640. var x = e.clientX - rgDialogBox.offsetLeft - 450;
  641. var y = e.clientY - rgDialogBox.offsetTop;
  642. var maxW = window.innerWidth - rgDialogBox.offsetWidth + 430;
  643. var maxH = window.innerHeight - rgDialogBox.offsetHeight;
  644. //拖到
  645. document.onmousemove = function(e) {
  646. var left = e.clientX - x;
  647. var top = e.clientY - y;
  648. //如果left值小于等于0的时候就让他等于0;
  649. if(left <= 450) {
  650. left = 450;
  651. }
  652. //如果top值小于等于0的时候就让他等于0;
  653. if(top <= 35) {
  654. top = 35;
  655. }
  656. //如果left值大于等于浏览器当前最大的宽度的时候就让他等于宽度;
  657. if(left >= maxW) {
  658. left = maxW;
  659. }
  660. //如果left值大于等于浏览器当前最大的高度的时候就让他等于当前高度;
  661. if(top >= maxH) {
  662. top = maxH;
  663. }
  664. rgDialogBox.style.left = left + "px";
  665. rgDialogBox.style.top = top + "px";
  666. };
  667. };
  668. //松开鼠标解绑
  669. document.onmouseup = function() {
  670. document.onmousemove = null;
  671. document.onmousedown = null;
  672. };
  673. };
  674. p.initmove = function() {
  675. new foton.Bannerlittle();
  676. this.initDom();
  677. this.closed();
  678. this.sonclosed();
  679. this.switchover();
  680. this.fontsize();
  681. this.clearcon();
  682. this.sendmes();
  683. this.worktime();
  684. this.offwork();
  685. new foton.Keyword();
  686. };
  687. /*------------------生成后效果----------------------*/
  688. p.initDom = function() {
  689. this.$entirety = $("div.entirety");
  690. this.$dialogbox = $("div.dialogbox");
  691. this.$closed = $("div.closed , #quit");
  692. this.$frameclosed = $("div.dialogue div.frameclosed");
  693. this.$options = $("ul.query li.options");
  694. this.$switchbox = $("div.switchbox");
  695. this.$sizenum = $(".select option");
  696. this.$entercontent = $("#enterContent");
  697. this.$sendmessage = $("#sendmessage");
  698. this.$chatting = $("div.chatting");
  699. this.$reminder = $("div.reminder");
  700. this.$offclose = $("div.wickettitle div.colse , button.sureok");
  701. this.$servicetime = $("div.servicetime");
  702. this.$manpower = $("a.manpower");
  703. this.$searchbox = $("div.searchcase");
  704. };
  705. /*关闭*/
  706. p.closed = function() {
  707. var cur = this;
  708. this.$closed.click(function() {
  709. cur.$dialogbox.fadeOut(500, function() {
  710. cur.$entirety.fadeOut();
  711. });
  712. });
  713. };
  714. /*人工客服关闭窗口*/
  715. p.sonclosed = function() {
  716. var cur = this;
  717. $("div.frameclosed").click(function() {
  718. $("#rgDialogBox").remove();
  719. });
  720. };
  721. /*选项切换*/
  722. p.switchover = function() {
  723. var cur = this;
  724. this.$options.click(function() {
  725. $(this).addClass("checked").siblings().removeClass("checked");
  726. var index = $(this).index();
  727. cur.$switchbox.eq(index).fadeIn(800).siblings("div.switchbox").hide();
  728. if(index == 1) { // 下标1代表切换到热点问题
  729. // 热点问题
  730. $.ajax({
  731. type: "POST",
  732. url: irobot_commonUrl + "robot/rdwt",
  733. data: {
  734. pageNum: irobot_pageNum,
  735. countStr: 1
  736. },
  737. async: false,
  738. success: function(dataH) {
  739. if(dataH != null) {
  740. var dataHArr = dataH.split(",");
  741. if(dataHArr.length > 0) {
  742. var pageHtml = "<li class='prevPage' onclick='changePage(this)'>上一页</li>";
  743. irobot_pageCount = parseInt(dataHArr[dataHArr.length - 2]);
  744. irobot_totalCount = parseInt(dataHArr[dataHArr.length - 1]);
  745. if(irobot_pageCount > 6) {
  746. var sl_count = 0;
  747. // 循环得到页码
  748. for(var j = 0; j < irobot_pageCount; j++) {
  749. if(j == 0) {
  750. pageHtml += "<li class='rock' onclick='changePage(this)'>" + (parseInt(j) + 1) + "</li>";
  751. } else if(2 < j && j < irobot_pageCount - 2) {
  752. sl_count += 1;
  753. if(sl_count == 1) {
  754. pageHtml += "<li class='apostrophe'>...</li>";
  755. }
  756. } else {
  757. pageHtml += "<li onclick='changePage(this)'>" + (parseInt(j) + 1) + "</li>";
  758. }
  759. }
  760. } else {
  761. // 循环得到页码
  762. for(var j = 0; j < irobot_pageCount; j++) {
  763. if(j == 0) {
  764. pageHtml += "<li class='rock' onclick='changePage(this)'>" + (parseInt(j) + 1) + "</li>";
  765. } else {
  766. pageHtml += "<li onclick='changePage(this)'>" + (parseInt(j) + 1) + "</li>";
  767. }
  768. }
  769. }
  770. pageHtml += "<li class='nextPage' onclick='changePage(this)'>下一页</li>";
  771. $("ul[class='pagenum clearfix']").html(pageHtml);
  772. var hotQHtml = "";
  773. for(var i = 0; i < dataHArr.length - 2; i++) {
  774. hotQHtml += "<li><a href='#' onclick='showQ(this)'>" + dataHArr[i] + "</a></li>";
  775. }
  776. if(dataHArr.length < 11) {
  777. for(var j = 0; j < (11 - dataHArr.length); j++) {
  778. hotQHtml += "<li><a href='#'></a></li>";
  779. }
  780. }
  781. $(".hotpints").html(hotQHtml);
  782. }
  783. }
  784. },
  785. error: function(e) {
  786. alert("系统请求出错!");
  787. return false;
  788. }
  789. });
  790. }
  791. });
  792. };
  793. /*---------------banner--------------------------*/
  794. (function() {
  795. var Bannerlittle = function() {
  796. this.init();
  797. };
  798. var p = Bannerlittle.prototype;
  799. p.init = function() {
  800. this.dot();
  801. this.initDom();
  802. this.bannerbth();
  803. this.autoid = 0;
  804. this.autochange(this.autoid);
  805. };
  806. /*生成圆点*/
  807. p.dot = function() {
  808. var cur = this;
  809. // 生成圆点
  810. $.ajax({
  811. url: $url + "iRobot/getCarousel",
  812. async: false,
  813. success: function(data) {
  814. if(data != null) {
  815. var imgnum = data.length;
  816. var i = 0;
  817. for(i = 0; i < imgnum; i++) {
  818. $("ul.dotamount").append('<li class="banneryd"></li>');
  819. }
  820. }
  821. },
  822. error: function(e) {
  823. alert("系统请求出错!");
  824. return false;
  825. }
  826. });
  827. };
  828. p.initDom = function() {
  829. //圆点
  830. this.$banneryd = $("ul.dotamount li.banneryd");
  831. //大盒子
  832. this.$smallbannerbox = $("div.smallbannerbox");
  833. // 拼接轮播图
  834. $.ajax({
  835. url: $url + "iRobot/getCarousel",
  836. async: false,
  837. success: function(data) {
  838. if(data != null) {
  839. var htmlVal = "";
  840. for(var i = 0; i < data.length; i++) {
  841. htmlVal += '<a href="' + data[i].anchorUrl + '" target="_blank"><div class="smallbanners">' +
  842. '<img src="' + data[i].image + '" height="260" width="400"/>' +
  843. '<div class="shade">' +
  844. '<div class="shadows"></div>' +
  845. '<span class="shadeword">' + data[i].title + '</span>' +
  846. '</div>' +
  847. '</div></a>';
  848. }
  849. $(".smallbannerbox").html(htmlVal);
  850. }
  851. },
  852. error: function(e) {
  853. alert("系统请求出错!");
  854. return false;
  855. }
  856. });
  857. };
  858. p.bannerbth = function() {
  859. var cur = this;
  860. this.$banneryd.click(function() {
  861. //停止自动播放
  862. cur.stoptime();
  863. var id = cur.$banneryd.index(this);
  864. cur.autoid = id;
  865. cur.autochange(id);
  866. });
  867. };
  868. p.autochange = function(id) {
  869. var cur = this;
  870. var move = -id * 400;
  871. this.$smallbannerbox.stop(true, true).animate({
  872. "left": move
  873. }, 800);
  874. this.$banneryd.eq(id).addClass("pick").siblings().removeClass("pick");
  875. //自动播放
  876. this.startime();
  877. };
  878. p.startime = function() {
  879. var cur = this;
  880. var imgnum = $("div.smallbanners").children("img").length;
  881. this.timer = setTimeout(function() {
  882. if(cur.autoid < imgnum - 1) {
  883. cur.autoid++;
  884. } else {
  885. cur.autoid = 0;
  886. }
  887. cur.autochange(cur.autoid);
  888. }, 3000);
  889. };
  890. p.stoptime = function() {
  891. if(this.timer) clearTimeout(this.timer);
  892. };
  893. foton.Bannerlittle = Bannerlittle;
  894. })();
  895. /*切换字体大小*/
  896. p.fontsize = function() {
  897. var cur = this;
  898. $("#selectsnum").change(function() {
  899. var sizenum = $(this).val();
  900. $("#enterContent").css("font-size", parseInt(sizenum));
  901. });
  902. };
  903. /*聊天对话框焦点事件*/
  904. p.clearcon = function() {
  905. /*var cur = this;
  906. this.$entercontent.focus(function(){
  907. $(this).text("");
  908. });
  909. this.$entercontent.blur(function(){
  910. if(cur.$entercontent.text()==''){
  911. $(this).text("福田汽车:公司看点已经发生重大变化");
  912. }
  913. });*/
  914. };
  915. /*点击发送聊天消息*/
  916. p.sendmes = function() {
  917. var cur = this;
  918. $(document).keydown(function(event) {
  919. if(event.keyCode == 13) { //绑定回车
  920. event.preventDefault();
  921. cur.$sendmessage.trigger("click");
  922. }
  923. });
  924. this.$sendmessage.click(function() {
  925. var mes = cur.$entercontent.val();
  926. var sizenum = $("#selectsnum").val();
  927. if(!(mes == "")) {
  928. irobot_answer = mes; // 给咨询小i机器人的问题变量赋值
  929. var userId = "";
  930. // 获取当前登录用户
  931. $.ajax({
  932. url: $url + "user/getOne",
  933. type: "get",
  934. async: false,
  935. success: function(data) {
  936. if(data.data == null) {
  937. userId = "";
  938. return;
  939. } else {
  940. userId = data.data.id;
  941. }
  942. }
  943. });
  944. // 进行智能对话
  945. $.ajax({
  946. type: "POST",
  947. url: irobot_commonUrl + "robot/zndh",
  948. data: {
  949. questionVal: mes,
  950. userIdVal: userId
  951. },
  952. async: false,
  953. success: function(data) {
  954. if(data != null) {
  955. var dataArr = data.split("@");
  956. // 如果小i机器人回复的是ZRG,则显示转人工链接
  957. if(dataArr[0].trim() == "ZRG" || dataArr[0].trim() == "" || dataArr[0].trim() == "ZRG<br/>") {
  958. // 拼接问题
  959. cur.$chatting.append('<div class="putquestion clearfix">' +
  960. '<img src="' + $url + 'static/images/robot/user.jpg" alt="" width="50" height="50" class="raisepic">' +
  961. '<p class="raise" style="font-size: ' + sizenum + 'px;">' + mes + '</p></div>');
  962. // 拼接答案
  963. cur.$chatting.append('<div class="writeback clearfix">' +
  964. '<img src="' + $url + 'static/images/robot/iii.jpg" alt="" width="50" height="50" class="robotpic">' +
  965. '<p class="response" style="font-size: ' + sizenum + 'px;"><a href="#" class="manpower">转人工客服</a></p></div>');
  966. } else {
  967. // 拼接问题
  968. cur.$chatting.append('<div class="putquestion clearfix">' +
  969. '<img src="' + $url + 'static/images/robot/user.jpg" alt="" width="50" height="50" class="raisepic">' +
  970. '<p class="raise" style="font-size: ' + sizenum + 'px;">' + mes + '</p></div>');
  971. // 当问答接口中返回的type=1(表示用户触发到了标准问)时,才可进行评价(点赞或踩)
  972. if(dataArr[1] == "1") {
  973. // 拼接答案
  974. cur.$chatting.append('<div class="writeback clearfix">' +
  975. '<img src="' + $url + 'static/images/robot/iii.jpg" alt="" width="50" height="50" class="robotpic">' +
  976. '<p class="response" style="font-size: ' + sizenum + 'px;">' + dataArr[0] +
  977. '<br/><span><a href="#" onclick="showPJ(this)">【赞】</a>&nbsp;&nbsp;&nbsp;' +
  978. '<a href="#" onclick="showPJ(this)">【踩】</a>' +
  979. '</span></p></div>');
  980. // 给答案节点赋值
  981. irobot_nodeId = dataArr[2];
  982. } else {
  983. // 拼接答案
  984. cur.$chatting.append('<div class="writeback clearfix">' +
  985. '<img src="' + $url + 'static/images/robot/iii.jpg" alt="" width="50" height="50" class="robotpic">' +
  986. '<p class="response" style="font-size: ' + sizenum + 'px;">' + dataArr[0] + '</p></div>');
  987. }
  988. }
  989. }
  990. },
  991. error: function(e) {
  992. alert("系统请求出错!");
  993. return false;
  994. }
  995. });
  996. } else {
  997. cur.$reminder.stop(true, false).fadeIn().delay(1000).fadeOut();
  998. }
  999. cur.$entercontent.val("");
  1000. cur.$entercontent.focus(); // 光标回填
  1001. cur.$chatting.scrollTop($("div.chatting")[0].scrollHeight);
  1002. cur.$searchbox.hide();
  1003. });
  1004. };
  1005. /*工作时间转人工,非工作时间弹出窗口*/
  1006. p.worktime = function() {
  1007. var cur = this;
  1008. var begintime = 830;
  1009. var endtime = 2100;
  1010. var d = new Date();
  1011. var h = d.getHours();
  1012. $(document).on('click', 'a.manpower', function() {
  1013. // 获取当前服务器时间
  1014. $.ajax({
  1015. url: irobot_commonUrl + "robot/nowTime",
  1016. async: false,
  1017. success: function(data) {
  1018. if(data != null) {
  1019. h = data;
  1020. if(begintime > h || h >= endtime) {
  1021. cur.$servicetime.fadeIn();
  1022. return false;
  1023. } else {
  1024. if($(".dialogue").length == 0) {
  1025. var $topcontwo = $('<div class="topcon" id="dialoguespeak">' +
  1026. '<img src="' + $url + 'static/images/robot/machine.png" width="64" height="96" class="machine"/>' +
  1027. '<div class="motivational">' +
  1028. '<span class="smalli">福田公司人工客服</span>' +
  1029. '<span class="allday">竭诚为您服务</span>' +
  1030. '</div>' +
  1031. '<div class="frameclosed"></div>' +
  1032. '</div>'); //标题
  1033. var $iframeBox = $('<iframe name="zrgIframe" src="https://foton.custhelp.com/app/mobile/chat/chat_landing_home" width="500" height="540" class="framebox" scrolling="no"></iframe>');
  1034. var $rgkhBox = $('<div class="dialogue" id="rgDialogBox"></div>');
  1035. $("div.entirety").append($rgkhBox);
  1036. $rgkhBox.append($topcontwo, $iframeBox);
  1037. cur.sonclosed();
  1038. }
  1039. var userId = "";
  1040. // 获取当前登录用户
  1041. $.ajax({
  1042. url: $url + "user/getOne",
  1043. type: "get",
  1044. async: false,
  1045. success: function(data) {
  1046. if(data.data == null) {
  1047. userId = "";
  1048. return;
  1049. } else {
  1050. userId = data.data.id;
  1051. }
  1052. }
  1053. });
  1054. // 智能对话历史记录
  1055. $.ajax({
  1056. type: "POST",
  1057. url: irobot_commonUrl + "robot/zndhHistory",
  1058. data: {
  1059. questionVal: "再见",
  1060. userIdVal: userId
  1061. },
  1062. async: false,
  1063. success: function(dataHistory) {
  1064. if(dataHistory != null) {
  1065. dataHistory = dataHistory.substring(0, dataHistory.lastIndexOf("客户"));
  1066. var robot_url = "https://foton.custhelp.com/app/mobile/chat/chat_landing_home";
  1067. cur.openlabour(); // 弹出转人工弹出框
  1068. var form1 = document.createElement("form");
  1069. form1.id = "form1";
  1070. form1.name = "form1";
  1071. // 添加到 body 中
  1072. document.body.appendChild(form1);
  1073. var input = document.createElement("input");
  1074. input.type = "text";
  1075. input.name = "Contact.Name.First";
  1076. input.value = "";
  1077. var input1 = document.createElement("input");
  1078. input1.type = "text";
  1079. input1.name = "Incident.CustomFields.c.phonnum";
  1080. input1.value = "";
  1081. var textarea = document.createElement("textarea");
  1082. textarea.name = "Incident.CustomFields.c.chathis_xiaoi";
  1083. textarea.textContent = dataHistory;
  1084. var input3 = document.createElement("input");
  1085. input3.type = "text";
  1086. input3.name = "Incident.CustomFields.c.sr_acceptchannel";
  1087. input3.value = "26";
  1088. form1.appendChild(input);
  1089. form1.appendChild(input1);
  1090. form1.appendChild(textarea);
  1091. form1.appendChild(input3);
  1092. form1.method = "POST";
  1093. form1.target = "zrgIframe";
  1094. form1.action = robot_url;
  1095. form1.submit();
  1096. document.body.removeChild(form1);
  1097. }
  1098. },
  1099. error: function(e) {
  1100. alert("系统请求出错!");
  1101. return false;
  1102. }
  1103. });
  1104. }
  1105. }
  1106. }
  1107. });
  1108. });
  1109. };
  1110. /*关闭(提示下班窗口)*/
  1111. p.offwork = function() {
  1112. var cur = this;
  1113. this.$offclose.click(function() {
  1114. cur.$servicetime.fadeOut();
  1115. });
  1116. };
  1117. /*连接呼叫中心*/
  1118. p.openlabour = function() {
  1119. var cur = this;
  1120. // $("#robotDialogBox").fadeOut();
  1121. $("#rgDialogBox").fadeIn();
  1122. };
  1123. /*------------输入关键字出联想框-----------*/
  1124. (function() {
  1125. var Keyword = function() {
  1126. this.init();
  1127. };
  1128. var p = Keyword.prototype;
  1129. var ularray = [];
  1130. p.init = function() {
  1131. this.initDom();
  1132. //点击选项
  1133. this.onclick();
  1134. //绑定keyup事件
  1135. this.call();
  1136. };
  1137. p.initDom = function() {
  1138. this.$ul = $("div.searchcase ul.warning");
  1139. this.$enterContent = $("#enterContent");
  1140. this.$searchbox = $("div.searchcase");
  1141. };
  1142. p.keyup = function(flag) {
  1143. var cur = this;
  1144. var textcon = cur.$enterContent.val();
  1145. var searchbox = cur.$searchbox.html();
  1146. var array = [];
  1147. var zhongwenStr = /[\u4e00-\u9fa5]/;
  1148. var daxieStr = /^[A-Z]+$/;
  1149. // 如果是中文或大写字母,则进行智能提示
  1150. if(zhongwenStr.test(textcon) || daxieStr.test(textcon)) {
  1151. // 进行智能提示
  1152. $.ajax({
  1153. type: "POST",
  1154. url: irobot_commonUrl + "robot/znts",
  1155. data: {
  1156. inputVal: textcon
  1157. },
  1158. async: false,
  1159. success: function(dataVal) {
  1160. if(dataVal != null && dataVal != "") {
  1161. ularray = [];
  1162. var data = [];
  1163. var dataArr = dataVal.split(",");
  1164. for(var i = 0; i < dataArr.length; i++) {
  1165. var dataObj = {
  1166. i: dataArr[i]
  1167. };
  1168. data.push(dataObj);
  1169. }
  1170. $.each(data, function(index, item) {
  1171. var li = $("<li title=''></li>");
  1172. $.each(item, function(name, value) {
  1173. var con = li.html(value);
  1174. var til = li.attr("title", value);
  1175. ularray.push(value);
  1176. });
  1177. cur.$ul.append(li);
  1178. });
  1179. //排序
  1180. ularray.sort();
  1181. }
  1182. },
  1183. error: function(e) {
  1184. alert("系统请求出错!");
  1185. return false;
  1186. }
  1187. });
  1188. }
  1189. with(searchbox) {
  1190. var ulHTML = searchbox.match(/<[^>]*>/)[0]; //拿到开始标签
  1191. var val = ularray + "";
  1192. var i = 0;
  1193. for(i = 0; i < ularray.length; i++) {
  1194. //分割成字符串数组
  1195. if(val.split(",")[i].indexOf(textcon) !== -1 || flag) {
  1196. array[array.length] = "<li title='" + ularray[i] + "'>" + ularray[i] + "</li>";
  1197. }
  1198. } //把新得到的集合放入数组
  1199. var liHtml = "";
  1200. $.each(array, function(item, val) {
  1201. liHtml += val;
  1202. }); //去掉数组间逗号
  1203. var divObj = ulHTML + liHtml + "</ul>";
  1204. this.$ul.html(divObj);
  1205. cur.onclick(); //让新得到的数组拥有点击功能
  1206. //判断是否有匹配条目如有显示框体
  1207. if(cur.$enterContent.val() === "" && cur.$ul.find("li").length > 0) {
  1208. cur.$searchbox.hide();
  1209. } else if(cur.$ul.find("li").length === 0) {
  1210. cur.$searchbox.hide();
  1211. } else {
  1212. cur.$searchbox.show();
  1213. }
  1214. };
  1215. };
  1216. p.onclick = function() {
  1217. var cur = this;
  1218. $("ul.warning li").click(function() {
  1219. var keytext = $(this).html();
  1220. cur.$enterContent.empty().val(keytext);
  1221. cur.$searchbox.hide();
  1222. });
  1223. };
  1224. p.call = function() {
  1225. var cur = this;
  1226. this.$enterContent.bind("keyup", function() {
  1227. cur.keyup(0);
  1228. });
  1229. };
  1230. foton.Keyword = Keyword;
  1231. })();
  1232. foton.irobot = irobot;
  1233. })();
  1234. //链接
  1235. (function() {
  1236. var links = function(i) {
  1237. this.initDom();
  1238. this.initlinks(i);
  1239. };
  1240. var p = links.prototype;
  1241. p.initDom = function() {
  1242. this.$navPanel = $("div.navPanel a");
  1243. };
  1244. p.initlinks = function(i) {
  1245. var cur = this;
  1246. cur.$navPanel.eq(i).addClass("present");
  1247. };
  1248. foton.links = links;
  1249. })();
  1250. /* 访问统计 */
  1251. (function() {
  1252. var vistNum = function() {
  1253. this.init();
  1254. };
  1255. var p = vistNum.prototype;
  1256. p.init = function() {
  1257. this.openTime = this.now = new Date().getTime();
  1258. this.cookieset = false;
  1259. this.initUnload();
  1260. };
  1261. p.initUnload = function() {
  1262. var cur = this;
  1263. window.onbeforeunload = function() {
  1264. var cookies = document.cookie;
  1265. var uuid = null;
  1266. var cookielist = cookies.split(";");
  1267. for(var i = 0; i < cookielist.length; i++) {
  1268. var c = cookielist[i];
  1269. if(cur.startstr(c, 'fotonuuid')) {
  1270. cur.cookieset = true;
  1271. }
  1272. }
  1273. if(cur.cookieset == false) {
  1274. //有cookie向其中写入值
  1275. uuid = cur.guid();
  1276. } else {
  1277. uuid = $.cookie('fotonuuid');
  1278. cur.vistUpData(uuid);
  1279. }
  1280. };
  1281. $(window).focus(function() {
  1282. cur.openTime = new Date().getTime();
  1283. });
  1284. $(window).blur(function() {
  1285. cur.stopTime();
  1286. });
  1287. };
  1288. p.stopTime = function() {
  1289. if(!isNaN(this.residenceTime)) {
  1290. this.residenceTime += (new Date().getTime() - this.openTime);
  1291. } else {
  1292. this.residenceTime = 0;
  1293. this.residenceTime += (new Date().getTime() - this.openTime);
  1294. }
  1295. };
  1296. p.vistUpData = function(uuid) {
  1297. var cur = this;
  1298. this.stopTime();
  1299. var ipAddr = ip;
  1300. if(ip.length <= 0) {
  1301. return;
  1302. }
  1303. var location = window.location.href;
  1304. var referrer = document.referrer;
  1305. var lastTime = new Date().getTime();
  1306. var residenceTime = this.residenceTime;
  1307. var requesttime = cur.now;
  1308. var date = new Date();
  1309. var shiqu = 0 - date.getTimezoneOffset() / 60;
  1310. var tz = "";
  1311. if(shiqu > 0) {
  1312. tz = '%2B' + String(shiqu);
  1313. }
  1314. var fenbianlvW = window.screen.width;
  1315. var fenbianlvH = window.screen.height;
  1316. var fenbianlv = fenbianlvW + 'X' + fenbianlvH;
  1317. var xmlhttp;
  1318. if(window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
  1319. xmlhttp = new XMLHttpRequest();
  1320. } else { // code for IE6, IE5
  1321. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  1322. }
  1323. xmlhttp.onreadystatechange = function() {
  1324. if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {} else {}
  1325. };
  1326. xmlhttp.open("POST", $url + "statistics/close", true);
  1327. xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  1328. var message = 'ip=' + ipAddr + '&location=' + location + '&referrer=' + referrer + '&residenceTime=' + residenceTime + '&requesttime=' + cur.now + '&uuid=' + uuid + '&shiqu=' + tz + '&fenbianlv=' + fenbianlv;
  1329. xmlhttp.send(message);
  1330. };
  1331. p.guid = function() {
  1332. var cur = this;
  1333. $.ajax({
  1334. type: 'get',
  1335. url: $url + 'statistics/getUUID',
  1336. dataType: 'text',
  1337. success: function(data) {
  1338. cur.setCookie("fotonuuid", data, 24 * 12);
  1339. cur.vistUpData(data);
  1340. },
  1341. error: function(data) {
  1342. var sss = cur.S4() + cur.S4() + cur.S4() + cur.S4() + cur.S4() + cur.S4() + cur.S4() + cur.S4();
  1343. cur.setCookie("fotonuuid", sss, 24 * 12);
  1344. cur.vistUpData(sss);
  1345. }
  1346. });
  1347. };
  1348. p.S4 = function() {
  1349. return(((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  1350. };
  1351. p.startstr = function(str, uuid) {
  1352. if(uuid == null || uuid == "" || str.length == 0 || uuid.length > str.length)
  1353. return false;
  1354. var s = uuid.length;
  1355. var subr = str.substr(0, s);
  1356. if(subr == uuid) {
  1357. return true;
  1358. } else {
  1359. return false;
  1360. }
  1361. };
  1362. p.setCookie = function(name, value, seconds) {
  1363. seconds = seconds || 0; // seconds有值就直接赋值,没有为0,这个根php不一样。
  1364. var expires = "";
  1365. if(seconds != 0) { // 设置cookie生存时间
  1366. var date = new Date();
  1367. date.setTime(date.getTime() + (seconds * 1000 * 60 * 60));
  1368. expires = "; expires=" + date.toGMTString();
  1369. }
  1370. document.cookie = name + "=" + escape(value) + expires + "; path=/"; // 转码并赋值
  1371. };
  1372. foton.vistNum = vistNum;
  1373. })();
  1374. // 把问题展示在输入框中
  1375. function showQ(obj) {
  1376. $("#enterContent").empty().val(obj.text);
  1377. }
  1378. // 评价服务
  1379. function showPJ(obj) {
  1380. if(obj.text == "【赞】") {
  1381. var userId = "";
  1382. // 获取当前登录用户
  1383. $.ajax({
  1384. url: $url + "user/getOne",
  1385. type: "get",
  1386. async: false,
  1387. success: function(data) {
  1388. if(data.data == null) {
  1389. userId = "";
  1390. return;
  1391. } else {
  1392. userId = data.data.id;
  1393. }
  1394. }
  1395. });
  1396. // 进行赞或踩
  1397. $.ajax({
  1398. type: "POST",
  1399. url: irobot_commonUrl + "robot/zhc",
  1400. data: {
  1401. questionVal: irobot_answer,
  1402. userIdVal: userId,
  1403. actionVal: 1,
  1404. nodeIdVal: irobot_nodeId
  1405. },
  1406. async: false,
  1407. success: function(data) {
  1408. if(data != null) {
  1409. var dataArr = data.split(":");
  1410. if(dataArr[0] == 0) {
  1411. $(obj).parent().empty().text("【你已点了赞】");
  1412. } else {
  1413. alert(dataArr[1] + "评价失败!");
  1414. return false;
  1415. }
  1416. }
  1417. },
  1418. error: function(e) {
  1419. alert("系统请求出错!");
  1420. return false;
  1421. }
  1422. });
  1423. }
  1424. if(obj.text == "【踩】") {
  1425. var userId = "";
  1426. // 获取当前登录用户
  1427. $.ajax({
  1428. url: $url + "user/getOne",
  1429. type: "get",
  1430. async: false,
  1431. success: function(data) {
  1432. if(data.data == null) {
  1433. userId = "";
  1434. return;
  1435. } else {
  1436. userId = data.data.id;
  1437. }
  1438. }
  1439. });
  1440. // 进行赞或踩
  1441. $.ajax({
  1442. type: "POST",
  1443. url: irobot_commonUrl + "robot/zhc",
  1444. data: {
  1445. questionVal: irobot_answer,
  1446. userIdVal: userId,
  1447. actionVal: 2,
  1448. nodeIdVal: irobot_nodeId
  1449. },
  1450. async: false,
  1451. success: function(data) {
  1452. if(data != null) {
  1453. var dataArr = data.split(":");
  1454. if(dataArr[0] == 0) {
  1455. $(obj).parent().empty().text("【你已点了踩】");
  1456. } else {
  1457. alert(dataArr[1] + "评价失败!");
  1458. return false;
  1459. }
  1460. }
  1461. },
  1462. error: function(e) {
  1463. alert("系统请求出错!");
  1464. return false;
  1465. }
  1466. });
  1467. }
  1468. }
  1469. // 点击分页
  1470. function changePage(obj) {
  1471. if(obj.textContent == "上一页") {
  1472. if(irobot_pageNum == 1) {
  1473. alert("已经是第一页");
  1474. } else {
  1475. irobot_pageNum = parseInt(irobot_pageNum) - 1;
  1476. if(irobot_pageCount > 6) {
  1477. if(parseInt(irobot_pageNum) % 3 == 0 && parseInt(irobot_pageNum) < irobot_pageCount - 3) {
  1478. var pageHtml = "<li class='prevPage' onclick='changePage(this)'>上一页</li>";
  1479. var sl_count = 0;
  1480. // 循环得到页码
  1481. for(var j = parseInt(irobot_pageNum) - 3; j < irobot_pageCount; j++) {
  1482. if(j == parseInt(irobot_pageNum) - 1) {
  1483. pageHtml += "<li class='rock' onclick='changePage(this)'>" + (parseInt(j) + 1) + "</li>";
  1484. } else if(parseInt(irobot_pageNum) - 2 < j && j < irobot_pageCount - 2) {
  1485. sl_count += 1;
  1486. if(sl_count == 1) {
  1487. pageHtml += "<li class='apostrophe'>...</li>";
  1488. }
  1489. } else {
  1490. pageHtml += "<li onclick='changePage(this)'>" + (parseInt(j) + 1) + "</li>";
  1491. }
  1492. }
  1493. pageHtml += "<li class='nextPage' onclick='changePage(this)'>下一页</li>";
  1494. $("ul[class='pagenum clearfix']").html(pageHtml);
  1495. }
  1496. }
  1497. }
  1498. } else if(obj.textContent == "下一页") {
  1499. if(irobot_totalCount < parseInt(irobot_pageNum) * 9) {
  1500. alert("已经是最后一页");
  1501. } else {
  1502. if(irobot_pageCount > 6) {
  1503. if(parseInt(irobot_pageNum) % 3 == 0 && parseInt(irobot_pageNum) < irobot_pageCount - 3) {
  1504. var pageHtml = "<li class='prevPage' onclick='changePage(this)'>上一页</li>";
  1505. var sl_count = 0;
  1506. // 循环得到页码
  1507. for(var j = parseInt(irobot_pageNum); j < irobot_pageCount; j++) {
  1508. if(j == parseInt(irobot_pageNum)) {
  1509. pageHtml += "<li class='rock' onclick='changePage(this)'>" + (parseInt(j) + 1) + "</li>";
  1510. } else if(parseInt(irobot_pageNum) + 2 < j && j < irobot_pageCount - 2) {
  1511. sl_count += 1;
  1512. if(sl_count == 1) {
  1513. pageHtml += "<li class='apostrophe'>...</li>";
  1514. }
  1515. } else {
  1516. pageHtml += "<li onclick='changePage(this)'>" + (parseInt(j) + 1) + "</li>";
  1517. }
  1518. }
  1519. pageHtml += "<li class='nextPage' onclick='changePage(this)'>下一页</li>";
  1520. $("ul[class='pagenum clearfix']").html(pageHtml);
  1521. }
  1522. }
  1523. irobot_pageNum = parseInt(irobot_pageNum) + 1;
  1524. }
  1525. } else {
  1526. irobot_pageNum = obj.textContent;
  1527. }
  1528. // 移除选中样式
  1529. $("ul[class='pagenum clearfix']").find("li").css({
  1530. background: "#FFFFFF",
  1531. color: "#000000"
  1532. });
  1533. // 热点问题
  1534. $.ajax({
  1535. type: "POST",
  1536. url: irobot_commonUrl + "robot/rdwt",
  1537. data: {
  1538. pageNum: irobot_pageNum,
  1539. countStr: 2
  1540. },
  1541. async: false,
  1542. success: function(dataH) {
  1543. if(dataH != null) {
  1544. var dataHArr = dataH.split(",");
  1545. if(dataHArr.length > 0) {
  1546. var hotQHtml = "";
  1547. for(var i = 0; i < dataHArr.length; i++) {
  1548. hotQHtml += "<li><a href='#' onclick='showQ(this)'>" + dataHArr[i] + "</a></li>";
  1549. }
  1550. if(dataHArr.length < 9) {
  1551. for(var j = 0; j < (9 - dataHArr.length); j++) {
  1552. hotQHtml += "<li><a href='#'></a></li>";
  1553. }
  1554. }
  1555. $(".hotpints").html(hotQHtml);
  1556. var pageObj = $("ul[class='pagenum clearfix']").find("li");
  1557. for(var i = 0; i < pageObj.text().length; i++) {
  1558. if(pageObj.eq(i).text() == irobot_pageNum) {
  1559. // 设置选中样式
  1560. pageObj.eq(i).css({
  1561. background: "#0065b3",
  1562. color: "#fff"
  1563. });
  1564. }
  1565. }
  1566. }
  1567. }
  1568. },
  1569. error: function(e) {
  1570. alert("系统请求出错!");
  1571. return false;
  1572. }
  1573. });
  1574. }