1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652
| function isChaoxingReader() { var ua = navigator.userAgent; if (ua != undefined) { return ua.indexOf("SSREADER/4.1.6.0001") != -1; } }
function countdownTime() { var retry = "é‡æ–°èŽ·å–"; if (getCookie("browserLocale") == 'en_US' ) { retry = "Reacquire"; } var countdown = 60; //倒计时秒数 $('.get-code').hide(); $('.before-reget').show(); $('.voice-use').removeClass("voice-tip"); var clock = window.setInterval(function () { countdown--; $("#showcountdown").html( countdown+"såŽé‡æ–°èŽ·å–"); if (countdown == 0) { window.clearInterval(clock); $('.get-code').show().text(retry); $('.before-reget').hide(); $('.voice-use').html("没有收到验è¯ç ?å¯å°è¯•<a href='javascript:voiceCodeFunc.showVoiceCodePop()'>è¯éŸ³èŽ·å–</a>").addClass("voice-tip"); } }, 1000)
} function getCookie (c_name) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(c_name + "=") if (c_start != -1){ c_start = c_start + c_name.length + 1 c_end = document.cookie.indexOf(";", c_start) if (c_end == -1) c_end = document.cookie.length return unescape(document.cookie.substring(c_start, c_end)) } } return ""; } //é—眼ç眼 function initPassword(doc) { if ($(doc).hasClass('icon-eye-close')) { $(doc).removeClass('icon-eye-close').addClass('icon-eye-open'); $(doc).parent().find("input").attr('type', 'text'); } else { $(doc).removeClass('icon-eye-open').addClass('icon-eye-close'); $(doc).parent().find("input").attr('type', 'password'); }
}
//选择å¦æ ¡ã€æœºæž„ function initSelectList() { $(".to-select-list").on('focus', function () { $(this).parent().find('.filter-list').fadeIn(); }) $('.filter-list').on('click', 'li', function () { var opt = $(this).text(); $(this).siblings().removeClass('current'); $(this).addClass('current'); $(this).parents('div').find('.to-select-list').val(opt); $('.filter-list').fadeOut() }); $(document).click(function (e) { var $target = $(e.target); $('.filter-list').hide(); }); $('.item-select').click(function (event) { event.stopPropagation(); }); }
//é€‰æ‹©åŒºå· function showTelList(html) { $(html).parent().find('.filter-list').fadeIn(); }
function initTelList() { $('.filter-list').on('click', 'li', function () { var opt = $(this).data('id'); $(this).siblings().removeClass('current'); $(this).addClass('current'); $(this).parents('div').find('.to-select-list').text('+' + opt); $('.filter-list').fadeOut() $(this).parents('div').find('.to-select-list').removeClass('icon-up') }); $(document).click(function (e) { var $target = $(e.target); $('.filter-list').hide(); $('.to-select-list').removeClass('icon-up') }); $('.item-select').click(function (event) { event.stopPropagation(); }); } var please_input_phone = "请输入手机å·"; var please_input_pwd = "请输入密ç "; var phone_format_error = "手机å·æ ¼å¼é”™è¯¯"; var captcha_format_error = "验è¯ç æ ¼å¼é”™è¯¯"; var please_input_captcha = "请输入验è¯ç "; var please_input_studentcode = "请输入å¦å·/å·¥å·";
try { if(countryCode.getCookie("browserLocale") == 'en_US'){ please_input_phone = "please input phone number"; please_input_pwd = "please input password"; phone_format_error = "phone format error"; captcha_format_error = "captcha format error"; please_input_captcha = "please input captcha"; please_input_studentcode = 'please input Student ID/Institution ID'; } }catch (e) { console.log('请先引用util.js') }
function encryptByDES(message, key){ var keyHex = CryptoJS.enc.Utf8.parse(key); var encrypted = CryptoJS.DES.encrypt(message, keyHex, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }); return encrypted.ciphertext.toString(); }
function encryptByAES(message, key){ let CBCOptions = { iv: CryptoJS.enc.Utf8.parse(key), mode:CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }; let aeskey = CryptoJS.enc.Utf8.parse(key); let secretData = CryptoJS.enc.Utf8.parse(message); let encrypted = CryptoJS.AES.encrypt( secretData, aeskey, CBCOptions ); return CryptoJS.enc.Base64.stringify(encrypted.ciphertext); }
//手机å·+密ç 登录 function loginByPhoneAndPwd(){ util.showMsg(false,"phoneMsg","",true); util.showMsg(false,"pwdMsg","",true); util.showMsg(false,"err-txt",""); var phone = $("#phone").val().trim(); var pwd = $("#pwd").val(); var fid = $("#fid").val(); var refer = $("#refer").val(); var forbidotherlogin = $("#forbidotherlogin").val(); if(util.isEmpty(phone)){ util.showMsg(true,"phoneMsg",please_input_phone,true); return; }/*else if(!util.isInterPhone(phone) && (phone.length > 50 || !util.checkEmail(phone))){ util.showMsg(true,"phoneMsg","手机å·æ ¼å¼é”™è¯¯",true); return; }*/ if(util.isEmpty(pwd)){ util.showMsg(true,"pwdMsg",please_input_pwd,true); return; } var t = $("#t").val(); if(t == "true"){ var transferKey = "u2oh6Vu^HWe4_AES"; pwd = encryptByAES(pwd, transferKey); //pwd = $.base64.btoa(pwd,"UTF-8"); }
if(capInstance == null || $("#needVcode").val() != "1"){ //容错 loginByPhoneAndPwdSubmit(); }else{ capInstance && capInstance.popUp(); } }
function loginByPhoneAndPwdSubmit() { let phone = $("#phone").val().trim(); let pwd = $("#pwd").val(); let fid = $("#fid").val(); let refer = $("#refer").val(); let forbidotherlogin = $("#forbidotherlogin").val(); let t = $("#t").val(); let _blank = $("#_blank").val(); let doubleFactorLogin = $("#doubleFactorLogin").val(); let independentId = $("#independentId").val(); if(t == "true"){ let transferKey = "u2oh6Vu^HWe4_AES"; pwd = encryptByAES(pwd, transferKey); phone = encryptByAES(phone, transferKey); } let validate = $("#validate").val(); if(undefined == validate){ validate = ""; } $.ajax({ url: _CP_+"/fanyalogin", type:"post", dataType : 'json', data: { 'fid': fid, 'uname': phone, 'password': pwd, 'refer': refer, 't': t, 'forbidotherlogin': forbidotherlogin, 'validate': validate, 'doubleFactorLogin': doubleFactorLogin, 'independentId': independentId }, success: function(data){ if(data.status){ let url = ""; if(isChaoxingReader()){ let path= window.location.protocol+'//' + window.location.host ; url = path+_CP_+"/towriteother?name="+encodeURIComponent(data.name)+"&pwd="+encodeURIComponent(data.pwd)+"&refer="+data.url; }else{ url = decodeURIComponent(data.url); } //跳转到åŒå› åç™»å½•é¡µé¢ if (data.containTwoFactorLogin) { let toTwoFactorLoginPCUrl = data.twoFactorLoginPCUrl; location.href = toTwoFactorLoginPCUrl + "&_blank=" + _blank + "&refer=" + encodeURIComponent(url); return false; }
if (top.location != self.location && _blank == "1") { top.location = url; } else { window.location = url; } } else { if (data.weakpwd) { window.location =_CP_+ "/v11/updateweakpwd?uid=" + data.uid + "&oldpwd=" + encodeURIComponent($("#pwd").val()) + "&_blank=" + $("#_blank").val() + "&refer=" + refer; } else { let msg = util.isEmpty(data.msg2) ? "登录失败" : data.msg2; msg = ("密ç 错误" == msg || "用户å或密ç 错误" == msg) ? "手机å·æˆ–密ç 错误" : msg; util.showMsg(true,"err-txt",msg); } } } }); } //手机å·+验è¯ç 登录 function loginByPhoneAndCode(){ util.showMsg(false,"phoneMsg","",true); util.showMsg(false,"vercodeMsg","",true); util.showMsg(false,"err-txt",""); $(".voice-tip").removeClass("voice-tip"); let phone = $("#phone").val().trim(); let countryCode = $("#countryCode").val(); let vercode = $("#vercode").val().trim(); let fid = $("#fid").val(); let refer = $("#refer").val(); let ebook = $("#ebook").val(); let allowSkip = $("#allowSkip").val(); let doubleFactorLogin = $("#doubleFactorLogin").val(); if(util.isEmpty(phone)){ util.showMsg(true,"phoneMsg",please_input_phone,true); return; }else if(!util.isInterPhone(phone,countryCode)){ util.showMsg(true,"phoneMsg",phone_format_error,true); return; } if(util.isEmpty(vercode)){ //é¿å…与下方æç¤ºå†²çª util.showMsg(true,"vercodeMsg","",true); util.showMsg(true,"err-txt",please_input_captcha); return; }else if(!util.checkPhoneCode(vercode)){ //é¿å…与下方æç¤ºå†²çª util.showMsg(true,"vercodeMsg","",true); util.showMsg(true,"err-txt",captcha_format_error); return; }
var transferKey = "u2oh6Vu^HWe4_AES"; vercode = encodeURIComponent(encryptByAES(vercode, transferKey));
$.ajax({ url: _CP_+"/fanyaloginbycode", type:"post", dataType : 'json', data:{ 'fid':fid,'uname':phone,'verCode':vercode,'refer':refer,'doubleFactorLogin':doubleFactorLogin}, success: function(data){ if(data.status){ let url = decodeURIComponent(data.url); if(isChaoxingReader()) { url = _CP_+"/towriteother?name=" + encodeURIComponent(data.name) + "&pwd=" + encodeURIComponent(data.pwd) + "&refer=" + data.url; } //跳转到åŒå› åç™»å½•é¡µé¢ if (data.containTwoFactorLogin) { let toTwoFactorLoginPCUrl = data.twoFactorLoginPCUrl; location.href = toTwoFactorLoginPCUrl + "&refer=" + encodeURIComponent(url); return false; }
window.location = url }else{ if(data.type == 1){ var quick = $("#quick").val(); if (quick == "1") { window.location = data.quickUrl; } else { window.location = data.url + "&ebook=" + ebook + "&allowSkip=" + allowSkip;//跳转到注册æµç¨‹(设置密ç 页é¢) } }else{ var msg = util.isEmpty(data.msg2) ? "登录失败" : data.msg2; $("#err-txt").html(msg); } } } }); } //机构登录 function unitlogin(){ let msgId = "err-txt2"; util.showMsg(false, "unameMsg", "", true); util.showMsg(false, "passwordMsg", "", true); util.showMsg(false, "vercodeMsg", "", true); util.showMsg(false, msgId, ""); let uname = $("#uname").val().trim(); let vercode = $("#vercode").val().trim(); let password = $("#password").val(); let pid = $("#pid").val(); let fid = $("#fid").val(); let refer = $("#refer").val(); let hidecompletephone = $("#hidecompletephone").val(); let forbidotherlogin = $("#forbidotherlogin").val(); let doubleFactorLogin = $("#doubleFactorLogin").val(); let independentId = $("#independentId").val(); if (util.isEmpty(uname)) { util.showMsg(true, "unameMsg", please_input_studentcode, true); return; } if (util.isEmpty(password)) { util.showMsg(true, "passwordMsg", please_input_pwd, true); return; } if (util.isEmpty(vercode)) { util.showMsg(true, "vercodeMsg", please_input_captcha, true); return; } else if (!/^\d{4}$/.test(vercode)) { util.showMsg(true, "vercodeMsg", captcha_format_error, true); return; } let t = $("#t").val();
if(t == "true"){ let transferKey = "u2oh6Vu^HWe4_AES"; password = encryptByAES(password, transferKey); uname = encryptByAES(uname, transferKey); }
if (fid == -1) { let fidName = $("#inputunitname").val(); $.ajax({ type: "get", url: _CP_+"/org/searchUnis", async: false, data: "filter=" + encodeURIComponent(fidName) + "&product=44&type=", success: function (date) { let myjson = eval("(" + date + ")"); let result = myjson.result; if (result) { var froms = myjson.froms; var size = myjson.fromNums; for (let i = 0; i < size; i++) { let name = froms[i].name; if (fidName == name) { let id = froms[i].schoolid; $("#fid").val(id); fid = $("#fid").val(); break; } } } else { let reg = /^[0-9]*$/; if (reg.test(fidName)) { fid = fidName } } } }); }
$.ajax({ url:_CP_+ "/unitlogin", type:"post", dataType: 'json', data: { 'pid': pid, 'fid': fid, 'uname': uname, 'numcode': vercode, 'password': password, 'refer': refer, 't': t, 'hidecompletephone': hidecompletephone, 'doubleFactorLogin': doubleFactorLogin, 'forbidotherlogin': forbidotherlogin, 'independentId': independentId }, success: function (data) { if(data.status){ if(data.type == 0 ){ let url = decodeURIComponent(data.url); if( isChaoxingReader()){ url = _CP_+"/towriteother?name="+encodeURIComponent(data.name)+"&pwd="+encodeURIComponent(data.pwd)+"&refer="+data.url; } //跳转到åŒå› åç™»å½•é¡µé¢ if (data.containTwoFactorLogin) { let toTwoFactorLoginPCUrl = data.twoFactorLoginPCUrl; location.href = toTwoFactorLoginPCUrl + "&refer=" + encodeURIComponent(url); return false; } window.location = url; }else if(data.type == 1){ getNumCode(); var msg = "密ç 错误" == data.mes ? "用户å或密ç 错误" : data.mes; util.showMsg(true,msgId,msg); }else if(data.type == 2){//å®Œå–„ä¿¡æ¯ var host=document.domain; window.location = document.location.protocol+"//"+host+data.url; } }else{ getNumCode(); var msg = util.isEmpty(data.mes) ? "登录失败" : data.mes; msg = ("密ç 错误" == msg) ? "用户å或密ç 错误" : msg; util.showMsg(true,msgId,msg); } } }); } function getNumCode() { var img = document.getElementById("numVerCode"); img.src = _CP_+"/num/code?" + new Date().getTime(); }
//跳转到其他方å¼çš„ç™»å½•é¡µé¢ function otherLogin(loginType){ let fid = $("#fid").val(); let refer = $("#refer").val(); let accounttip = $("#accounttip").val(); let pwdtip = $("#pwdtip").val(); let hidecompletephone = $("#hidecompletephone").val(); let ebook = $("#ebook").val(); let allowSkip = $("#allowSkip").val(); let doubleFactorLogin = $("#doubleFactorLogin").val(); if (hidecompletephone == undefined) { hidecompletephone = 0; } let forbidotherlogin = $("#forbidotherlogin").val(); let url = _CP_+ "/login?loginType=" + loginType + "&newversion=true&fid=" + fid + "&hidecompletephone=" + hidecompletephone + "&ebook=" + ebook + "&allowSkip=" + allowSkip + "&forbidotherlogin=" + forbidotherlogin + "&refer=" + refer; if (accounttip != undefined) { url += "&accounttip=" + accounttip; } if (pwdtip != undefined) { url +="&pwdtip="+pwdtip; } if (doubleFactorLogin != undefined) { url +="&doubleFactorLogin="+doubleFactorLogin; } let independentId = $("#independentId").val(); if (independentId != undefined) { url += "&independentId=" + independentId; } if(window.parent != this.window){ window.open(url,"_blank"); }else{ location.href = url; } }
function toRegister() { var fid = $("#fid").val(); var refer = $("#refer").val(); var regurl = $("#regurl").val(); var quick = $("#quick").val(); var ebook = $("#ebook").val(); var allowSkip = $("#allowSkip").val(); if (quick == undefined) { quick = 0; } var url = "/enroll?quick=" + quick + "&newversion=true&fid=" + fid + "&ebook=" + ebook + "&allowSkip=" + allowSkip + "&refer=" + refer; let independentId = $("#independentId").val(); if (independentId != undefined) { url += "&independentId=" + independentId; } if (regurl != undefined && regurl != "") { if (regurl.indexOf("?") != -1) { url = regurl + "&fid=" + fid + "&refer=" + refer; } else { url = regurl + "?fid=" + fid + "&refer=" + refer; } } if (window.parent != this.window) { window.open(_CP_+url, "_blank"); } else { location.href = _CP_+url; } }
function toFindPwd(fromPage) { let independentId = $("#independentId").val(); let refer = $("#refer").val(); let fid = $("#fid").val(); let reg = /^[0-9]+.?[0-9]*$/; if (!reg.test(fid)) { fid = 0; } let flushCookie = true; if (typeof fromPage != 'undefined' && fromPage != '') { //ç›®å‰ä¸æ˜¯ä»ŽåŒå› å找回密ç 的都进行cookie刷新 flushCookie = fromPage.indexOf("toTwoFactorLogin") < 0; refer = encodeURIComponent(fromPage); } let url = _CP_ + "/pwd/findpwd?version=1&fid=" + fid + "&flushCookie=" + flushCookie + "&independentId=" + independentId + "&refer=" + refer; if (window.parent != this.window) { window.open(url, "_blank"); } else { location.href = url; } }
function toUnitFindPwd() { let refer = encodeURIComponent($("#refer").val()); let fid = $("#fid").val(); let uname = $("#uname").val(); location.href = _CP_+"/pwd/pwdappeal?client=false&fid=" + fid + "&uname=" + uname + "&refer=" + refer; }
//获å–登录页é¢ä¸‹æ–¹æ˜¾ç¤ºçš„通知内容 function showNotice(fid) { if (util.isEmpty(fid) || fid < 0) { return; } else { $.get(_CP_+"/api/notice",{'fid':fid},function(data,status){ if(data.status){ var content = delHtmlTag(data.content); $("#noticeContent").html(content); $("#notice").show(); } },"json"); } }
function delHtmlTag(str) { return str; //return str.replace(/<[^>]+>/g, "");// 去掉所有的htmlæ ‡è®° }
//tabåˆ‡æ¢ function initTab(parent, changeBack, x) { var _index = x || 1; $(parent).find('.tab-head .tab-t').removeClass('current'); $(parent).find('.tab-head .tab-t').eq(_index - 1).addClass('current'); $(parent).find('.tab-list').hide(); $(parent).find('.tab-list').eq(_index - 1).show();
$(parent).on('click', '.tab-head .tab-t', function () { $(this).siblings().removeClass('current'); $(this).addClass('current'); $(parent).find('.tab-list').hide(); var index = $(this).index(); $(parent).find('.tab-list').eq(index).show(); if (changeBack) { changeBack(); } }) }
//åŠ è½½æ»‘åŠ¨æ ¡éªŒå— function loadSlide(beforeFun, onVerifyFun) { let url = document.location.protocol + '//captcha.chaoxing.com/load.min.js' + '?t=' + getTimestamp(60 * 1000); // 时长1分钟,建议时长分钟级别 beforeFun && beforeFun(); loadScript(url, function () { try { //验è¯ç åˆå§‹åŒ– var initCaptcha = initCXCaptcha({ captchaId: 'GcXX5vewqE7DezKGlyvleKCnkTglvGpL', element: '#captcha', mode: 'popup', onVerify: function (err, data) { if (err) return; // 当验è¯å¤±è´¥æ—¶ï¼Œå†…部会自动refreshæ–¹æ³•ï¼Œæ— éœ€æ‰‹åŠ¨å†è°ƒç”¨ä¸€æ¬¡ $("#validate").val(data.validate); // æˆåŠŸäº‹ä»¶ onVerifyFun && onVerifyFun(); capInstance.refresh(); } }, function onload(instance) { capInstance = instance; }, function onerror(err) { }); } catch (e) { } }) }
//åŒå› å登录 手机+验è¯ç æ ¡éªŒ||手机+密ç æ ¡éªŒ function twoFactorVerifyBtnClick(type) { util.showMsg(false, "pwdMsg", "", true); util.showMsg(false, "vercodeMsg", "", true); $(".voice-tip").removeClass("voice-tip"); let refer = $("#refer").val(); let phone = $("#phone").val().trim(); let vercode = $("#vercode").val(); let password = $("#pwd").val(); let postUrl = '/v11/checkPassword'; let postData = {'phone': phone, 'password': password}; if (type === 'verify_code') {//æ ¡éªŒéªŒè¯ç postUrl = '/v11/checkmessage'; postData = {'phone': phone, 'vcode': vercode}; vercode.trim(); if (util.isEmpty(vercode)) { //é¿å…与下方æç¤ºå†²çª util.showMsg(true, "vercodeMsg", "", true); util.showMsg(true, "err-txt", please_input_captcha); return; } else if (!util.checkPhoneCode(vercode)) { //é¿å…与下方æç¤ºå†²çª util.showMsg(true, "vercodeMsg", "", true); util.showMsg(true, "err-txt", captcha_format_error); return; } } else {//æ ¡éªŒå¯†ç if (util.isEmpty(password)) { util.showMsg(true, "pwdMsg", please_input_pwd, true); return; } } $.ajax({ url: _CP_ + postUrl, type: "post", dataType: 'json', data: postData, success: function (data) { if (data.status) { if (top.location != self.location && $("#_blank").val() == "1") { top.location = refer; } else { window.location = refer; } } else { util.showMsg(true, "err-txt", data.mes); } } }); }
|