| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <!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|ie-comp|ie-stand" />
- <link rel="shortcut icon" href="img/32.ico" />
- <script src="Script/Common/huayi.load.js"></script>
- <script src="Script/Common/huayi.config.js"></script>
- <link href="./css/login.css" rel="stylesheet">
- </head>
- <body>
- <div class="login">
- <!--背景图片-->
- <div class="login_bg"></div>
- <!--登陆部分-->
- <div class="login_center">
- <div class="title_img"><img src="img/login_title.png"/></div>
- <div class="login_text" id="signin">
- <ul>
- <li>
- <div class="fl flbox">用户账号</div>
- <div class="fl"><input type="" name="" id="user" value="" placeholder="请输入您的管理账号"/></div>
- </li>
- <li>
- <div class="fl flbox">分机号</div>
- <div class="fl"><input type="" name="" id="userSeat" value="" placeholder="请输入分机号"/></div>
- </li>
- <li>
- <div class="fl flbox">用户密码</div>
- <div class="fl">
- <input type="password" placeholder="请输入您的密码" name="" id="password" value="" />
-
- </div>
-
- </li>
- </ul>
- <div class="alert_box">
- <i class="alert_iocn"></i>
- <span class="">
- 账号密码不能为空
- </span>
- </div>
- <button class="btns">登录</button>
- </div>
- </div>
- </div>
- <script>
- $(function () {
- /*输入框样式改变*/
- $("#user").focus(function () {
- $(this).parent().addClass("_success");
- });
- $("#user").blur(function () {
- $(this).parent().removeClass("_success");
- });
- $("#password").focus(function () {
- $(this).parent().addClass("_success");
- });
- $("#password").blur(function () {
- $(this).parent().removeClass("_success");
- });
- /*输入框绑定验证*/
- // $('#signin').find("input[class='form-control']").on('focus input propertychange', valideInput);
- /*cook存储数据*/
- if ($.cookie("username")) {
- //取值如果存在则赋值
- $("#user").val($.cookie("user"));//用户名
- }
- $(".btns").click(function () {
- login();
- });
- $('input').bind('keypress', function (event) {
- if (event.keyCode == "13") {
- $('.btns').trigger("click");
- }
- });
- });
- /*点击提交*/
- function login() {
- var User = $("#user").val();
- var Password = $("#password").val();
- var userSeat = $("#userSeat").val();
- /*保存COOK*/
- /*表单验证*/
- if (User == "" || Password == "") {
- $(".alert_box").show();
- if ($("#user").val() == "") {
- $("#user").focus(function () {
- $(".alert_box").hide();
- });
- } else {
- $(".user_ts").addClass("Yz_success");
- }
- } else {
- // jQuery.support.cors = true;
- /*请求后台*/
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "/Login/login",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- $('.btns').text('登录中...');
- loadIndex = layer.load();
- },
- // crossDomain: true == !(document.all),
- data: {
- username: User,
- extensionphone: userSeat,
- password: Password
- },
- success: function (data) {
- layer.close(loadIndex);
- /*验证请求*/
- if (data.state == "success") {
- helper.cookies.setday("token", data.data.token, 7);
- helper.cookies.setday("extno", userSeat, 7);
- // $.cookie("extno", userSeat, { expires: 7 });
- window.location.href = "index.html";
- } else {
- layer.msg("登录失败");
- $("#user").val('');
- $("#userSeat").val('');
- $("#password").val('');
- }
- },
- error: function(textStatus) {
- layer.close(loadIndex);
- $('.btns').text('登录');
- },
- complete: function(XMLHttpRequest, textStatus) {
- layer.close(loadIndex);
- if(textStatus == 'timeout') {
- var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
- xmlhttp.abort();
- layer.confirm('网络超时,请稍后再试...', {
- closeBtn: 0,
- btn: ['确定'] //按钮
- });
- }
- $('.btns').text('登录');
- },
- });
- }
- }
-
- </script>
- </body>
- </html>
|