main.js 28.1 KB
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 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896
(function($) {
  
  "use strict";

  // let apiurl = 'https://zhipingtest.tanleizhen.com/api'//测试
  // let window.location.origin+'/api' = 'https://efuser.guorongrong.top/lh'//吴国强
  let apiurl = window.location.origin+'/api'//吴国强
  // let toUrl = 'https://zhipingtest.tanleizhen.com/homePage'
  let toUrl = window.location.origin+"/homePage"

  window.downHttp = window.location.origin;

  let fileUrl = '';
/* 
   CounterUp
   ========================================================================== */
    $('.counter').counterUp({
      time: 500
    });

/* 
   MixitUp
   ========================================================================== */
  $('#portfolio').mixItUp();

/* 

   Clients Sponsor 
   ========================================================================== */
    var owl = $("#clients-scroller");
    /* owl.owlCarousel({
      items:5,
      itemsTablet:3,
      margin:90,
      stagePadding:90,
      smartSpeed:450,
      itemsDesktop : [1199,4],
      itemsDesktopSmall : [980,3],
      itemsTablet: [768,3],
      itemsTablet: [767,2],
      itemsTabletSmall: [480,2],
      itemsMobile : [479,1],
    }); */

  /* Testimonials Carousel 
  ========================================================*/
    var owl = $("#testimonials");
      /* owl.owlCarousel({
        navigation: false,
        pagination: true,
        slideSpeed: 1000,
        stopOnHover: true,
        autoPlay: true,
        items: 2,
        itemsDesktop : [1199,2],
        itemsDesktopSmall : [980,2],
        itemsTablet: [768,1],
        itemsTablet: [767,1],
        itemsTabletSmall: [480,1],
        itemsMobile : [479,1],
      }); */   

/* 
   Touch Owl Carousel
   ========================================================================== */
    var owl = $(".touch-slider");
    /* owl.owlCarousel({
      navigation: false,
      pagination: true,
      slideSpeed: 1000,
      stopOnHover: true,
      autoPlay: true,
      items: 1,
      itemsDesktopSmall: [1024, 1],
      itemsTablet: [600, 1],
      itemsMobile: [479, 1]
    });

    $('.touch-slider').find('.owl-prev').html('<i class="lni-chevron-left"></i>');
    $('.touch-slider').find('.owl-next').html('<i class="lni-chevron-right"></i>'); */

/* 
   Sticky Nav
   ========================================================================== */
    $(window).on('scroll', function() {
        if ($(window).scrollTop() > 200) {
            $('.header-top-area').addClass('menu-bg');
        } else {
            $('.header-top-area').removeClass('menu-bg');
        }
    });

/* 
   VIDEO POP-UP
   ========================================================================== */
    /* $('.video-popup').magnificPopup({
        disableOn: 700,
        type: 'iframe',
        mainClass: 'mfp-fade',
        removalDelay: 160,
        preloader: false,
        fixedContentPos: false,
    }); */

/* 
   Back Top Link
   ========================================================================== */
    /* var offset = 200;
    var duration = 500;
    $(window).scroll(function() {
      if ($(this).scrollTop() > offset) {
        $('.back-to-top').fadeIn(400);
      } else {
        $('.back-to-top').fadeOut(400);
      }
    });

    $('.back-to-top').on('click',function(event) {
      event.preventDefault();
      $('html, body').animate({
        scrollTop: 0
      }, 600);
      return false;
    }) */

/* 
   One Page Navigation & wow js
   ========================================================================== */
    //Initiat WOW JS
    new WOW().init();

    // one page navigation 
    $('.main-navigation').onePageNav({
            currentClass: 'active'
    }); 

    $(window).on('load', function() {
       
        $('body').scrollspy({
            target: '.navbar-collapse',
            offset: 195
        });

        $(window).on('scroll', function() {
            if ($(window).scrollTop() > 200) {
                $('.fixed-top').addClass('menu-bg');
            } else {
                $('.fixed-top').removeClass('menu-bg');
            }
        });

    });
/* Nivo Lightbox
  ========================================================*/   
   $('.lightbox').nivoLightbox({
    effect: 'fadeScale',
    keyboardNav: true,
  });


/* stellar js
  ========================================================*/
  $.stellar({
    horizontalScrolling: false,
    verticalOffset: 30,
    responsive: false
  });

/* 
   Page Loader
   ========================================================================== */
   $(window).on('load',function() {
      "use strict";
      $('#loader').fadeOut();
      $("#loginName").val('')
      $("#loginPassword").val('')
      $("#loginCode").val('')
    });

  /* logo跳转 */
$("#logo").click(function(){
  window.location.href=window.location.origin;
});
/* 回车登录 */
$(document).keyup(function(event){
  if(event.keyCode ==13){
   $("#loginNow").trigger("click");
  }
 });
    // get code
    function draw() {
      $('#code img').attr('src',window.location.origin+'/api'+"/web/businessUser/getKaptchaImage")
    }
    
    //顶部菜单
    $('.navbar-toggler').on('click',function(){
      $('.blackone').toggle()
      $('#navbarCollapse').toggle()
    })
    $('.blackone').on('click',function(){
      $('#navbarCollapse').hide()
      $('.blackone').hide()
      $('#navbarCollapse').removeClass('show')
    })
      //切换验证码
      $('#code').on('click',function(){
        draw()
      })
      //立即登录
      $("#loginNow").on('click',function(){
          if($("#loginName").val()==''){
            $("#login .jiaoyan").text('账号不能为空')
            return false
          }
          if($("#loginPassword").val()==''){
            $("#login .jiaoyan").text('密码不能为空')
            return false
          }
          if($("#loginCode").val()==''){
            $("#login .jiaoyan").text('验证码不能为空')
            return false
          }
          
          let formData = {
            loginName:$("#loginName").val(),
            password:$("#loginPassword").val(),
            kaptcha:$("#loginCode").val()
          }
          $.ajax({
              url: window.location.origin+'/api' + "/web/businessUser/login",
              data: formData,
              contentType: 'application/x-www-form-urlencoded',
              type: "POST",
              dataType: "json",
              success: function(res) {
                if (res.code == 2000) {
                  window.localStorage.setItem("setUserInfo",JSON.stringify(res.data))
                  window.localStorage.setItem("setToken",res.data.token)
                  window.localStorage.setItem("token",res.data.token)
                  window.localStorage.setItem("userType",res.data.userType)
                  window.localStorage.setItem("noticeRead",res.data.noticeRead)
                  $("#login .jiaoyan").text('')
                  window.location.href = toUrl;
                }else{
                  $("#login .jiaoyan").text(res.msg)
                  draw()
                }
              }
          });
      })
      //点击蒙层关闭
      $("#black").on('click',function(){
          $('#black').hide()
          $('#forgetSuccess').hide()
          $('#forgetPassword').hide()
          $('#setPassword').hide()
          $('#registerSuccess').hide()
          $('#register').hide()
          $('#login').hide()
      })
      //平台登录
      $("#loginShow").on('click',function(){
          draw()
          $("#loginName").val('')
          $("#loginPassword").val('')
          $("#loginCode").val('')
          $('#black').show()
          $('#login').show()
      })
      //终端下载的立即申请
      $("#applyDown").on('click',function(){
        $("#setTel").val('')
        $("#setCode").val('')
        $("#setName").val('')
        $("#setEmail").val('')
        $("#setCompany").val('')
        $("#setDpartment").val('')
        $("#setPost").val('')
        $("#setCity").val('')
        $("#setMessage").val('')
        $("#upload").val('')
        $('#black').show()
        $('#login').hide()
        $('#diaLog').hide()
        $('#register').show()
      })
      //立即申请
      $("#apply").on('click',function(){
        $("#setTel").val('')
        $("#setCode").val('')
        $("#setName").val('')
        $("#setEmail").val('')
        $("#setCompany").val('')
        $("#setDpartment").val('')
        $("#setPost").val('')
        $("#setCity").val('')
        $("#setMessage").val('')
        $("#upload").val('')   
        $('#black').show()
        $('#login').hide()
        $('#register').show()
      })
      //删除名片
      $(".img_box").on("click","#deleImg",function(){
        var textHtml = '<img src="img/addCard.png" alt=""><input type="file" value="上传文件" id="upload" class="uploader-file"  accept="image/*" onchange="getImgURL(this)">';
        $(".img_box").html(textHtml);
      })
      //验证码倒计时
      function timeDown(id){
        var c = 60;
        $("#"+id).attr("disabled","disabled");//点击一次不可再点
        var interval = setInterval(function(){//定义定时器
          $("#"+id).val(c+"s之后重试");
          c--;
          if(c == 0){
            clearInterval(interval);//清除定时器
            $("#"+id).val("重新获取验证码");
            $("#"+id).removeAttr("disabled");//删除这个属性
            c=60;
          }	
        },1000);
      }
      //申请账号获取验证码
      $("#getCode").on('click',function(){
        if($("#setTel").val()==''){
          $("#register .jiaoyan").text('手机号码不能为空')
          return false
        }
        if(!(/^1[3456789]\d{9}$/.test($("#setTel").val()))){
          $("#register .jiaoyan").text('请输入正确的手机号')
          return false
        }
        var obj = {phone:$("#setTel").val(),type:3}
        $.ajax({
            url: window.downHttp+'/api' + "/web/register/sendSms",
            data: obj,
            type: "POST",
            dataType: "json",
            success: function(res) {
              if (res.code == 2000) {
                $("#register .jiaoyan").text('')
                timeDown('getCode')
              }else{
                $("#register .jiaoyan").text(res.msg)
              }
            }
        });
      })
      //申请账号下一步
      $("#applyNext").on('click',function(){
          
          if($("#setTel").val()==''){
            $("#register .jiaoyan").text('手机号码不能为空')
            return false
          }
          if(!/^1[0-9]{10}$/.test($("#setTel").val())){
            $("#register .jiaoyan").text('请输入正确的手机号')
            return false
          }
          if($("#setCode").val()==''){
            $("#register .jiaoyan").text('验证码不能为空')
            return false
          }
          if($("#setName").val()==''){
            $("#register .jiaoyan").text('姓名不能为空')
            return false
          }
          if($("#setEmail").val()==''){
            $("#register .jiaoyan").text('邮箱不能为空')
            return false
          }
          
          
          if(!/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/.test($("#setEmail").val())){
            $("#register .jiaoyan").text('请输入正确的邮箱')
            return false
          }
          if($("#setCompany").val()==''){
            $("#register .jiaoyan").text('公司名称不能为空')
            return false
          }
          if($("#setPost").val()==''){
            $("#register .jiaoyan").text('职务不能为空')
            return false
          }
          if($("#cardImg").data('url')==""||$("#cardImg").data('url')==undefined){
            $("#register .jiaoyan").text('名片不能为空')
            return false
          }
          apply()
      })
      // 获取地址栏参数
      function GetRequest() {
        var url = location.search; //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
              var str = url.substr(1);
              strs = str.split("?");
              console.log(strs)
              for (var i = 0; i < strs.length; i++) {
                  theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
              }
          }
          return theRequest;
      }

      function apply(){
        var a=GetRequest();
        var userSource = a['userSource'];
        let applyForm= {
          city: $("#setCity").val(),
          code: $("#setCode").val(),
          companyName: $("#setCompany").val(),
          dept: $("#setDpartment").val(),
          email: $("#setEmail").val(),
          job: $("#setPost").val(),
          phone: $("#setTel").val(),
          qq: "",
          userName: $("#setName").val(),
          wx: "",
          remark: $("#setMessage").val(),
          // password:$("#intoPassword").val(),
          cardPath:$("#cardImg").data('url'),
          userSource: "gw"
        }
        
        $.ajax({
            url: window.downHttp+'/api' + "/web/userApplyAccount/UserApplyRegister",
            data: applyForm,
            type: "POST",
            dataType: "json",
            success: function(res) {
              if (res.code == 2000) {
                $("#register .jiaoyan").text('');
                var textHtml = '<img src="img/addCard.png" alt=""><input type="file" value="上传文件" id="upload" class="uploader-file"  accept="image/*" onchange="getImgURL(this)">';
                $(".img_box").html(textHtml);
                $('#register').hide()
                // $("#zhanghao").text('您的账号为:'+res.data)
                // $('#setPassword').hide()

                $("#setTel").val('')
                $("#setCode").val('')
                $("#setName").val('')
                $("#setEmail").val('')
                $("#setCompany").val('')
                $("#setDpartment").val('')
                $("#setPost").val('')
                $("#setCity").val('')
                $("#setMessage").val('')

                $('#black').show()
                
                $('#registerSuccess').show()
                closeSuccese();

              }else{
                $("#register .jiaoyan").text(res.msg)
              }
            }
        });
      }
      //设置密码提交
      $("#toRegisterSuccess").on('click',function(){
        if($("#intoPassword").val()==''){
          $("#setPassword .jiaoyan").text('密码不能为空')
          return false
        }
        if($("#confirmPassword").val()==''){
          $("#setPassword .jiaoyan").text('确认密码不能为空')
          return false
        }
        if($("#intoPassword").val()!=$("#confirmPassword").val()){
          $("#setPassword .jiaoyan").text('两次密码输入不一致')
          return false
        }
        let rep = /(?!^[0-9]+$)(?!^[A-z]+$)(?!^[^A-z0-9]+$)^.{6,16}$/;
        if (!rep.test($("#intoPassword").val())) {
          // this.$message.error("请按照规则设置密码");
          $("#setPassword .jiaoyan").text('请按照规则设置密码')
          return false;
        }
        let applyForm= {
          city: $("#setCity").val(),
          code: $("#setCode").val(),
          companyName: $("#setCompany").val(),
          dept: $("#setDpartment").val(),
          email: $("#setEmail").val(),
          job: $("#setPost").val(),
          phone: $("#setTel").val(),
          qq: "",
          userName: $("#setName").val(),
          wx: "",
          remark: $("#setMessage").val(),
          password:$("#intoPassword").val(),
          cardPath:$("#cardImg").data('url')
        }
        $.ajax({
            url: window.location.origin+'/api' + "/web/register/registerUser",
            data: applyForm,
            type: "POST",
            dataType: "json",
            success: function(res) {
              if (res.code == 2000) {
                $("#setPassword .jiaoyan").text('')
                $('#black').show()
                $("#zhanghao").text('您的账号为:'+res.data)
                $('#setPassword').hide()
                $('#registerSuccess').show()
              }else{
                $("#setPassword .jiaoyan").text(res.msg)
              }
            }
        });
          
      })
      //设置密码上一步
      $("#setPasswordCancle").on('click',function(){
          $('#black').show()
          $('#setPassword').hide()
          $('#register').show()
      })
      //申请账号取消
      $("#applyCancle").on('click',function(){
          $('#black').hide()
          $('#register').hide()
          $("#register .jiaoyan").text('')
          $("#loginName").val('')
          $("#loginPassword").val('')
          $("#loginCode").val('')
          $("#login .jiaoyan").text('')
      })
      //申请成功关闭
      $("#successClose").on('click',function(){
        setTimeout(function (){
          $('#black').hide()
          $('#registerSuccess').hide()
        },3000)
      })
      //忘记密码
      $("#toForget").on('click',function(){
          $("#forgetTel").val('')
          $("#intoCode").val('')
          $("#forgetSetPass").val('')
          $("#forgetConfirmPass").val('')
          $('#black').show()
          $('#login').hide()
          $('#forgetPassword').show()
      })
      //忘记密码获取验证码
      $("#forgetCode").on('click',function(){
        if($("#forgetTel").val()==''){
          $("#forgetPassword .jiaoyan").text('手机号码不能为空')
          return false
        }
        if(!(/^1[3456789]\d{9}$/.test($("#forgetTel").val()))){
          $("#forgetPassword .jiaoyan").text('请输入正确的手机号')
          return false
        }
        var obj = {phone:$("#forgetTel").val()}
        $.ajax({
            url: window.location.origin+'/api' + "/web/register/sendSms",
            data: obj,
            type: "POST",
            dataType: "json",
            success: function(res) {
              if (res.code == 2000) {
                $("#forgetPassword .jiaoyan").text('')
                timeDown('forgetCode')
              }else{
                $("#forgetPassword .jiaoyan").text(res.msg)
              }
            }
        });
      })
      // 忘记密码提交
      $("#getPassword").on('click',function(){
        if($("#forgetTel").val()==''){
          $("#forgetPassword .jiaoyan").text('手机号码不能为空')
          return false
        }
        if(!(/^1[3456789]\d{9}$/.test($("#forgetTel").val()))){
          $("#forgetPassword .jiaoyan").text('请输入正确的手机号')
          return false
        }
        if($("#intoCode").val()==''){
          $("#forgetPassword .jiaoyan").text('验证码不能为空')
          return false
        }
        if($("#forgetSetPass").val()==''){
          $("#forgetPassword .jiaoyan").text('密码不能为空')
          return false
        }
        if($("#forgetConfirmPass").val()==''){
          $("#forgetPassword .jiaoyan").text('确认密码不能为空')
          return false
        }
        if($("#forgetSetPass").val()!=$("#forgetConfirmPass").val()){
          $("#forgetPassword .jiaoyan").text('两次密码输入不一致')
          return false
        }
        let rep = /(?!^[0-9]+$)(?!^[A-z]+$)(?!^[^A-z0-9]+$)^.{6,16}$/;
        if (!rep.test($("#forgetSetPass").val())) {
          $("#forgetPassword .jiaoyan").text('请按照规则设置密码')
          return false;
        }
        var obj = {
          phone:$("#forgetTel").val(),
          password:$("#forgetSetPass").val(),
          code:$("#intoCode").val()
        }
        $.ajax({
            url: window.location.origin+'/api' + "/web/register/remember",
            data: obj,
            type: "POST",
            dataType: "json",
            success: function(res) {
              if (res.code == 2000) {
                $("#forgetPassword .jiaoyan").text('')
                $('#black').show()
                $('#forgetPassword').hide()
                $('#forgetSuccess').show()
              }else{
                $("#forgetPassword .jiaoyan").text(res.msg)
              }
            }
        });
          
      })
      //忘记密码取消
      $("#passwordCancle").on('click',function(){
          $('#black').hide()
          $('#forgetPassword').hide()
          $("#forgetPassword .jiaoyan").text('')
      })
      //设置密码成功关闭
      $("#forgetSuccessCancle").on('click',function(){
          $('#black').hide()
          $('#forgetSuccess').hide()
      })


      //联系我们
      $("#contactSubmit").on("click",function(){
        if($("#name").val()==''){
          $("#services .contact_error_box").text('称呼不能为空')
          return false
        }
        if($("#email").val()==''){
          $("#services .contact_error_box").text('邮箱不能为空')
          return false
        }
        if($("#subject").val()==''){
          $("#services .contact_error_box").text('联系电话不能为空')
          return false
        }
        var obj = {
          nickname:$("#name").val(),
          mail:$("#email").val(),
          phone:$("#subject").val(),
          message:$("#message").val(),
        }
        
        $.ajax({
            url: window.location.origin+'/api' + "/web/contactUs/add",
            data: obj,
            type: "POST",
            dataType: "json",
            success: function(res) {
              if (res.code == 2000) {
                $(".contact_error_box").css("color","green");
                $(".contact_error_box").text("提交成功")
              }else{
                $("#forgetPassword .jiaoyan").text(res.msg)
              }
            }
        });
      })

      //判断是否通过客户端忘记密码进入
      if(getQueryVariable("forgetPass")&&getQueryVariable("forgetPass")==1){
          $('#black').show()
          $('#login').hide()
          $('#forgetPassword').show()
      }
}(jQuery));
function getQueryVariable(variable)
{
       var query = window.location.search.substring(1);
       var vars = query.split("&");
       for (var i=0;i<vars.length;i++) {
               var pair = vars[i].split("=");
               if(pair[0] == variable){return pair[1];}
       }
       return(false);
};

