login.js 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726
  1. /**统一登录js文件**/
  2. var loginfg='';//websocket请求标识
  3. var bIE9=false;
  4. if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/[6789]./i)) {
  5. bIE9=true
  6. }
  7. var wsUrl = "ws"+(!bIE9&&"https:"==document.location.protocol?"s":"")+"://"+window.location.host+"/ws";
  8. var ws = null;
  9. var openid = "";
  10. var jylgi = 0;
  11. var loginflag = false;//登录状态
  12. var mynum = "";//页面参数num
  13. var keysorpname = "";//项目名称
  14. var thurl = "";//url
  15. var semnum = "";//SEM
  16. var ldpnum = "";//落地页扫码后调整标识
  17. var ldmold = "";//落地页扫码后调整标识
  18. var pageshareid = "";
  19. var kopshareid = "";
  20. var oldshareid = "";
  21. var encryptId = null;
  22. var qr_type = "s";
  23. var unseatflag = false;//未登录情况下,用户点击超级搜索等开启按钮或者功能,根据此状态看是否弹出二维码
  24. var unseatzbqyflag = false;//未登录情况下,用户点击中标企业等开启按钮或者功能,根据此状态看是否弹出二维码
  25. var sendMsgInterval = null;
  26. var entjumpflag = false;
  27. //轮询查询
  28. var LoginPolling = {
  29. isPostLoginPolling: true,//是否发起轮询请求
  30. loginPollingInterval: null,
  31. initInterval: null,
  32. init: function(){
  33. //防止重复调用
  34. if(this.initInterval != null){
  35. return;
  36. }
  37. //先发一个消息,保存session
  38. this.postShareid();
  39. this.initInterval = setInterval(this.postShareid,3000);
  40. },
  41. postShareid: function(){
  42. if(WSpolling.isPageHidden || pageshareid == "" || kopshareid == ""){
  43. return;
  44. }
  45. $.ajax({
  46. type: "POST",
  47. url: "/front/ajaxPolling",
  48. data: {reqType: 1,shareIds: pageshareid+"___"+kopshareid},
  49. dataType: "json",
  50. timeout: 3000,
  51. success: function(r){
  52. clearInterval(LoginPolling.initInterval);
  53. LoginPolling.initInterval = null;
  54. }
  55. });
  56. },
  57. start: function(){
  58. //防止重复调用
  59. if(this.loginPollingInterval != null){
  60. return;
  61. }
  62. this.init();
  63. //定时器,定时请求看是否扫码登录,返回用户信息,登录
  64. this.loginPollingInterval = setInterval(function(){
  65. //如果浏览器不支持webscoket,走ajax轮询方式
  66. if(WSpolling.isPageHidden || !LoginPolling.isPostLoginPolling){
  67. return;
  68. }
  69. $.ajax({
  70. type: "POST",
  71. url: "/front/ajaxPolling",
  72. data: {reqType:2},
  73. dataType: "json",
  74. timeout: 3000,
  75. success: function(r){
  76. if(!jQuery.isEmptyObject(r)){
  77. logic(r,mynum);
  78. }
  79. }
  80. });
  81. },5000);
  82. },
  83. stop: function(){
  84. clearInterval(this.loginPollingInterval);
  85. this.loginPollingInterval = null;
  86. this.isPostLoginPolling = false;
  87. this.initInterval = null;
  88. }
  89. }
  90. var webSocketHeartCheck = new WebSocketHeartCheck(LoginPolling);
  91. //创建websocket连接
  92. var createWebSocket = function(){
  93. if("WebSocket" in window){
  94. try{
  95. ws = new WebSocket(wsUrl);//实例化websocket对象
  96. initEventHandle();
  97. }catch(e){
  98. reconnect();
  99. //console.log(e)
  100. }
  101. }else{
  102. LoginPolling.isPostLoginPolling = true;
  103. }
  104. }
  105. //
  106. var initEventHandle = function(){
  107. ws.onmessage = function(e){
  108. //接收消息正常,就不再发ajax轮询
  109. LoginPolling.isPostLoginPolling = false;
  110. if(e.data==""){
  111. return
  112. }else if(e.data=="HeartBeat"){//心跳检测
  113. //如果获取到消息,心跳检测重置
  114. //拿到任何消息都说明当前连接是正常的
  115. webSocketHeartCheck.reset().start(ws,loginflag);
  116. return;
  117. }
  118. //用户登录
  119. logic($.parseJSON(e.data),mynum);
  120. }
  121. ws.onerror = function(e){
  122. //console.info("onerror");
  123. reconnect();
  124. }
  125. ws.onclose = function(e) {
  126. //console.info("onclose");
  127. reconnect();
  128. }
  129. ws.onopen = function(e) {
  130. SendMsg();
  131. //心跳检测重置
  132. webSocketHeartCheck.reset().start(ws,loginflag);
  133. }
  134. }
  135. //
  136. function reconnect() {
  137. if(webSocketHeartCheck.lockReconnect || loginflag){
  138. return;
  139. }
  140. LoginPolling.isPostLoginPolling = true;
  141. webSocketHeartCheck.lockReconnect = true;
  142. LoginPolling.init();
  143. //没连接上会一直重连,设置延迟避免请求过多
  144. setTimeout(function () {
  145. createWebSocket();
  146. webSocketHeartCheck.lockReconnect = false;
  147. }, 2000);
  148. }
  149. //websocket查看用户是否登录
  150. var JYLogin = function(num){
  151. clearInterval(loginfg)
  152. loginfg = setInterval(function(){
  153. jylgi++;
  154. //console.log(jylgi+"-----")
  155. if(jylgi>120*60){
  156. getNewShareId(num,false);
  157. jylgi = 0;
  158. }
  159. },1000)
  160. }
  161. var SendMsg = function(){
  162. if(pageshareid==""||kopshareid==""){
  163. return;
  164. }
  165. if(ws!=null&&ws.readyState==1){
  166. //console.log("发送:"+pageshareid+"___"+kopshareid)
  167. ws.send(pageshareid+"___"+kopshareid);
  168. }else{
  169. LoginPolling.isPostLoginPolling = true;
  170. }
  171. }
  172. //生成页面二维码,不同页面处理逻辑
  173. var getNewShareId = function(num,isFirst){
  174. mynum = num;
  175. pageType = "T"
  176. var rref = document.referrer;
  177. if (localStorage.getItem("oldshareid")!=null){
  178. oldshareid=localStorage.getItem("oldshareid");
  179. }
  180. //console.log("num:"+num)
  181. $.post("/front/getLoginNum/"+num,{rref:rref,oid:oldshareid},function(data){
  182. if($("#bidLogin").attr("data-rec")=="sjdc"){
  183. window.location.href = "/front/dataExport/toSieve";
  184. return;
  185. }
  186. if(data&&data.num){
  187. pageshareid = data.num;
  188. kopshareid = data.numot;
  189. mynum = num;
  190. if(!loginflag){
  191. if(isFirst){
  192. LoginPolling.start();
  193. createWebSocket();
  194. }else if(!isFirst){
  195. LoginPolling.init();
  196. SendMsg();
  197. }
  198. }
  199. localStorage.setItem("oldshareid", pageshareid);
  200. //redisUserInfo(pageshareid,kopshareid);
  201. $(".jyhead_qr img").attr("src","/front/share/"+pageshareid);
  202. $("#bottomimg").attr("src","/front/share/"+pageshareid);
  203. $("*[data-share-img]").attr("src","/front/share/"+pageshareid);
  204. $("#layerImg-login").attr("src","/front/share/"+pageshareid);
  205. $("#layerImg-zbsq").attr("src","/front/share/"+pageshareid);
  206. switch(num){
  207. case "10"://首页
  208. //$("#layerImg").attr("src","/front/share/"+pageshareid);
  209. //$("#sy-shareimg img").attr("src","/front/share/"+pageshareid);
  210. $(".wxlinkdiv").attr("src","/front/share/"+pageshareid);
  211. break;
  212. case "11"://订阅页面
  213. $("#dyym-1 img").attr("src","/front/share/"+kopshareid);
  214. $("#dyym-2").attr("src","/front/share/"+pageshareid);
  215. $(".secondleft img").attr("src","/front/share/"+pageshareid);
  216. $("#vipCode").attr("src","/front/share/"+kopshareid);
  217. break;
  218. case "12"://搜索列表页
  219. $("#layerImg").attr("src","/front/share/"+pageshareid);
  220. $("#wxCode").attr("src","/front/share/"+pageshareid);
  221. $("#keyImg").attr("src","/front/share/"+kopshareid);
  222. if(keysorpname!=undefined&&keysorpname!=""){
  223. var ref = document.referrer;
  224. if(ref != ""&&ref.indexOf("jianyu360.com")<0||ref.indexOf("qmx.top")<0){
  225. $.post("/front/rediskw",{"skw":keysorpname,"num":kopshareid});
  226. }
  227. }
  228. break;
  229. case "13": case "130"://快照页
  230. $("#layerImg").attr("src","/front/share/"+pageshareid);
  231. $("#wxCode").attr("src","/front/share/"+kopshareid);
  232. //生成二维码
  233. if(keysorpname!=undefined&&keysorpname!=""){
  234. $.post("/front/rediskw",{"skw":keysorpname,"num":kopshareid});
  235. }
  236. break;
  237. case "14"://标签页面
  238. $("#bottomimg").attr("src","/front/share/"+pageshareid);
  239. $("*[data-share-img]").attr("src","/front/share/"+pageshareid);
  240. $("#layerImg").attr("src","/front/share/"+pageshareid);
  241. $("#keyImg").attr("src","/front/share/"+pageshareid);
  242. break;
  243. case "15"://博客列表和内容页面
  244. break;
  245. case "16"://关于我们页面
  246. break;
  247. case "18"://扫码关注企业18
  248. $("#layerImg").attr("src","/front/share/"+pageshareid);
  249. var company = $.trim($("#zbSeatchT input[name='keywords']").val());
  250. if(company != "" && company != null && company.length >0){
  251. $("#keyImg").attr("src","/front/share/"+kopshareid);
  252. $.post("/front/rediskw",{"skw":company,"num":kopshareid});
  253. }else{
  254. $("#keyImg").attr("src","/front/share/"+pageshareid);
  255. }
  256. break;
  257. case "19"://拟建项目
  258. $("#layerImg").attr("src","/front/share/"+pageshareid);
  259. $("#wxCode").attr("src","/front/share/"+pageshareid);
  260. $("#keyImg").attr("src","/front/share/"+kopshareid);
  261. if(keysorpname!=undefined&&keysorpname!=""){
  262. $.post("/front/rediskw",{"skw":keysorpname,"num":kopshareid});
  263. }
  264. break;
  265. case "17"://1808新落地页
  266. $(".ewm1").attr("src","/front/share/"+pageshareid);
  267. $(".ewm2").attr("src","/front/share/"+kopshareid);
  268. $("#kwewm").attr("src","/front/share/"+kopshareid);
  269. $(".ecode_img img").attr("src","/front/share/"+kopshareid).css("display","");
  270. break;
  271. case "23"://数据导出
  272. break;
  273. }
  274. JYLogin(num);
  275. }
  276. },'json');
  277. }
  278. //
  279. var redisUserInfo = function(pid,kid){
  280. var rurl = window.location.href;
  281. var rref = document.referrer;
  282. if (localStorage.getItem("oldshareid")!=null){
  283. oldshareid=localStorage.getItem("oldshareid");
  284. }
  285. $.post("/front/followinfo",{pid:pid,kid:kid,rurl:rurl,rref:rref,oid:oldshareid},function(data){
  286. if(data&&data.result=="ok"){
  287. localStorage.setItem("oldshareid", pid);
  288. }
  289. })
  290. }
  291. function checkBigStatus () {
  292. $.ajax({
  293. type: 'post',
  294. url: '/bigmember/use/isAdd',
  295. success: function (res) {
  296. if (res && res.data) {
  297. window.memberStatus = res.data.memberStatus
  298. window.memberPower = res.data.power
  299. window.vipStatus = res.data.vipStatus
  300. sessionStorage.setItem('bidPower', JSON.stringify(res.data.power))
  301. if (res.data.memberStatus > 0) {
  302. $(".myorderDiv.lastBox").show()
  303. }
  304. if (res.data.viper) {
  305. $(".myorderDiv.ent-search").show()
  306. }
  307. }
  308. }
  309. })
  310. }
  311. // 查询商机管理PC权限
  312. function checkMenuForEnt () {
  313. $.ajax({
  314. type: 'get',
  315. url: '/entbase/ent/mySelectent?t=' + new Date().getTime(),
  316. success: function () {
  317. $.ajax({
  318. type: 'get',
  319. url: '/front/entExportAuth/getAuth?t=' + new Date().getTime(),
  320. success: function (r) {
  321. var tempHtml = ''
  322. if(r.myEntMenu){
  323. tempHtml += "<div class=\"myorderDiv\" onclick=\"window.location.href='/entpc/myent'\">"
  324. +"<span>我的企业</span>"
  325. +"</div>"
  326. }
  327. if(r.entnicheMenu){
  328. tempHtml+= "<div class=\"myorderDiv\" onclick=\"window.location.href='/entpc/bus'\">"
  329. +"<span>商机管理</span>"
  330. +"</div>"
  331. }
  332. $(".infoList .lastBox").before(tempHtml)
  333. }
  334. })
  335. }
  336. })
  337. }
  338. //查询用户信息,响应页面登录信息
  339. var logic = function(data,num){
  340. if(data.result=="ok"){
  341. clearLoginStorage(/-login-clear/)
  342. //$(".QRLogin").hide();
  343. $("#bidLogin").modal("hide")
  344. $("#bidcommunity").modal("hide")
  345. clearInterval(loginfg);
  346. loginflag = true;
  347. processpage(data.shareid,num);
  348. //登录成功,停止轮询
  349. LoginPolling.stop();
  350. //登录成功,停止心跳监测
  351. webSocketHeartCheck.reset();
  352. if(ws.readyState==1){
  353. ws.send("close");
  354. ws.close();
  355. }
  356. encryptId = data.encryptId
  357. if(data.s_nickname.length>11){
  358. data.s_nickname = data.s_nickname.substring(0,11);
  359. data.s_nickname = data.s_nickname + "...";
  360. }
  361. var hhtml = "<img "
  362. if(data.redisheadimg==null||data.redisheadimg==undefined||data.redisheadimg=="<nil>"){
  363. data.redisheadimg = ""
  364. }
  365. if(data.s_headimage==null||data.s_headimage==undefined||data.s_headimage=="<nil>"){
  366. data.s_headimage = ""
  367. }
  368. if(data.redisheadimg!=""){
  369. hhtml+="src='"+data.redisheadimg+"' class='imgShow nomalheadimg'"
  370. }else if(data.s_headimage!=""){
  371. hhtml+="src='"+data.s_headimage+"' class='imgShow nomalheadimg'"
  372. }else{
  373. hhtml+="src='"+data.s_headimage+"' class='imgShow'"
  374. }
  375. hhtml+=" onerror='this.src=\"/images/auto.png\";$(this).removeClass(\"nomalheadimg\");'>"
  376. +"<div class='userInfo'>"
  377. +"<div class='infoList' style='display:none'>"
  378. +"<span class='one'></span>"
  379. +"<span class='two'></span>"
  380. +"<div class='usernameDiv'>"
  381. +data.s_nickname
  382. +"</div>"
  383. +"<div class=\"myorderDiv\" onclick=\"window.location.href='/front/dataPack/index'\">"
  384. +"<span>我的数据</span>"
  385. +"</div>"
  386. +"<div class=\"myorderDiv\" style=\"border-bottom:0;\" onclick=\"window.location.href='/swordfish/docs//user/docs'\">"
  387. +"<span>我的文库</span>"
  388. +"</div>"
  389. +"<div class=\"myorderDiv\" onclick=\"window.location.href='/swordfish/docs//user/collections'\">"
  390. +"<span>文库收藏</span>"
  391. +"</div>"
  392. +"<div class=\"myorderDiv\" onclick=\"window.location.href='/swordfish/integral/index'\">"
  393. +"<span>我的剑鱼币</span>"
  394. +"</div>"
  395. +"<div class=\"myorderDiv\" onclick=\"window.location.href='/swordfish/coupon/'\">"
  396. +"<span>我的奖券</span>"
  397. +"</div>"
  398. +"<div class=\"myorderDiv\" onclick=\"window.location.href='/front/swordfish/toMyOrder'\">"
  399. +"<span>我的订单</span>"
  400. +"</div>"
  401. +"<div class=\"myorderDiv lastBox\" style='display: none' onclick=\"window.location.href='/swordfish/page_big_pc'\">"
  402. +"<span>大会员</span>"
  403. +"</div>"
  404. +"<div class=\"myorderDiv ent-search\" style='display: none' onclick=\"window.location.href='/swordfish/page_big_pc/svip/ent_search'\">"
  405. +"<span>企业查询</span>"
  406. +"</div>"
  407. +"<div class=\"myorderDiv bx-collection\" onclick=\"window.location.href='/swordfish/frontPage/collection/sess/index'\">"
  408. +"<span>标讯收藏</span>"
  409. +"</div>"
  410. hhtml+= "<div class='exitDiv' onclick='signout()'>"
  411. +"<img id='outImg' src='/images/userexit.png'/>"
  412. +"<span>退出</span>"
  413. +"</div>"
  414. +"</div>"
  415. +"</div>"
  416. $("#login").html(hhtml);
  417. try{
  418. checkBigStatus()
  419. checkMenuForEnt()
  420. infoListCss();
  421. commonMouseEvent();
  422. }catch(e){}
  423. }
  424. }
  425. //登录后处理页面逻辑
  426. var processpage = function(shareid,num){
  427. var toHref=$("#bidLogin").attr("data-rec")
  428. switch (toHref) {
  429. case "sjdc":
  430. window.location.href = "/front/dataExport/toSieve";
  431. return;
  432. case "jydocs":
  433. window.location.href = "/swordfish/docs";
  434. return;
  435. }
  436. clearInterval(loginfg);
  437. switch(num){
  438. case "10"://10首页
  439. var ful = $("#myModal").attr("aria-hidden");
  440. if(ful=="true"){
  441. break;
  442. }
  443. $("#myModal").modal("hide");
  444. // if(dataListId!=""){
  445. // setTimeout(function(){
  446. // window.open("/article/content/"+dataListId+".html");
  447. // },500)
  448. // }
  449. break;
  450. case "11"://11订阅页面
  451. //$("#myModal-01").click();
  452. $(".modal").click();
  453. break;
  454. case "12"://12搜索列表
  455. var ful = $("#myModal").attr("aria-hidden");
  456. if(ful=="true"){
  457. break;
  458. }
  459. $("#myModal").modal("hide");
  460. $("#labModal").modal("hide");
  461. if(dataId!=""){
  462. setTimeout(function(){
  463. //$('a[dataId="'+ dataId +'"]').click();
  464. var aHref = "";
  465. if(searchvalue != ""){
  466. aHref += '.html?kds='+searchvalue;
  467. }else{
  468. aHref += '.html';
  469. }
  470. window.open("/article/content/"+dataId+aHref);
  471. },500);
  472. }
  473. break;
  474. case "13": case "130"://13快照页
  475. if(thurl!=""&&thurl!="D"){
  476. window.location.href=thurl;
  477. }else if(thurl==""){
  478. window.location.href="/";
  479. }
  480. break;
  481. case "14"://14标签页面
  482. var ful = $("#myModal").attr("aria-hidden");
  483. if(ful=="true"){
  484. break;
  485. }
  486. $("#myModal").click();
  487. if(dataId!=""){
  488. setTimeout(function(){
  489. window.open("/article/content/"+dataId+".html");
  490. },500);
  491. }
  492. break;
  493. case "15"://15剑鱼标讯博客页面
  494. break;
  495. case "16"://关于我们页面16
  496. break;
  497. case "18"://中标企业搜索
  498. var ful = $("#myModal").attr("aria-hidden");
  499. if(ful=="true"){
  500. break;
  501. }
  502. $("#myModal").modal("hide");
  503. $("#labModal").modal("hide");
  504. if(dataId!=""){
  505. setTimeout(function(){
  506. //$('a[dataId="'+ dataId +'"]').click();
  507. var aHref = "";
  508. if(searchvalue != ""){
  509. aHref += '.html?kds='+searchvalue;
  510. }else{
  511. aHref += '.html';
  512. }
  513. window.open("/article/content/"+dataId+aHref);
  514. },500);
  515. }
  516. break;
  517. break;
  518. case "19"://拟建项目
  519. var ful = $("#myModal").attr("aria-hidden");
  520. if(ful=="true"){
  521. break;
  522. }
  523. $("#myModal").modal("hide");
  524. $("#labModal").modal("hide");
  525. if(dataId!=""){
  526. setTimeout(function(){
  527. var aHref = "";
  528. if(searchvalue != ""){
  529. aHref += '.html?kds='+searchvalue;
  530. }else{
  531. aHref += '.html';
  532. }
  533. window.open("/article/content/"+dataId+aHref);
  534. },500);
  535. }
  536. break;
  537. case "17"://落地页
  538. $("#bidLogin").modal("hide");
  539. $(".close").click();
  540. if(ldpnum=="0"){
  541. window.open('/jylab/supsearch/index.html', '_self')
  542. }else if(ldpnum=="1"){
  543. window.open('/front/subscribe.html', '_self')
  544. }else if(ldpnum=="2"){
  545. window.open('/jylab/supsearch/proposedProject.html', '_self')
  546. }else if(ldpnum=="3"){
  547. if(ldmold!=""){
  548. window.open('/list/stype/'+ldmold+'.html', '_self')
  549. }else{
  550. window.open('/jylab/supsearch/index.html', '_self')
  551. }
  552. }else if(ldpnum=="4"){
  553. if(ldmold!=""){
  554. window.open('/list/area/'+ldmold+'.html', '_self')
  555. }else{
  556. window.open('/jylab/supsearch/index.html', '_self')
  557. }
  558. }else if(ldpnum=="5"){
  559. if(ldmold){
  560. window.open('/article/content/'+ldmold+'.html')
  561. }else{
  562. window.open('/jylab/supsearch/index.html')
  563. }
  564. }else if(ldpnum=="6"){
  565. window.open('/front/dataExport/toSieve')
  566. }
  567. break;
  568. case "24"://百度SEM-p 快照页推广-落地页
  569. window.open(semHref, '_self')
  570. break
  571. }
  572. }
  573. function clearObjKeyForRegFn (obj, reg) {
  574. if (obj) {
  575. for(var k in obj) {
  576. if (reg.test(k)) {
  577. obj.removeItem(k)
  578. }
  579. }
  580. }
  581. }
  582. function clearLoginStorage (reg) {
  583. clearObjKeyForRegFn(sessionStorage, reg)
  584. clearObjKeyForRegFn(localStorage, reg)
  585. }
  586. //退出登录
  587. var signout = function(){
  588. clearInterval(loginfg);
  589. loginflag = false;
  590. unseatflag = false;
  591. unseatzbqyflag = false;
  592. $("#login").html("<button class='loginBtn' data-toggle='modal' onclick='openLoginDig()'>登录</button>");
  593. loginBtnType();
  594. $(".control-tabBtn>a:first>font").text("招标搜索");
  595. $(".control-tabBtn>a:eq(2)").addClass("hidden");
  596. $(".control-tabBtn>a:eq(3)").addClass("hidden");
  597. $(".superSearch").show();
  598. $.post("/front/signOut",function(data){
  599. if(data=="ok"){
  600. clearLoginStorage(/-login-clear/)
  601. try{
  602. $.cookie("userid_secure","",{expires:-1,path:"/",domain:document.domain.replace(/[^.]+/,"")});
  603. }catch(e){
  604. document.cookie = "userid_secure=;expires=-1;path=/";
  605. }
  606. window.location.href="/";
  607. var pt = new RegExp("^/article/content/.+$|^/front/dataExport/.+$|^/front/course/codePay$|^/front/course/orderPay$|^/entpc/.+$|^/bid/pc/page/.+$");
  608. if(pt.test(window.location.pathname)){
  609. window.location.href="/";
  610. }else{
  611. window.location.reload();
  612. /*LoginPolling.start();
  613. createWebSocket();
  614. getNewShareId(mynum,true);*/
  615. }
  616. }
  617. })
  618. }
  619. //查看用户是否已经登录
  620. var haslogin = function(num,kyorpn,url){
  621. mynum = num;//页面logid
  622. keysorpname = kyorpn;//其他参数
  623. thurl = url;//列表也跳转快照页url
  624. $.post("/front/hasSign",function(data, location){
  625. if(data){
  626. loginflag = true;
  627. encryptId = data.encryptId
  628. if(data.s_nickname!=null&&data.s_nickname.length>11){
  629. data.s_nickname = data.s_nickname.substring(0,11);
  630. data.s_nickname = data.s_nickname + "...";
  631. }
  632. var hhtml = "<img "
  633. if(data.redisheadimg==null||data.redisheadimg==undefined||data.redisheadimg=="<nil>"){
  634. data.redisheadimg=""
  635. }
  636. if(data.s_headimage==null||data.s_headimage==undefined||data.s_headimage=="<nil>"){
  637. data.s_headimage=""
  638. }
  639. if(data.redisheadimg!=""){
  640. hhtml+="src='"+data.redisheadimg+"' class='imgShow nomalheadimg'"
  641. }else if(data.s_headimage!=""){
  642. hhtml+="src='"+data.s_headimage+"' class='imgShow nomalheadimg'"
  643. }else{
  644. hhtml+="src='"+data.s_headimage+"' class='imgShow'"
  645. }
  646. hhtml+=" onerror='this.src=\"/images/auto.png\";$(this).removeClass(\"nomalheadimg\");'>"
  647. +"<div class='userInfo'>"
  648. +"<div class='infoList' style='display:none'>"
  649. +"<span class='one'></span>"
  650. +"<span class='two'></span>"
  651. +"<div class='usernameDiv'>"
  652. +data.s_nickname
  653. +"</div>"
  654. +"<div class=\"myorderDiv\" style=\"display:flex;align-items: center;\" onclick=\"window.location.href='/front/dataPack/index'\">"
  655. +"<span>我的数据</span>"
  656. +"<span class=\"new_msg\" >NEW</span>"
  657. +"</div>"
  658. +"<div class=\"myorderDiv\" style=\"border-bottom:0;\" onclick=\"window.location.href='/swordfish/docs//user/docs'\">"
  659. +"<span>我的文库</span>"
  660. +"</div>"
  661. +"<div class=\"myorderDiv\" onclick=\"window.location.href='/swordfish/docs//user/collections'\">"
  662. +"<span>文库收藏</span>"
  663. +"</div>"
  664. +"<div class=\"myorderDiv\" onclick=\"window.location.href='/swordfish/integral/index'\">"
  665. +"<span>我的剑鱼币</span>"
  666. +"</div>"
  667. +"<div class=\"myorderDiv\" onclick=\"window.location.href='/swordfish/coupon/'\">"
  668. +"<span>我的奖券</span>"
  669. +"</div>"
  670. +"<div class=\"myorderDiv\" onclick=\"window.location.href='/front/swordfish/toMyOrder'\">"
  671. +"<span>我的订单</span>"
  672. +"</div>"
  673. +"<div class=\"myorderDiv lastBox\" style='display: none' onclick=\"window.location.href='/swordfish/page_big_pc'\">"
  674. +"<span>大会员</span>"
  675. +"</div>"
  676. +"<div class=\"myorderDiv ent-search\" style='display: none' onclick=\"window.location.href='/swordfish/page_big_pc/svip/ent_search'\">"
  677. +"<span>企业查询</span>"
  678. +"</div>"
  679. +"<div class=\"myorderDiv bx-collection\" onclick=\"window.location.href='/swordfish/frontPage/collection/sess/index'\">"
  680. +"<span>标讯收藏</span>"
  681. +"</div>"
  682. hhtml+= "<div class='exitDiv' onclick='signout()'>"
  683. +"<img id='outImg' src='/images/userexit.png'/>"
  684. +"<span>退出</span>"
  685. +"</div>"
  686. +"</div>"
  687. +"</div>"
  688. $("#login").html(hhtml);
  689. try{
  690. checkBigStatus()
  691. checkMenuForEnt()
  692. infoListCss();
  693. commonMouseEvent();
  694. }catch(e){}
  695. }else{
  696. $("#login").html("<button class='loginBtn' data-toggle='modal' onclick='openLoginDig()'>登录</button>");
  697. loginBtnType();
  698. //pc限制登陆
  699. var nosess = getParam("nol");
  700. if (nosess=="1"&& (!loginflag) ){
  701. openLoginDig();
  702. }
  703. }
  704. getNewShareId(num,true);
  705. })
  706. }
  707. function loginBtnType(){
  708. var href = window.location.pathname;
  709. var curTheme =$("#public-nav").attr('data-theme')
  710. if (href=="/"||href.indexOf("subscribe")>-1||href.indexOf("advservices")>-1||href.indexOf("solution")>-1||href.indexOf("partner")>-1||href.indexOf("aboutus")>-1||href.indexOf("busicooperation")>-1||href.indexOf("pcindex.html")>-1||window.location.pathname==="/jyxspc/"||window.location.pathname==="/entpc/"){
  711. if(curTheme == 'dark'){
  712. $(".loginBtn").attr("onmouseover","this.style.borderColor='#2cb7ca'; this.style.color='#2cb7ca';");
  713. $(".loginBtn").attr("onmouseout","this.style.borderColor='#fff'; this.style.color='#fff';");
  714. }else{
  715. $(".loginBtn").css({"border-color":"#e0e0e0","color":"rgb(37, 38, 39)"});
  716. $(".loginBtn").attr("onmouseover","this.style.borderColor='#2cb7ca'; this.style.color='#2cb7ca';");
  717. $(".loginBtn").attr("onmouseout","this.style.borderColor='#e0e0e0'; this.style.color='#252627';");
  718. }
  719. }else if(href.indexOf("topics")>-1){
  720. $(".loginBtn").css({"border":"none"});
  721. }else{
  722. $(".loginBtn").css({"border-color":"#e0e0e0","color":"rgb(37, 38, 39)"});
  723. $(".loginBtn").attr("onmouseover","this.style.borderColor='#2cb7ca'; this.style.color='#2cb7ca';");
  724. $(".loginBtn").attr("onmouseout","this.style.borderColor='#e0e0e0'; this.style.color='#252627';");
  725. }
  726. }
  727. ///////////////////////////////
  728. // ajax部分匿名函数自执行,防止泄露全局变量
  729. $(function(){
  730. function goBackOrigin (cb) {
  731. var backOrigin = $.cookie('article')
  732. if (backOrigin) {
  733. location.replace(backOrigin)
  734. } else {
  735. typeof cb === 'function' ? cb() : window.close()
  736. }
  737. }
  738. var Direct = {
  739. verify: {},
  740. forge: {},
  741. ajaxSms: function (e, type) {
  742. var _this = this;
  743. switch (type) {
  744. case 'verify': {
  745. $.post("/phone/login",{
  746. reqType:"sendIdentCode",
  747. phone:$("#bidLogin .login-dig-input-box [name='verify_phone']").val(),
  748. code:$("#bidLogin .login-dig-input-box [name='verify_code']").val()
  749. },function(r){
  750. if(r.status==-1){
  751. _this.verify.phone.showError('手机号格式错误');
  752. }else if(r.status==-2){//图形验证码错误
  753. _this.verify.code.showError('图形验证码输入错误');
  754. $("#bidLogin .verify-img").attr("src","/front/landpage/captcha?v="+new Date().getTime());
  755. }else if(r.status==-3){//图形验证码错误
  756. _this.verify.phone.showError('手机号已被注册');
  757. $("#bidLogin .verify-img").attr("src","/front/landpage/captcha?v="+new Date().getTime());
  758. }else{
  759. sessionStorage.setItem('login-verify-start-time', new Date().getTime())
  760. startTimeDown(type)
  761. }
  762. });
  763. break
  764. }
  765. case 'register': {
  766. $.post("/phone/login",{
  767. reqType:"sendIdentCode",
  768. register: 'true',
  769. phone:$(".register-form-box .login-dig-input-box [name='register_phone']").val(),
  770. code:$(".register-form-box .login-dig-input-box [name='register_code']").val()
  771. },function(r){
  772. if(r.status==-1){
  773. _this.register.phone.showError('手机号格式错误');
  774. }else if(r.status==-2){//图形验证码错误
  775. _this.register.code.showError('图形验证码输入错误');
  776. $(".register-form-box .verify-img").attr("src","/front/landpage/captcha?v="+new Date().getTime());
  777. }else if(r.status==-3){
  778. _this.register.phone.showError('手机号已被注册');
  779. $(".register-form-box .verify-img").attr("src","/front/landpage/captcha?v="+new Date().getTime());
  780. }else{
  781. sessionStorage.setItem('login-verify-start-time', new Date().getTime())
  782. startTimeDown(type)
  783. }
  784. });
  785. break
  786. }
  787. case 'forge': {
  788. $.post("/phone/forgetPwd",{
  789. reqType:"sendIdentCode",
  790. phone:$(".forgetpwd_page .login-dig-input-box [name='forge_phone']").val(),
  791. code:$(".forgetpwd_page .login-dig-input-box [name='forge_code']").val()
  792. },function(r){
  793. if(r.status=="phoneError"){
  794. _this.forge.phone.showError('手机号格式错误');
  795. }else if(r.status=="codeError"){
  796. _this.forge.code.showError('图形验证码输入错误');
  797. $(".forgetpwd_page .verify-img").attr("src","/front/landpage/captcha?v="+new Date().getTime());
  798. }else if(r.status=="phoneNotExists"){
  799. _this.forge.phone.showError('手机号尚未注册');
  800. $(".forgetpwd_page .verify-img").attr("src","/front/landpage/captcha?v="+new Date().getTime());
  801. }else if(r.status=="y"){
  802. sessionStorage.setItem('login-verify-start-time', new Date().getTime())
  803. startTimeDown(type)
  804. }
  805. });
  806. break
  807. }
  808. case 'bind-phone': {
  809. $.post("/jypay/user/phone/bind",{
  810. step: 1,
  811. phone:$("#bidLogin .login-dig-input-box [name='verify_phone']").val(),
  812. code:$("#bidLogin .login-dig-input-box [name='verify_code']").val()
  813. },function(r){
  814. if (r && r.error_code > -1) {
  815. sessionStorage.setItem('login-verify-start-time', new Date().getTime())
  816. startTimeDown(type)
  817. } else {
  818. if (r.error_msg === '图形验证码错误') {
  819. if (_this.verify.code.value !== "HIDE") {
  820. _this.verify.code.showError(r.error_msg || '发送错误,请稍后再试');
  821. }
  822. getNewVerify()
  823. } else if (r.error_msg === '手机号已被使用') {
  824. _this.verify.phone.showError('该手机号已被绑定,请更换手机号');
  825. } else {
  826. _this.verify.sms.showError(r.error_msg || '发送错误,请稍后再试');
  827. }
  828. }
  829. });
  830. break
  831. }
  832. }
  833. },
  834. // 忘记密码
  835. ajaxStepOne: function (e, arr) {
  836. $.post("/phone/forgetPwd",{reqType:"nextStep",identCode:arr[2].value},function(r){
  837. e.setAttribute('data-loading', 'false');
  838. if(r.status=="identCodeError"){
  839. arr[2].showError('短信验证码错误');
  840. }else if(r.status=="y"){
  841. toggleStep(false);
  842. }
  843. });
  844. },
  845. ajaxStepTwo: function (e, arr) {
  846. $.post("/phone/forgetPwd",{reqType:"save",password:arr[1].value},function(r){
  847. e.setAttribute('data-loading', 'false');
  848. if(r.status=="passwordError"){
  849. arr[0].showError('密码格式错误');
  850. }else if(r.status=="passwordRepeat"){
  851. arr[0].showError('新密码不能与之前设置过的密码重复');
  852. }else{
  853. var toast = document.querySelector('.login-dig-success-toast')
  854. toast.classList.add('is-show')
  855. setTimeout(function () {
  856. toast.classList.remove('is-show')
  857. if(sessionStorage){
  858. sessionStorage.reLogin=1;
  859. }
  860. window.history.back();
  861. }, 1500);
  862. }
  863. });
  864. },
  865. // 验证码/密码登录
  866. ajaxLoginPass: function (e, arr) {
  867. $.post("/phone/login",{reqType:"phoneLogin",phone:arr[0].value,password: arr[1].value},function(r){
  868. e.setAttribute('data-loading', 'false')
  869. if(r.status==1){
  870. logic(r.userInfo,mynum);
  871. }else if(r.status==-1){
  872. arr[0].showError('该手机号未注册')
  873. }else if(r.status==-2){
  874. arr[1].showError('密码输入错误')
  875. }
  876. });
  877. },
  878. ajaxLoginSms: function (e, arr) {
  879. if ($('#bidLogin').attr('data-name') === 'bind-phone') {
  880. $.post("/jypay/user/phone/bind",{
  881. step: 2,
  882. phone: arr[0].value,
  883. code: arr[2].value,
  884. mode: isBindPage ? 'mergeBind' : ''
  885. },function(r){
  886. e.setAttribute('data-loading', 'false')
  887. if (r && r.error_code > -1) {
  888. if(r.data.state==1){
  889. if (isBindPage) {
  890. if (history.length === 1) {
  891. goBackOrigin()
  892. } else {
  893. if (document.referrer === location.href) {
  894. goBackOrigin(function () {
  895. location.href = '/'
  896. })
  897. } else {
  898. history.back()
  899. }
  900. }
  901. return
  902. }
  903. if (r.data.needMerge) {
  904. location.href = '/swordfish/frontPage/userMerge/sess/merge?token=' + r.data.mergeToken
  905. return
  906. } else {
  907. $("#bidLogin").modal("hide")
  908. sessionStorage.setItem('bind-phone', arr[0].value.trim())
  909. typeof window.callBindPhoneSuccess === 'function' && window.callBindPhoneSuccess(true)
  910. }
  911. } else if (r.data.state==2){
  912. location.replace('/swordfish/frontPage/userMerge/sess/merge?token=' + r.data.token)
  913. }
  914. } else {
  915. arr[2].showError(r.error_msg || '绑定错误,请稍后再试')
  916. }
  917. });
  918. } else {
  919. var source = getParam("source");//百度SEM
  920. if (source!=null){
  921. var pathname = window.location.pathname;
  922. if (pathname=="/front/structed/pc_index.html"){//结构化数据
  923. source+="_structed";
  924. }else if (pathname=="/bid/pc/page/bidfile_landpage"){//招标文件解读
  925. source+="_bidfile";
  926. }else if (pathname=="/big/page/index"){//大会员
  927. source+="_member";
  928. }
  929. }else{
  930. source="";
  931. }
  932. $.post("/phone/login",{reqType:"identCodeLogin",identCode:arr[2].value,"source":source},function(r){
  933. e.setAttribute('data-loading', 'false')
  934. if(r.status==1){
  935. logic(r.userInfo,mynum);
  936. }else if(r.status==-1){
  937. arr[2].showError('短信验证码输入错误')
  938. }
  939. });
  940. }
  941. },
  942. ajaxRegister: function (e, arr) {
  943. var source = getParam("source");//百度SEM
  944. if (source!=null){
  945. var pathname = window.location.pathname;
  946. if (pathname=="/front/structed/pc_index.html"){//结构化数据
  947. source+="_structed";
  948. }else if (pathname=="/bid/pc/page/bidfile_landpage"){//招标文件解读
  949. source+="_bidfile";
  950. }else if (pathname=="/big/page/index"){//大会员
  951. source+="_member";
  952. }
  953. }else{
  954. source="";
  955. }
  956. $.post("/phone/login",{reqType:"identCodeLogin",s_entname: arr[3].value, identCode:arr[2].value,"source":source},function(r){
  957. e.setAttribute('data-loading', 'false')
  958. if(r.status==1){
  959. logic(r.userInfo,mynum);
  960. var toast = document.querySelector('.login-dig-success-toast')
  961. toast.classList.add('is-show')
  962. setTimeout(function () {
  963. toast.classList.remove('is-show')
  964. window.history.back();
  965. }, 1500);
  966. }else if(r.status==-1){
  967. arr[2].showError('短信验证码输入错误')
  968. }
  969. });
  970. }
  971. }
  972. // @手机号绑定以及账号合并 2021/1/25
  973. function toggleNeedVerifyInput (f, src) {
  974. var verifyInput = $(".login-dig-tabbar-content.is-active .login-dig-input-box:eq(1)")
  975. if (($('#bidLogin').attr('data-name') === 'bind-phone')) {
  976. if (f) {
  977. if (verifyInput.find('input').val() === 'HIDE') {
  978. verifyInput.find('input').val('')
  979. Direct.verify.code.showError()
  980. }
  981. verifyInput.find('.verify-img').attr('src', src)
  982. verifyInput.show()
  983. } else {
  984. verifyInput.find('input').val('HIDE')
  985. Direct.verify.code.skip('HIDE')
  986. verifyInput.hide()
  987. }
  988. }
  989. }
  990. var oldNeedStatus = false
  991. window.getBindVerify = getNewVerify
  992. function getNewVerify (cb) {
  993. if (!oldNeedStatus) {
  994. toggleNeedVerifyInput(false)
  995. }
  996. $.ajax({
  997. url: '/jypay/user/phone/imgCaptcha?t=' + new Date().getTime(),
  998. success: function (r) {
  999. console.log(r)
  1000. if (r && r.data) {
  1001. oldNeedStatus = r.data.needVerify
  1002. if (r.data.needVerify) {
  1003. toggleNeedVerifyInput(true, 'data:image/png;base64,' + r.data.imageData)
  1004. typeof cb === 'function' ? cb('data:image/png;base64,' + r.data.imageData) : null
  1005. } else {
  1006. toggleNeedVerifyInput(false)
  1007. }
  1008. }
  1009. }
  1010. })
  1011. }
  1012. // 初始化弹窗
  1013. try{
  1014. initDirect()
  1015. }catch(e){}
  1016. // 初始化忘记密码
  1017. initForgetDirect()
  1018. initRegisterDirect()
  1019. if(sessionStorage&&sessionStorage.reLogin==1){
  1020. sessionStorage.removeItem("reLogin");
  1021. $(".login-dig-tabbar-navbar>[name='pass']").click();
  1022. openLoginDig();
  1023. }
  1024. $("#bidLogin").on("show.bs.modal", function () {
  1025. if ($('#bidLogin').attr('data-name') === 'bind-phone') {
  1026. getNewVerify()
  1027. } else {
  1028. var verify_path = "/front/landpage/captcha?v="
  1029. $("#bidLogin .verify-img").attr("src", verify_path + new Date().getTime());
  1030. }
  1031. });
  1032. $("#bidLogin").on("hidden.bs.modal", function () {
  1033. $(".public-nav").css({"padding-right":""});
  1034. if($("#bidLogin").attr("data-rec")){
  1035. $("#bidLogin").removeAttr("data-rec");
  1036. }
  1037. });
  1038. function startTimeDown (type) {
  1039. var nowCount = 60
  1040. if (sessionStorage.getItem('login-verify-start-time')) {
  1041. var cCount = parseInt((new Date().getTime() - sessionStorage.getItem('login-verify-start-time')) / 1000)
  1042. if (cCount >= 0 & cCount <= 60) {
  1043. nowCount -= cCount
  1044. } else {
  1045. sessionStorage.removeItem('login-verify-start-time')
  1046. return
  1047. }
  1048. } else {
  1049. return
  1050. }
  1051. var nowQ = 'span[data-name="verify_get_sms"]'
  1052. var otherQ = 'span[data-name="forge_get_sms"]'
  1053. if (type === 'forge') {
  1054. var tempQ = nowQ
  1055. nowQ = otherQ
  1056. otherQ = tempQ
  1057. }
  1058. if (type === 'register') {
  1059. nowQ = 'span[data-name="register_get_sms"]'
  1060. otherQ = 'span[data-name="verify_get_sms"]'
  1061. }
  1062. var Ele = document.querySelector(nowQ)
  1063. var otherEle = document.querySelector(otherQ)
  1064. var defalutIT = '重新获取('+ --nowCount +'s)'
  1065. if (Ele) Ele.innerText = defalutIT
  1066. if (otherEle) otherEle.innerText = defalutIT
  1067. var nowSS = window.setInterval(function () {
  1068. if (nowCount === 1 || !sessionStorage.getItem('login-verify-start-time')) {
  1069. clearInterval(nowSS)
  1070. if (Ele) Ele.innerText = '获取验证码'
  1071. if (Ele) Ele.classList.remove('is-stop')
  1072. if (otherEle) otherEle.innerText = '获取验证码'
  1073. sessionStorage.removeItem('login-verify-start-time')
  1074. return
  1075. }
  1076. var iT = '重新获取('+ --nowCount +'s)'
  1077. if (Ele) Ele.classList.add('is-stop')
  1078. if (Ele) Ele.innerText = iT
  1079. if (otherEle) otherEle.classList.add('is-stop')
  1080. if (otherEle) otherEle.innerText = iT
  1081. }, 1000)
  1082. }
  1083. function getSMSCode (e) {
  1084. if (e.classList.contains('is-stop')) return
  1085. var verifyStartTime = new Date().getTime()
  1086. var oldTime = sessionStorage.getItem('login-verify-start-time') || verifyStartTime - 70000
  1087. if (verifyStartTime - oldTime >= 60000) {
  1088. var nowQ = e.getAttribute('data-name') === 'forge_get_sms' ? 'forge' : 'verify'
  1089. if ($("#bidLogin").attr('data-name') === 'bind-phone') {
  1090. nowQ = 'bind-phone'
  1091. // getNewVerify()
  1092. }
  1093. if (e.getAttribute('data-name') === 'register_get_sms') {
  1094. nowQ = 'register'
  1095. }
  1096. Direct.ajaxSms(e, nowQ)
  1097. }
  1098. }
  1099. // 表单规则
  1100. function ruleForPhone (data, type) {
  1101. var checkStatus = /^[1][3-9][0-9]{9}$/.test(data.value)
  1102. if (type === 'input') {
  1103. return data.value.length >= 11 ? checkStatus : true
  1104. }
  1105. if (type === 'blur') {
  1106. return data.value.length ? checkStatus : true
  1107. }
  1108. return checkStatus
  1109. }
  1110. function ruleForCode (data, type) {
  1111. var checkStatus = /^\S{4}$/.test(data.value)
  1112. if (type === 'blur') {
  1113. return data.value.length ? checkStatus : true
  1114. }
  1115. if (type === 'input') {
  1116. return data.value.length == 4 ? checkStatus : true
  1117. }
  1118. return checkStatus
  1119. }
  1120. function ruleForSms (data, type) {
  1121. var checkStatus = /^\S{6}$/.test(data.value)
  1122. if (type === 'blur') {
  1123. return data.value.length ? checkStatus : true
  1124. }
  1125. if (type === 'input') {
  1126. return data.value.length == 6 ? checkStatus : true
  1127. }
  1128. return checkStatus
  1129. }
  1130. function ruleForPass (data, type) {
  1131. var checkStatus = /^\S{6,}$/.test(data.value)
  1132. if (type === 'blur') {
  1133. return data.value.length ? checkStatus : true
  1134. }
  1135. if (type === 'input') {
  1136. return data.value.length >= 6 ? checkStatus : true
  1137. }
  1138. return checkStatus
  1139. }
  1140. function createFormStauts (formOption) {
  1141. var nowEle = document.querySelector(formOption.el)
  1142. var errClass = 'is-error'
  1143. // 实时状态
  1144. var nowData = {
  1145. status: null,
  1146. next: formOption.next || false,
  1147. value: null,
  1148. el: nowEle,
  1149. skip: function (value) {
  1150. this.status = true
  1151. this.next = true
  1152. this.value = value
  1153. formOption.upStatus()
  1154. },
  1155. showError: function (error) {
  1156. this.status = false
  1157. this.next = false
  1158. formOption.upStatus()
  1159. if (error) {
  1160. this.el.parentNode.setAttribute('data-error', error)
  1161. this.el.parentNode.classList.add(errClass)
  1162. }
  1163. }
  1164. }
  1165. // 错误提示
  1166. if (formOption.errorTip && formOption.errorTip !== '') {
  1167. nowEle.parentNode.setAttribute('data-error', formOption.errorTip)
  1168. }
  1169. // 校验规则
  1170. if (typeof formOption.rule !== "function") {
  1171. formOption.rule = function (data) {
  1172. return true
  1173. }
  1174. }
  1175. // 状态变动通知回调
  1176. if (typeof formOption.upStatus !== "function") {
  1177. formOption.upStatus = function (data) {
  1178. return true
  1179. }
  1180. }
  1181. // 监听事件
  1182. var events = formOption.event;
  1183. for(var i=0;i<events.length;i++){
  1184. if (nowEle) nowEle.addEventListener(events[i],function (e) {
  1185. // input
  1186. var nowTarget = e.target
  1187. var errorTarget = nowTarget.parentNode
  1188. // 移除错误提示
  1189. errorTarget.classList.remove(errClass)
  1190. // 更新状态
  1191. nowData.value = nowTarget.value
  1192. nowData.status = formOption.rule(nowData, e.type)
  1193. nowData.next = formOption.rule(nowData, 'next')
  1194. formOption.upStatus()
  1195. // 更新错误提示
  1196. if (nowData.status) {
  1197. errorTarget.classList.remove(errClass)
  1198. } else {
  1199. errorTarget.classList.add(errClass)
  1200. }
  1201. })
  1202. }
  1203. /*formOption.event.forEach(function(v){
  1204. if (nowEle) nowEle.addEventListener(v,function (e) {
  1205. // input
  1206. var nowTarget = e.target
  1207. var errorTarget = nowTarget.parentNode
  1208. // 移除错误提示
  1209. errorTarget.classList.remove(errClass)
  1210. // 更新状态
  1211. nowData.value = nowTarget.value
  1212. nowData.status = formOption.rule(nowData, v)
  1213. nowData.next = formOption.rule(nowData, 'next')
  1214. formOption.upStatus()
  1215. // 更新错误提示
  1216. if (nowData.status) {
  1217. errorTarget.classList.remove(errClass)
  1218. } else {
  1219. errorTarget.classList.add(errClass)
  1220. }
  1221. })
  1222. });*/
  1223. return nowData
  1224. }
  1225. // 事件
  1226. function installInputEvent () {
  1227. // verify img event for click
  1228. var s1 = document.querySelectorAll('.login-dig-input-box .verify-img');
  1229. for(var i=0;i<s1.length;i++){
  1230. s1[i].addEventListener('click', function (e) {
  1231. var verify_path = "/front/landpage/captcha?v="
  1232. if ($('#bidLogin').attr('data-name') === 'bind-phone') {
  1233. getNewVerify(function (src) {
  1234. e.target.src = src
  1235. })
  1236. } else {
  1237. e.target.src = verify_path+new Date().getTime();
  1238. }
  1239. })
  1240. }
  1241. var s2 = document.querySelectorAll('.login-dig-input-box .l-get-sms');
  1242. for(var i=0;i<s2.length;i++){
  1243. s2[i].addEventListener('click', function (e) {
  1244. getSMSCode(e.target)
  1245. })
  1246. }
  1247. var s3 = document.querySelectorAll('.login-dig-input-box input');
  1248. for(var i=0;i<s3.length;i++){
  1249. s3[i].addEventListener('focus', function (e) {
  1250. var nowInput = e.target
  1251. nowInput.parentNode.classList.add('is-focus')
  1252. })
  1253. s3[i].addEventListener('blur', function (e) {
  1254. var nowInput = e.target
  1255. nowInput.parentNode.classList.remove('is-focus')
  1256. })
  1257. }
  1258. }
  1259. // E-公用
  1260. // 忘记密码
  1261. function toggleStep (type) {
  1262. var nowArr = ['.forget-form-box[data-step="1"]', '.forget-step-title[data-step="1"]']
  1263. var otherArr = ['.forget-form-box[data-step="2"]', '.forget-step-title[data-step="2"]']
  1264. for(var i=0;i<otherArr.length;i++){
  1265. if (document.querySelector(otherArr[i])) document.querySelector(otherArr[i]).style.display = (type ? 'none' : '')
  1266. }
  1267. for(var i=0;i<nowArr.length;i++){
  1268. if (document.querySelector(nowArr[i])) document.querySelector(nowArr[i]).style.display = (type ? '' : 'none')
  1269. }
  1270. }
  1271. // 弹窗登录
  1272. function installAddEventListener () {
  1273. // tabbar toggle event
  1274. document.querySelector('.login-dig-tabbar-navbar').addEventListener('click', function (e) {
  1275. if (e.target.nodeName !== "SPAN") return
  1276. if (e.target.classList.contains('is-active')) {
  1277. return
  1278. }
  1279. var SelectName = e.target.getAttribute('name')
  1280. document.querySelector('.login-dig-tabbar-navbar span.is-active').classList.toggle('is-active')
  1281. e.target.classList.toggle('is-active')
  1282. // content toggle
  1283. document.querySelector('.login-dig-tabbar-content.is-active').classList.toggle('is-active')
  1284. document.querySelector('.login-dig-tabbar-content[data-name="'+ SelectName +'"]').classList.toggle('is-active')
  1285. })
  1286. installInputEvent()
  1287. }
  1288. // 初始化
  1289. function isCheckInit(type) {
  1290. if (type === 'forge') {
  1291. return document.querySelector('button[name="forge_submit_phone"]')
  1292. } else {
  1293. return document.querySelector('button[name="register_submit_phone"]')
  1294. }
  1295. }
  1296. function initDirect () {
  1297. // 初始化事件
  1298. installAddEventListener()
  1299. // 初始化倒计时
  1300. startTimeDown()
  1301. // 验证码登录
  1302. var verifySubmit = {
  1303. el: 'button[name="verify_submit"]',
  1304. arr: [],
  1305. init: function (arr) {
  1306. this.arr = arr
  1307. this.check()
  1308. var submitEle = document.querySelector(this.el)
  1309. submitEle.addEventListener('click', this.submit)
  1310. },
  1311. submit: function (e) {
  1312. var e = e.target
  1313. if (e.getAttribute('data-loading') === 'true') return
  1314. e.setAttribute('data-loading', 'true')
  1315. Direct.ajaxLoginSms(e, verifySubmit.arr)
  1316. },
  1317. check: function () {
  1318. var submitEle = document.querySelector(this.el)
  1319. var checkStauts = false
  1320. for(var i=0;i<this.arr.length;i++){
  1321. if (!this.arr[i].next) {
  1322. checkStauts = true
  1323. }
  1324. }
  1325. if (checkStauts) {
  1326. submitEle.setAttribute('disabled', checkStauts)
  1327. } else {
  1328. submitEle.removeAttribute('disabled')
  1329. }
  1330. }
  1331. }
  1332. var verifySendSms = {
  1333. el: '.login-dig-input-box span[data-name="verify_get_sms"]',
  1334. update: function (type) {
  1335. var Ele = document.querySelector(this.el)
  1336. if (type) {
  1337. Ele.classList.remove('is-stop')
  1338. } else {
  1339. Ele.classList.add('is-stop')
  1340. }
  1341. }
  1342. }
  1343. var verifyPhone = createFormStauts({
  1344. el: '.login-dig-input-box input[name="verify_phone"]',
  1345. rule: ruleForPhone,
  1346. event: ['input', 'blur'],
  1347. upStatus: function () {
  1348. verifySubmit.check()
  1349. verifySendSms.update(verifyCode.next && verifyPhone.next)
  1350. }
  1351. })
  1352. var verifyCode = createFormStauts({
  1353. el: '.login-dig-input-box input[name="verify_code"]',
  1354. rule: ruleForCode,
  1355. event: ['input', 'blur'],
  1356. upStatus: function () {
  1357. verifySubmit.check()
  1358. verifySendSms.update(verifyCode.next && verifyPhone.next)
  1359. }
  1360. })
  1361. var verifySms = createFormStauts({
  1362. el: '.login-dig-input-box input[name="verify_sms"]',
  1363. rule: ruleForSms,
  1364. event: ['input', 'blur'],
  1365. upStatus: function () {
  1366. verifySubmit.check()
  1367. }
  1368. })
  1369. verifySubmit.init([verifyPhone, verifyCode, verifySms])
  1370. verifySendSms.update(verifyCode.next && verifyPhone.next)
  1371. Direct.verify = {
  1372. phone: verifyPhone,
  1373. code: verifyCode,
  1374. sms: verifySms
  1375. }
  1376. // 密码登录
  1377. var passSubmit = {
  1378. el: 'button[name="pass_submit"]',
  1379. arr: [],
  1380. init: function (arr) {
  1381. this.arr = arr
  1382. this.check()
  1383. var submitEle = document.querySelector(this.el)
  1384. submitEle.addEventListener('click', this.submit)
  1385. },
  1386. submit: function (e) {
  1387. var e = e.target
  1388. if (e.getAttribute('data-loading') === 'true') return
  1389. e.setAttribute('data-loading', 'true')
  1390. Direct.ajaxLoginPass(e, passSubmit.arr)
  1391. },
  1392. check: function () {
  1393. var submitEle = document.querySelector(this.el)
  1394. var checkStauts = false
  1395. for(var i=0;i<this.arr.length;i++){
  1396. if (!this.arr[i].next) {
  1397. checkStauts = true
  1398. }
  1399. }
  1400. if (checkStauts) {
  1401. submitEle.setAttribute('disabled', checkStauts)
  1402. } else {
  1403. submitEle.removeAttribute('disabled')
  1404. }
  1405. }
  1406. }
  1407. var passPhone = createFormStauts({
  1408. el: '.login-dig-input-box input[name="pass_phone"]',
  1409. rule: ruleForPhone,
  1410. event: ['input', 'blur'],
  1411. upStatus: function () {
  1412. passSubmit.check()
  1413. }
  1414. })
  1415. var passPass = createFormStauts({
  1416. el: '.login-dig-input-box input[name="pass_pass"]',
  1417. rule: ruleForPass,
  1418. event: ['input', 'blur'],
  1419. upStatus: function () {
  1420. passSubmit.check()
  1421. }
  1422. })
  1423. passSubmit.init([passPhone, passPass])
  1424. }
  1425. function initForgetDirect () {
  1426. // 判断是否需要初始化
  1427. if (!isCheckInit('forge')) return
  1428. // 初始化显示
  1429. toggleStep(true)
  1430. // 初始化倒计时
  1431. startTimeDown('forge')
  1432. // 手机验证
  1433. var verifySubmit = {
  1434. el: 'button[name="forge_submit_phone"]',
  1435. arr: [],
  1436. init: function(arr) {
  1437. this.arr = arr
  1438. this.check()
  1439. var submitEle = document.querySelector(this.el)
  1440. if (!submitEle) return
  1441. submitEle.addEventListener('click', this.submit)
  1442. },
  1443. submit: function (e) {
  1444. var e = e.target
  1445. if (e.getAttribute('data-loading') === 'true') return
  1446. e.setAttribute('data-loading', 'true')
  1447. Direct.ajaxStepOne(e, verifySubmit.arr)
  1448. },
  1449. check: function () {
  1450. var submitEle = document.querySelector(this.el)
  1451. if (!submitEle) return
  1452. var checkStauts = false
  1453. for(var i=0;i<this.arr.length;i++){
  1454. if (!this.arr[i].next) {
  1455. checkStauts = true
  1456. }
  1457. }
  1458. if (checkStauts) {
  1459. submitEle.setAttribute('disabled', checkStauts)
  1460. } else {
  1461. submitEle.removeAttribute('disabled')
  1462. }
  1463. }
  1464. }
  1465. var verifySendSms = {
  1466. el: '.login-dig-input-box span[data-name="forge_get_sms"]',
  1467. update: function(type) {
  1468. var Ele = document.querySelector(this.el)
  1469. if (type) {
  1470. Ele.classList.remove('is-stop')
  1471. } else {
  1472. Ele.classList.add('is-stop')
  1473. }
  1474. }
  1475. }
  1476. var verifyPhone = createFormStauts({
  1477. el: '.login-dig-input-box input[name="forge_phone"]',
  1478. rule: ruleForPhone,
  1479. event: ['input', 'blur'],
  1480. upStatus: function () {
  1481. verifySubmit.check()
  1482. verifySendSms.update(verifyCode.next && verifyPhone.next)
  1483. }
  1484. })
  1485. var verifyCode = createFormStauts({
  1486. el: '.login-dig-input-box input[name="forge_code"]',
  1487. rule: ruleForCode,
  1488. event: ['input', 'blur'],
  1489. upStatus: function () {
  1490. verifySubmit.check()
  1491. verifySendSms.update(verifyCode.next && verifyPhone.next)
  1492. }
  1493. })
  1494. var verifySms = createFormStauts({
  1495. el: '.login-dig-input-box input[name="forge_sms"]',
  1496. rule: ruleForSms,
  1497. event: ['input', 'blur'],
  1498. upStatus: function () {
  1499. verifySubmit.check()
  1500. }
  1501. })
  1502. verifySubmit.init([verifyPhone, verifyCode, verifySms])
  1503. verifySendSms.update(verifyCode.next && verifyPhone.next)
  1504. // 密码重置
  1505. var passSubmit = {
  1506. el: 'button[name="forge_submit_pass"]',
  1507. arr: [],
  1508. init: function(arr) {
  1509. this.arr = arr
  1510. this.check()
  1511. var submitEle = document.querySelector(this.el)
  1512. submitEle.addEventListener('click', this.submit)
  1513. },
  1514. submit: function (e) {
  1515. var e = e.target
  1516. if (e.getAttribute('data-loading') === 'true') return
  1517. e.setAttribute('data-loading', 'true')
  1518. Direct.ajaxStepTwo(e, passSubmit.arr)
  1519. },
  1520. check: function () {
  1521. var submitEle = document.querySelector(this.el)
  1522. var checkStauts = false
  1523. for(var i=0;i<this.arr.length;i++){
  1524. if (!this.arr[i].next) {
  1525. checkStauts = true
  1526. }
  1527. }
  1528. if (checkStauts) {
  1529. submitEle.setAttribute('disabled', checkStauts)
  1530. } else {
  1531. if (this.arr[0].value !== this.arr[1].value) {
  1532. this.arr[1].showError('两次密码输入不一致')
  1533. } else {
  1534. submitEle.removeAttribute('disabled')
  1535. }
  1536. }
  1537. }
  1538. }
  1539. var passPhone = createFormStauts({
  1540. el: '.login-dig-input-box input[name="forge_pass_one"]',
  1541. rule: ruleForPass,
  1542. event: ['input', 'blur'],
  1543. upStatus: function () {
  1544. passSubmit.check()
  1545. }
  1546. })
  1547. var passPass = createFormStauts({
  1548. el: '.login-dig-input-box input[name="forge_pass_two"]',
  1549. rule: ruleForPass,
  1550. event: ['input', 'blur'],
  1551. upStatus: function () {
  1552. passSubmit.check()
  1553. }
  1554. })
  1555. passSubmit.init([passPhone, passPass])
  1556. Direct.forge = {
  1557. phone: verifyPhone,
  1558. code: verifyCode
  1559. }
  1560. }
  1561. function initRegisterDirect () {
  1562. // 判断是否需要初始化
  1563. if (!isCheckInit('register')) return
  1564. // 初始化倒计时
  1565. startTimeDown('register')
  1566. // 手机验证
  1567. var verifySubmit = {
  1568. el: 'button[name="register_submit_phone"]',
  1569. arr: [],
  1570. init: function(arr) {
  1571. this.arr = arr
  1572. this.check()
  1573. var submitEle = document.querySelector(this.el)
  1574. if (!submitEle) return
  1575. submitEle.addEventListener('click', this.submit)
  1576. },
  1577. submit: function (e) {
  1578. var e = e.target
  1579. if (e.getAttribute('data-loading') === 'true') return
  1580. e.setAttribute('data-loading', 'true')
  1581. Direct.ajaxRegister(e, verifySubmit.arr)
  1582. },
  1583. check: function () {
  1584. var submitEle = document.querySelector(this.el)
  1585. if (!submitEle) return
  1586. var checkStauts = false
  1587. for(var i=0;i<this.arr.length;i++){
  1588. if (!this.arr[i].next) {
  1589. checkStauts = true
  1590. }
  1591. }
  1592. if (checkStauts) {
  1593. submitEle.setAttribute('disabled', checkStauts)
  1594. } else {
  1595. submitEle.removeAttribute('disabled')
  1596. }
  1597. }
  1598. }
  1599. var verifySendSms = {
  1600. el: '.login-dig-input-box span[data-name="register_get_sms"]',
  1601. update: function(type) {
  1602. var Ele = document.querySelector(this.el)
  1603. if (type) {
  1604. Ele.classList.remove('is-stop')
  1605. } else {
  1606. Ele.classList.add('is-stop')
  1607. }
  1608. }
  1609. }
  1610. var verifyPhone = createFormStauts({
  1611. el: '.login-dig-input-box input[name="register_phone"]',
  1612. rule: ruleForPhone,
  1613. event: ['input', 'blur'],
  1614. upStatus: function () {
  1615. verifySubmit.check()
  1616. verifySendSms.update(verifyCode.next && verifyPhone.next)
  1617. }
  1618. })
  1619. var verifyCode = createFormStauts({
  1620. el: '.login-dig-input-box input[name="register_code"]',
  1621. rule: ruleForCode,
  1622. event: ['input', 'blur'],
  1623. upStatus: function () {
  1624. verifySubmit.check()
  1625. verifySendSms.update(verifyCode.next && verifyPhone.next)
  1626. }
  1627. })
  1628. var verifySms = createFormStauts({
  1629. el: '.login-dig-input-box input[name="register_sms"]',
  1630. rule: ruleForSms,
  1631. event: ['input', 'blur'],
  1632. upStatus: function () {
  1633. verifySubmit.check()
  1634. }
  1635. })
  1636. var entName = createFormStauts({
  1637. el: '.login-dig-input-box input[name="register_entname"]',
  1638. event: ['input', 'blur'],
  1639. next: true,
  1640. upStatus: function () {
  1641. verifySubmit.check()
  1642. }
  1643. })
  1644. verifySubmit.init([verifyPhone, verifyCode, verifySms, entName])
  1645. verifySendSms.update(verifyCode.next && verifyPhone.next)
  1646. Direct.register = {
  1647. phone: verifyPhone,
  1648. code: verifyCode
  1649. }
  1650. }
  1651. });
  1652. function openLoginDig() {
  1653. $('#bidLogin .logo').show()
  1654. $('#bidLogin .bind-phone-head').hide()
  1655. $(".login-dig-tabbar-content.is-active .login-dig-input-box").show()
  1656. if ($('#bidLogin').attr('data-name') === 'bind-phone') {
  1657. $("#bidLogin").removeAttr('data-name')
  1658. $('.login-dig-submit-button').removeClass('bindphonebtn')
  1659. $('.login-dig-submit-button:disabled').css('background', '#E0E0E0')
  1660. $('.login-dig-submit-button:disabled').css('opacity', '0.5')
  1661. $('.login-dig-submit-button').css('margin-bottom', '0')
  1662. $("#bidLogin .login-dig-submit-button[name='verify_submit']").text('登录 / 注册')
  1663. $(".login-dig-tabbar-content[data-name='code'] .login-dig-input-box").removeClass('is-error').children('input').val('')
  1664. }
  1665. var href = window.location.href;
  1666. var sourceStr =""
  1667. if (href.indexOf("/front/structed/pc_index.html?source=baidusem")>-1){//结构化数据
  1668. sourceStr="结构化数据-pc-baidusem";
  1669. }else if (href.indexOf("/bid/pc/page/bidfile_landpage?source=baidusem")>-1){//招标文件解读
  1670. sourceStr="招标文件解读-pc-baidusem";
  1671. }
  1672. if (sourceStr!=""){
  1673. try {
  1674. _hmt.push(['_trackEvent',sourceStr, 'click', "登录"]);
  1675. } catch (e) {
  1676. console.log('未初始化百度统计', e);
  1677. }
  1678. }
  1679. $("#bidLogin").modal("show");
  1680. }
  1681. function openBindPhoneDig() {
  1682. openLoginDigForWx(false);
  1683. $('#bidLogin .logo').hide()
  1684. $('#bidLogin .bind-phone-head').show()
  1685. if ($('#bidLogin').attr('data-name') !== 'bind-phone') {
  1686. $("#bidLogin").attr('data-name', 'bind-phone')
  1687. // $('.login-dig-submit-button:disabled').css('background', '#2CB7CA')
  1688. // $('.login-dig-submit-button:disabled').css('opacity', '0.5')
  1689. $('.login-dig-submit-button').css('margin-bottom', '12px')
  1690. $('.login-dig-submit-button').addClass('bindphonebtn')
  1691. $("#bidLogin .login-dig-submit-button[name='verify_submit']").text('立即绑定')
  1692. $(".login-dig-tabbar-content[data-name='code'] .login-dig-input-box").removeClass('is-error').children('input').val('')
  1693. }
  1694. $("#bidLogin").modal("show");
  1695. }
  1696. function closeLoginDig() {
  1697. $("#bidLogin").modal("hide");
  1698. }
  1699. function openLoginDigForWx (type) {
  1700. var otherArr = ['.login-dig-box > .logo','.login-dig-footer-box .wx-logo-box', '.login-dig-footer-box .login-dig-text-split' ,'.login-dig-tabbar-navbar', '.login-dig-tabbar-content', '.login-dig-tabbar-content.is-active']
  1701. var wxArr = ['.login-dig-wx-qrcode-box', '.login-dig-top-back-box']
  1702. for(var i=0;i<otherArr.length;i++){
  1703. document.querySelector(otherArr[i]).style.display = (type ? 'none' : '')
  1704. }
  1705. for(var i=0;i<wxArr.length;i++){
  1706. document.querySelector(wxArr[i]).style.display = (type ? '' : 'none')
  1707. }
  1708. }