login.js 66 KB

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