| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
- <title>登录</title>
- <meta name="keywords">
- <meta name="description">
- <meta name="renderer" content="webkit">
- <link rel="shortcut icon" href="img/32.ico" />
- <link rel="stylesheet" href="./css/init.css" />
- <link rel="stylesheet" href="css/login.css" />
-
- </head>
- <body class="signin">
- <div class="wrap clearfix">
- <div class="wrap_left" style="position: relative;">
- <div class="wrap_bj"></div>
- <div class="leftCon">
- <img src="img/logintext.png"/>
- </div>
- </div>
- <div class="wrap_right">
- <div class="rightCon">
- <div class="logo" style="width: 100%;text-align: center;">
- <!--<i class="logo"></i><div class="logoWord"></div>-->
- <img src="img/sqLogo.png" alt="" />
- </div>
- <!--<div class="row clearfix">-->
- <div class="tab_box">
- <!--col-sm-7-->
- <ul class="clearfix tab_ul">
- <li class="active">坐席登录</li>
- <li>用户登录</li>
- </ul>
- <div class="tab_content">
- <div class="tab_one">
- <p>
- <i class="login_icon login_icon_user "></i>
- <input class="zx_user" type="text" placeholder="请输入您的管理账号" />
- <i class="login_icon error error_zx error_zx_user"></i>
- </p>
- <p>
- <i class="login_icon login_icon_hua "></i>
- <input class="zx_fj" type="text" placeholder="请输入分机号" />
- <i class="login_icon error error_zx error_zx_fj"></i>
- </p>
- <p>
- <i class="login_icon login_icon_lock "></i>
- <input class="zx_psw" type="password" placeholder="请输入您的密码" />
- </p>
- <p>
- <i class="login_icon login_icon_hua "></i>
- <input class="verification" type="number" placeholder="请输入验证码" />
- <button class="btnVerifi" type="button">获取验证码</button>
- </p>
- <p class="login_go login_zx">登录</p>
- </div>
- <div class="tab_two" style="display: none;">
- <p>
- <i class="login_icon login_icon_user "></i>
- <input class="gl_user" type="text" placeholder="请输入您的管理账号" />
- <i class="login_icon error error_gl error_gl_user"></i>
- </p>
- <p>
- <i class="login_icon login_icon_lock"></i>
- <input class="gl_psw" type="password" placeholder="请输入您的密码" />
- <i class="login_icon error error_gl error_gl_psw"></i>
- </p>
- <p>
- <i class="login_icon login_icon_hua "></i>
- <input class="verification_user" type="text" placeholder="请输入验证码" />
- <button class="btnVerifi_user" type="button">获取验证码</button>
- </p>
- <p class="login_go login_gl">登录</p>
- </div>
- </div>
- </div>
- <!--</div>-->
- <div class="service" >
- <!--row clearfix-->
- <!--<div class="col-sm-7">-->
- <p style="color: #313c58; font-size: 12px;text-align: center;"></p>
- <!--</div>-->
- </div>
-
- </div>
-
- </div>
- </div>
- <script src="./Script/Common/huayi.load.js"></script>
- <script src="./Script/Common/huayi.config.js"></script>
- <script src="./js/jquery.md5.js"></script>
- <script src="./js/aes/crypto-js.js"></script>
- <script>
- $(function() {
- var a=0;
- $('.tab_ul li').click(function() {
- $(this).addClass("active").siblings().removeClass("active");
- var index = $(this).index();
- a=index;
- $('.tab_content').children('div').eq(index).show().siblings().hide();
-
- })
- /*cook存储数据*/
- if($.cookie("username")) {
- //取值如果存在则赋值
- $(".gl_user").val($.cookie("user")); //用户名
- $("zx_fj").val($.cookie("fj"));
- $(".zx_user").val($.cookie("user"));
- }
- //键盘登录事件
- $('input').bind('keypress', function(event) {
- if(event.keyCode == "13") {
- if(a == 0) {
- $('.login_zx').trigger("click");
- } else {
- $(".login_gl").trigger("click");
- }
- }
- });
- //坐席登录
- $('.login_zx').click(function(){
- var zx_user = $(".zx_user").val();
- var zx_fj = $(".zx_fj").val();
- var zx_psw = $(".zx_psw").val();
- if(zx_user == "" || zx_fj == "" || zx_psw == "") {
- $(".error_zx").addClass('errorShow');
- if($(".zx_user").val() == "") {
- $(".zx_user").focus(function() {
- $(".error_zx").removeClass('errorShow');
- });
- } else {
- $(".error_zx_user").removeClass('errorShow');
- }
- }else {
- var currenttime=CurentTime();
- var datatime=currenttime.split(' ')[1].split(':').join('')
- var key = CryptoJS.enc.Utf8.parse(")O[9d]6,YF}+efcaj{+8>Z'e9M"+datatime);
- var zx_psw = CryptoJS.enc.Utf8.parse($.md5(zx_psw));
- var encrypted = CryptoJS.AES.encrypt(zx_psw, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
- /*请求后台*/
- $.cookie("extno",zx_fj);
- $.cookie("zx_user",zx_user);
-
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "/Login/login",
- dataType: 'json',
- async: true,
- data: {
- username: zx_user,
- extensionphone: zx_fj,
- LoginTime:currenttime,
- password:encrypted.toString(),
- Code:$(".verification").val()
- },
- success: function(data) {
- /*验证请求*/
- if(data.state == "success") {
- $.cookie("token", data.data.token, {
- expires: 7
- });
- $.cookie("extno", zx_fj, {
- expires: 7
- });
- $.cookie("zx_user", zx_user, {
- expires: 7
- });
- window.location.href = "home.html";
-
- }
- //else {
- // $(".zx_user").val('');
- // $(".zx_fj").val('');
- // $(".zx_psw").val('');
- //}
- }
- });
- }
- })
-
- function CurentTime(){
- var now = new Date();
-
- var year = now.getFullYear(); //年
- var month = now.getMonth() + 1; //月
- var day = now.getDate(); //日
-
- var hh = now.getHours(); //时
- var mm = now.getMinutes(); //分
- var ss = now.getSeconds(); //秒
-
- var clock = year + "-";
-
- if(month < 10)
- clock += "0";
-
- clock += month + "-";
-
- if(day < 10)
- clock += "0";
-
- clock += day + " ";
-
- if(hh < 10)
- clock += "0";
-
- clock += hh + ":";
- if (mm < 10) clock += '0';
- clock += mm + ":";
- if (ss < 10) clock += '0';
- clock += ss;
- return(clock);
- }
-
- //用户登录
- $('.login_gl').click(function() {
- var gl_user = $(".gl_user").val();
- var gl_psw = $(".gl_psw").val();
- if(gl_user == "" || gl_psw == "") {
- $(".error_gl").addClass('errorShow');
- if($(".gl_user").val() == "") {
- $(".gl_user").focus(function() {
- $(".error_gl").removeClass('errorShow');
- });
- } else {
- $(".error_gl_user").removeClass('errorShow');
- }
- } else {
- var currenttime=CurentTime();
- var datatime=currenttime.split(' ')[1].split(':').join('')
- var key = CryptoJS.enc.Utf8.parse(")O[9d]6,YF}+efcaj{+8>Z'e9M"+datatime);
- var gl_psw = CryptoJS.enc.Utf8.parse($.md5(gl_psw));
- var encrypted = CryptoJS.AES.encrypt(gl_psw, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
-
- /*请求后台*/
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "/Login/login",
- dataType: 'json',
- async: true,
-
- data: {
- username: gl_user,
- password: encrypted.toString(),
- LoginTime:currenttime,
- Code:$(".verification_user").val()
- },
- success: function(data) {
- /*验证请求*/
- if(data.state == "success") {
- $.cookie("token", data.data.token, {
- expires: 7
- });
- $.cookie("zx_user", gl_user, {
- expires: 7
- });
- window.location.href = "home.html";
- }
- //else{
- // $(".gl_user").val('');
- // $(".gl_psw").val('');
- //}
- }
- });
- }
- })
-
- $(".btnVerifi").click(function(){
-
- if (!$(".zx_user").val()) {
- layer.msg('请输入账号')
- return false;
- }
- var mobile = $(".zx_user").val();
- sendMsg(mobile);
-
- })
-
- $(".btnVerifi_user").click(function(){
-
- if (!$(".gl_user").val()) {
- layer.msg('请输入账号')
- return false;
- }
- var mobile = $(".gl_user").val();
- sendMsg(mobile);
-
- })
-
- function sendMsg(mobile){
- console.log(mobile)
- $.ajax({
- type:"post",
- url:huayi.config.callcenter_url+"Login/SendCode",
- async:true,
- dataType:'json',
- // beforeSend: function() { //触发ajax请求开始时执行
- // $('.btnVerifi').attr('disabled', 'disabled'); // 禁用按钮
- // $('.btnVerifi_user').attr('disabled', 'disabled'); // 禁用按钮
- // },s
- data:{
- usercode:mobile
- },
- success:function(data){
- if (data.state == "success") {
- layer.msg('发送成功')
- // $('.btnVerifi').removeAttr('disabled')
- // $('.btnVerifi_user').removeAttr('disabled')
- verifi();
- }
- }
- });
- }
-
- function verifi(){
- var time = 60;
- var timer = null;
- $('.btnVerifi').text(time + '秒后重新发送');
- $('.btnVerifi').attr('disabled', 'disabled'); // 禁用按钮
- $('.btnVerifi_user').text(time + '秒后重新发送');
- $('.btnVerifi_user').attr('disabled', 'disabled'); // 禁用按钮
- timer = setInterval(function(){
- // 定时器到底了 兄弟们回家啦
- if(time == 1){
-
- clearInterval(timer);
- $('.btnVerifi').text("获取验证码")
- $('.btnVerifi_user').text('获取验证码')
- $('.btnVerifi').removeAttr('disabled')
- $('.btnVerifi_user').removeAttr('disabled')
-
- }else{
-
- time--;
- $('.btnVerifi').text(time + '秒后重新发送');
- $('.btnVerifi_user').text(time+'秒后重新发送');
-
- }
- }, 1000)
-
- }
- })
- </script>
- </body>
- </html>
|