function kp(txt,len) {
              var v = txt.value;
              if(len==12){
                var reg = /^[a-zA-Z\d`~@#\$%\^&\*\(\)\-_=\+\[\]\{\}\\\|;\:'",<\.>\/\?]{0,12}$/;
              }else if(len==20){
                var reg = /^[a-zA-Z\d`~@#\$%\^&\*\(\)\-_=\+\[\]\{\}\\\|;\:'",<\.>\/\?]{0,20}$/;
              }else if(len==40){
                var reg = /^[a-zA-Z\d`~@#\$%\^&\*\(\)\-_=\+\[\]\{\}\\\|;\:'",<\.>\/\?]{0,40}$/;
              }else if(len==200){
                var reg = /^[a-zA-Z\d`~@#\$%\^&\*\(\)\-_=\+\[\]\{\}\\\|;\:'",<\.>\/\?]{0,200}$/;
              }
              
              var vv = v.replace(/[^\x00-\xff]/g, "aa");
              if (!reg.test(vv)) {
                  txt.value = txt.pv ? txt.pv : "";
              } else {
                  txt.pv = v;
              }
          }
function closeSuccese(){
  var count=3;
  $("#setPassword .jiaoyan").text('')
  
  $('#registerSuccess').show()
  var intervalBox=setInterval(() => {
    count--
    $("#registerSuccess .one").text('申请信息提交成功,请耐心等待'+" "+count)
    $('#setPassword').hide()
    if(count==0){
      clearInterval(intervalBox)
      $('#black').hide()
      $('#registerSuccess').hide()
    }
  }, 1000);
}
function customWayPoint(className, addClassName, customOffset) {
  var waypoints = $(className).waypoint({
    handler: function(direction) {
      if (direction == "down") {
        $(className).addClass(addClassName);
      } else {
        $(className).removeClass(addClassName);
      }
    },
    offset: customOffset
  });
}
//上传名片
function isAssetTypeAnImage(ext) {
  return [
  'png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].
  indexOf(ext.toLowerCase()) !== -1;
 }
function getImgURL(node) {
  var imgURL = "";
  try{
      var file = null;
      if(node.files && node.files[0] ){
          file = node.files[0];
          
      }else if(node.files && node.files.item(0)) {
          file = node.files.item(0);
      }
      //Firefox 因安全性问题已无法直接通过input[file].value 获取完整的文件路径
      try{
          //Firefox7.0
          imgURL =  file.getAsDataURL();
          //alert("//Firefox7.0"+imgRUL);
      }catch(e){
          //Firefox8.0以上
          imgRUL = window.URL.createObjectURL(file);
          //alert("//Firefox8.0以上"+imgRUL);
      }
  }catch(e){      //这里不知道怎么处理了,如果是遨游的话会报这个异常
      //支持html5的浏览器,比如高版本的firefox、chrome、ie10
      if (node.files && node.files[0]) {
          
          var reader = new FileReader();
          reader.onload = function (e) {
              imgURL = e.target.result;
          };
          reader.readAsDataURL(node.files[0]);
      }
  }
  console.log(node.files[0])
  var index= node.files[0].name.lastIndexOf(".");
//获取后缀
var imgType = node.files[0].name.substr(index+1);
  if(!isAssetTypeAnImage(imgType)){
    $("#register .jiaoyan").text('名片只能选择图片格式')
    return false
  }
  if($("#register .jiaoyan").text()=="名片只能选择图片格式"){
    $("#register .jiaoyan").text("")
  }
  if(node.files[0].size>=1024*1024*20){
    $("#register .jiaoyan").text('图片请限制在20M以内')
    return false
  }else {
    if($("#register .jiaoyan").text()=="图片请限制在20M以内"){
      $("#register .jiaoyan").text("")
    }
  }
  var obj=new FormData();
  obj.append("file",node.files[0])
  $.ajax({
      url:  window.downHttp+'/api' + '/web/oss/uploadFile',
      type: 'post',
      // dataType: 'json',
      data:obj,
      contentType: false,
      processData: false
  })
  .done(res => {
      if(res.code=="2000"){
        window.fileUrl = res.data.rows[0].url;
        var textHtml = "<div class='deleImg' id='deleImg'>×</div> <img id='cardImg' data-url='"+res.data.rows[0].url+"' src='"+res.data.rows[0].path+"'/>";
        $(".img_box").html(textHtml);
        
        if($("#register .jiaoyan").text()=='名片不能为空'){
          $("#register .jiaoyan").text('');
        }
      }else{
        $("#services .contact_error_box").text('上传失败,请重新上传')
      }
  })
  .fail(res => {
    $("#services .contact_error_box").text('上传失败,请重新上传')
  });
  

  // return imgURL;
}
function creatImg(imgRUL){   //根据指定URL创建一个Img对象
  var textHtml = "<img src='"+imgRUL+"'/>";
  $(".img_box").html(textHtml);
}
var defaultOffset = '50%';

for (i = 0; i < 17; i++) {
  customWayPoint('.timeline__item--' + i, 'timeline__item-bg', defaultOffset);
}



$(
  "#download0,#download1,#download2,#download3,#download4,#download5,#download6,#download7,#download8"
).on("click", function () {
  $("#diaLogName").val('');
  $("#diaLogPassword").val('');
  $(".jiaoyan").text('');
  $("#diaLog").show();
  $("#black").show();
  window.downHttp = 'https://ieva.lianxinzhiping.com';
});
//点击蒙层关闭
$("#black").on("click", function () {
  $("#black").hide();
  $("#diaLog").hide();
  window.downHttp = window.location.origin;
});
// 立即下载
$("#diaLogNow").on("click", function () {
  if ($("#diaLogName").val() == "") {
    $("#diaLog .jiaoyan").text("账号不能为空");
    return false;
  }
  if ($("#diaLogPassword").val() == "") {
    $("#diaLog .jiaoyan").text("密码不能为空");
    return false;
  }

  let formData = {
    loginName: $("#diaLogName").val(),
    password: $("#diaLogPassword").val(),
  };
  $.ajax({
    url: 'https://ieva.lianxinzhiping.com' + "/api" + "/web/businessUser/queryDownUrl",
    data: formData,
    contentType: "application/x-www-form-urlencoded",
    type: "GET",
    dataType: "json",
    success: function (res) {
      if (res.code == 2000) {
        window.location.href = res.data.exeUrl;
        $(".jiaoyan").text('');
        $("#black").hide();
        $("#diaLog").hide();
      } else {
        $("#diaLog .jiaoyan").text(res.msg);
      }
    },
  });
});
// 定位按钮
$("#downPdf").on("click", function () {
  window.open(
    "https://osssj.bxshicai.com/sm/%E8%81%94%E5%90%88%E6%99%BA%E8%AF%84%E9%87%91%E8%9E%8D%E7%BB%88%E7%AB%AF%E5%AE%89%E8%A3%85%E6%8C%87%E5%BC%95.pdf"
  );
});