管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-09-29 0dd12f147e948e36505a1a4b76d12e36ff4ea74a
1
已重命名1个文件
已添加1个文件
已修改9个文件
已删除1个文件
665 ■■■■■ 文件已修改
data/db.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/sys/SignController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/data/LoginEntity.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/helper/WebHelper.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/data/LoginService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/data/TokenService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/data/UsersService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/data/LoginMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/data/TokenMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/css/reset.css 199 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/css/style.css 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/templates/login.html 258 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db.sql
@@ -222,7 +222,7 @@
  ip varchar(30),
  type smallint default 1,
  status smallint default 1,
  browser varchar(100),
  descr varchar(100),
  userid integer default 1,
  optime timestamp(6) without time zone default now()
) partition by range(optime);
@@ -246,7 +246,7 @@
comment on column lf.sys_login.ip is 'IP地址';
comment on column lf.sys_login.type is '类别:1-登录,2-校验,3-登出';
comment on column lf.sys_login.status is '状态:1-成功,0-失败';
comment on column lf.sys_login.browser is '浏览器';
comment on column lf.sys_login.descr is '描述';
comment on column lf.sys_login.userid is '登录人ID';
comment on column lf.sys_login.optime is '登录时间';
src/main/java/com/lf/server/controller/sys/SignController.java
@@ -2,15 +2,20 @@
import com.lf.server.controller.BaseController;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.data.LoginEntity;
import com.lf.server.entity.data.UsersEntity;
import com.lf.server.entity.sys.LoginInfo;
import com.lf.server.entity.sys.Result;
import com.lf.server.entity.sys.User;
import com.lf.server.helper.StringHelper;
import com.lf.server.service.data.LoginService;
import com.lf.server.service.data.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * ç­¾åæŽ§åˆ¶å™¨
@@ -22,6 +27,9 @@
public class SignController extends BaseController {
    @Autowired
    UsersService userService;
    @Autowired
    LoginService loginService;
    /**
     * è·³åˆ°é¦–页
@@ -58,7 +66,7 @@
     * @return String
     */
    @PostMapping(value="/login", produces = "application/json; charset=UTF-8")
    public ResponseMsg<String> login(@RequestBody UsersEntity user) {
    public ResponseMsg<String> login(@RequestBody UsersEntity user, HttpServletRequest req, HttpServletResponse res) {
        try {
            if (user == null) {
                return fail("请输入用户名和密码!", null);
@@ -75,6 +83,15 @@
                return fail("用户名不存在!", null);
            }
            LoginEntity le = loginService.getNewLogin(user.getId(), req);
            if (!user.getPwd().equals(ue.getPwd())) {
                le.setStatus(0);
                le.setDescr("密码错误");
                loginService.insertLogin(le);
                return fail("密码不正确!", null);
            }
            le.setStatus(1);
            loginService.insertLogin(le);
            return null;
        } catch (Exception ex) {
src/main/java/com/lf/server/entity/data/LoginEntity.java
@@ -23,7 +23,7 @@
    private int status;
    private String browser;
    private String descr;
    private int userid;
@@ -69,12 +69,12 @@
        this.status = status;
    }
    public String getBrowser() {
        return browser;
    public String getDescr() {
        return descr;
    }
    public void setBrowser(String browser) {
        this.browser = browser;
    public void setDescr(String descr) {
        this.descr = descr;
    }
    public int getUserid() {
src/main/java/com/lf/server/helper/WebHelper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,94 @@
package com.lf.server.helper;
import org.springframework.context.annotation.Configuration;
import javax.servlet.http.HttpServletRequest;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
import java.util.UUID;
/**
 * Web帮助类
 * @author WWW
 */
public class WebHelper {
    private final static String UNKNOWN = "unknown";
    private final static String COMMA = ",";
    public static String getGuid() {
        /**
         * èŽ·å–GUID
         */
        return UUID.randomUUID().toString();
    }
    /**
     * èŽ·å–ç”¨æˆ·ip
     *
     * @param request
     * @return
     */
    public static String getIpAddress(HttpServletRequest request) {
        String ip = request.getHeader("X-Forwarded-For");
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED");
        }
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_CLUSTER_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_FORWARDED");
        }
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_VIA");
        }
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getHeader("REMOTE_ADDR");
        }
        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        if (ip.contains(COMMA)) {
            return ip.split(",")[0];
        }
        return ip;
    }
    /**
     * èŽ·å–å½“å‰æ—¶é—´çš„Timestamp
     */
    public static Timestamp getCurrentTimestamp() {
        return new Timestamp(System.currentTimeMillis());
    }
    /**
     * èŽ·å–å½“å‰æ—¶é—´æŒ‡å®šåˆ†é’Ÿæ•°åŽçš„Timestamp
     *
     * @param min åˆ†é’Ÿæ•°
     * @return
     */
    public static Timestamp getTimestamp(int min) {
        Calendar now = Calendar.getInstance();
        now.add(Calendar.MINUTE, min);
        return new Timestamp(now.getTimeInMillis());
    }
}
src/main/java/com/lf/server/service/data/LoginService.java
@@ -1,10 +1,12 @@
package com.lf.server.service.data;
import com.lf.server.entity.data.LoginEntity;
import com.lf.server.helper.WebHelper;
import com.lf.server.mapper.data.LoginMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@@ -61,4 +63,14 @@
    public List<LoginEntity> selectLoginAll() {
        return loginMapper.selectLoginAll();
    }
    public LoginEntity getNewLogin(int userid, HttpServletRequest req) {
        LoginEntity le = new LoginEntity();
        le.setAppid(1);
        le.setIp(WebHelper.getIpAddress(req));
        le.setUserid(userid);
        le.setOptime(WebHelper.getCurrentTimestamp());
        return le;
    }
}
src/main/java/com/lf/server/service/data/TokenService.java
@@ -1,10 +1,13 @@
package com.lf.server.service.data;
import com.lf.server.entity.data.LoginEntity;
import com.lf.server.entity.data.TokenEntity;
import com.lf.server.helper.WebHelper;
import com.lf.server.mapper.data.TokenMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@@ -63,4 +66,17 @@
    public List<TokenEntity> selectTokenAll() {
        return tokenMapper.selectTokenAll();
    }
    public TokenEntity getNewToken(int userid, HttpServletRequest req) {
        TokenEntity te=new TokenEntity();
        te.setToken(WebHelper.getGuid());
        te.setDuration(240);
        te.setExpire(WebHelper.getTimestamp(240));
        te.setType(0);
        te.setIp(WebHelper.getIpAddress(req));
        te.setCreateUser(userid);
        return te;
    }
}
src/main/java/com/lf/server/service/data/UsersService.java
@@ -1,10 +1,13 @@
package com.lf.server.service.data;
import com.lf.server.entity.data.LoginEntity;
import com.lf.server.entity.data.UsersEntity;
import com.lf.server.helper.WebHelper;
import com.lf.server.mapper.data.UsersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@@ -40,7 +43,7 @@
    @Override
    public List<UsersEntity> selectByPage(String uname, Integer limit, Integer offset) {
        return usersMapper.selectByPage(uname,limit,offset);
        return usersMapper.selectByPage(uname, limit, offset);
    }
    @Override
src/main/resources/mapper/data/LoginMapper.xml
@@ -35,17 +35,17 @@
    <insert id="insertLogin"   parameterType="com.lf.server.entity.data.LoginEntity">
       insert into lf.sys_login
       (appid,ip,type,status,browser,userid,optime)
       (appid,ip,type,status,descr,userid,optime)
       values
       (#{appid},#{ip},#{type},#{status},#{browser},#{userid},now());
       (#{appid},#{ip},#{type},#{status},#{descr},#{userid},now());
    </insert>
    <insert id="insertLogins"   >
       insert into lf.sys_login
        (appid,ip,type,status,browser,userid,optime)
        (appid,ip,type,status,descr,userid,optime)
       values
        <foreach collection="list"   item="item" index="index" separator=","  >
            (#{item.appid},#{item.ip},#{item.type},#{item.status},#{item.browser},#{item.userid},now())
            (#{item.appid},#{item.ip},#{item.type},#{item.status},#{item.descr},#{item.userid},now())
        </foreach>
    </insert>
@@ -62,6 +62,6 @@
    </delete>
    <update id="updateLogin">
    update lf.sys_login set appid=#{appid},ip=#{ip},type=#{type},status=#{status},browser=#{browser},userid=#{userid},optime=now() where id=#{id}
    update lf.sys_login set appid=#{appid},ip=#{ip},type=#{type},status=#{status},descr=#{descr},userid=#{userid},optime=now() where id=#{id}
    </update>
</mapper>
src/main/resources/mapper/data/TokenMapper.xml
@@ -51,7 +51,7 @@
        (token,duration,expire,type,ip,create_user,create_time)
       values
        <foreach collection="list"   item="item" index="index" separator=","  >
            (#{item.token},#{item.duration},#{item.expire},#{item.type},#{item.ip},#{item.createUser}, now())
            (#{item.token},#{item.duration},#{item.expire},#{item.type},#{item.ip},#{item.createUser},now())
        </foreach>
    </insert>
src/main/resources/static/css/reset.css
ÎļþÒÑɾ³ý
src/main/resources/static/css/style.css
ÎļþÃû´Ó src/main/resources/static/css/JCXM_style.css ÐÞ¸Ä
@@ -4,10 +4,10 @@
    background-color:#0eade0;
    }
#div_foot{
    width:100%;text-align:center;color:white;font-size:18px;position:fixed;bottom:10px;/*top:897px;position:absolute;background-color:#0eade0;*/
    width:100%;text-align:center;color:white;font-size:18px;position:fixed;bottom:10px;
}
/*===========================登录界面=========================*/
/* ç™»å½•界面 */
.loginheader,.loginmain,.regisheadermain{width:774px;margin-left:auto;margin-right:auto;}
.loginheader,.regisheadermain{height:50px;background:url(../images/login/loginuser.png) no-repeat;background-position:left; text-indent:50px;line-height:55px;}
.loginmain{height:1080px;background-repeat:no-repeat;background-position:center bottom;}
@@ -40,7 +40,7 @@
.code{width:65px !important;height:30px !important;font-size:22px !important;border-radius:0px !important;line-height: 29px !important;}
input::-webkit-input-placeholder {color: white;}
/*==========================注册==========================*/
/* æ³¨å†Œ */
.regisheader{width:100%;height:63px;border-bottom:3px solid #9BD4BC;margin-top:23px;}
.regisheadermain{margin-top:0px;}
.welregis{font-size:14px;}
@@ -61,7 +61,7 @@
.departsel{width:255px;*width:205px;}
/*=================个人中心===================*/
/* ä¸ªäººä¸­å¿ƒ */
.grzxtab{width:767px;height:30px;margin-top:20px;margin-left:auto;margin-right:auto;border-bottom:1px solid #9DD5BD;}
.grzxtab ul li{list-style-type:none;font-family:微软雅黑;font-size:14px;color:#4f4e4e;min-width:105px;width:auto;height:30px; text-align:center;line-height:33px;padding:0px 10px 0px 10px;cursor:pointer;margin-left:12px;display:inline-block;*display:inline;zoom:1;}
.tabNormal{border-top:1px solid #CCCCCC;border-left:1px solid #CCCCCC;border-right:1px solid #CCCCCC;}
@@ -78,8 +78,7 @@
.qrxgbtn{background:url(../images/login/qrxg.png) no-repeat;margin-top:35px;margin-left:320px;}
.qrxgbtn:hover{background:url(../images/login/qrxg_hover.png) no-repeat}
/*====================登录成功================*/
/* ç™»å½•成功 */
.successmain{width:760px;min-height:200px;height:auto;padding-bottom:30px;background:#ffffff;border:1px solid #9DD5BD;margin-top:30px;margin-left:auto;margin-right:auto;font-family:微软雅黑;color:#ffffff;}
.imfordiv{width:730px;height:100px;background:#9DD5BD;position:relative;margin-top:15px;margin-left:auto;margin-right:auto;}
.imfordiv img{position:absolute;top:20px;left:50px}
@@ -90,11 +89,24 @@
.sysname:hover{background:#EBFAF4;border:1px solid #9DD5BD}
.sysname img{margin-left:10px;margin-right:10px;vertical-align:middle;}
/* reset.css */
 a, abbr, acronym, address, applet, article, aside, audio, b, big, blockquote, body, canvas, caption, center, cite, code, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, font, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu, meter, nav, object, ol, output, p, pre, progress, q, rp, rt, ruby, s, samp, section, small, span, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr, tt, u, ul, var, video, xmp {border: 0;margin: 0;padding: 0;font-size: 100%;}
body {height: 100%;}
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {display: block;}
b, strong {font-weight: bold;}
img {color: transparent;font-size: 0;vertical-align: middle;-ms-interpolation-mode: bicubic;}
li {display: list-item;}
table {border-collapse: collapse;border-spacing: 0;}
th, td, caption {font-weight: normal;}
q {quotes: none;}
q:before, q:after {content: '';content: none;}
sub, sup, small {font-size: 75%;}
sub, sup {line-height: 0;position: relative;vertical-align: baseline;}
sub {bottom: -0.25em;}
sup {top: -0.5em;}
svg {overflow: hidden;}
/* login.css */
.code {font-family: Arial;font-style: italic;color: blue;font-size: 30px;border: 0;padding: 2px 3px;letter-spacing: 3px;font-weight: bolder;float: left;cursor: pointer;width: 88px;height: 35px;line-height: 34px;text-align: center;vertical-align: middle;border-top-right-radius: 5px;border-bottom-right-radius: 5px;background-color: white;}
a {text-decoration: underline;}                                                                                                                                       a:hover {text-decoration: underline;}
    
src/main/resources/templates/login.html
@@ -9,25 +9,11 @@
  <link href="../favicon.ico" rel="icon" type="image/x-icon" />
  <link href="../css/reset.css" rel="stylesheet" />
  <link href="../css/JCXM_style.css" rel="stylesheet" />
  <link href="../js/font-awesome.min.css" rel="stylesheet" />
  <link href="../css/cas.css" rel="stylesheet" />
  <script src="../js/jquery.min.js"></script>
  <script src="../js/zxcvbn.js"></script>
  <script src="../js/jquery.cookie.min.js"></script>
  <script src="../js/jquery-ui.min.js"></script>
  <script src="../js/bootstrap.min.js"></script>
  <script src="../js/rsa.min.js"></script>
  <style>
    .errorMessage_show {
      width: 200px;
      text-align: left;
      line-height: 6px;
      height: 6px;
      clear: both;
      color: #d56969;
      font-size: 12px;
    }
    .code {
      font-family: Arial;
      font-style: italic;
@@ -57,26 +43,6 @@
      text-decoration: underline;
    }
  </style>
  <script>
    var code;
    function createCode() {
      code = "";
      var codeLength = 4; //验证码的长度
      var checkCode = document.getElementById("checkCode");
      /* var codeChars = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
      'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
      'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); */
      var codeChars = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
      for (var i = 0; i < codeLength; i++) {
        var charNum = Math.floor(Math.random() * 10);
        code += codeChars[charNum];
      }
      if (checkCode) {
        checkCode.className = "code";
        checkCode.innerHTML = code;
      }
    }
  </script>
</head>
<body style="background-color: #0059cf; overflow-y: hidden !important;">
<form method="post" id="fm1" class="fm-v clearfix" action="/sign/login">
@@ -104,8 +70,8 @@
          <label for="password"></label>
          <input class="required" placeholder="请输入密码" type="password" id="password" size="25" tabindex="2"
                 accesskey="p" autocomplete="off" name="password" value="" /><span id="capslock-on" style="display: none;">
                  <i class="fa fa-exclamation-circle"></i>
                  <span>CAPSLOCK key is turned on!</span>
                <i class="fa fa-exclamation-circle"></i>
                <span>CAPSLOCK key is turned on!</span>
              </span>
        </div>
      </section>
@@ -126,7 +92,7 @@
      </section>
      <!-- ç™»å½•按钮 -->
      <section>
        <input class="loginbtn" style="margin-top: 25px;" name="submit" accesskey="l" value="" tabindex="5" type="submit">
        <input class="loginbtn" style="margin-top: 25px;" name="submit" accesskey="l" value="" tabindex="5" type="button" onclick="sysLogin();">
      </section>
    </div>
  </div>
@@ -135,48 +101,32 @@
  </div>
</form>
<script>
  var code;
  function createCode() {
    code = "";
    var codeLength = 4; //验证码的长度
    var checkCode = document.getElementById("checkCode");
    /* var codeChars = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); */
    var codeChars = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
    for (var i = 0; i < codeLength; i++) {
      var charNum = Math.floor(Math.random() * 10);
      code += codeChars[charNum];
    }
    if (checkCode) {
      checkCode.className = "code";
      checkCode.innerHTML = code;
    }
  }
  var leftoffset = 474;
  // ç¦æ­¢åœ¨iframe打开
  function noIframe() {
    if (top.location != self.location) {
      window.top.location = self.location.href.split("?")[0];
    }
  }
  function myfocus() {
    document.getElementById('username').focus();
  }
  window.onload = function () {
    noIframe();
    createCode();
    //winResize();
    autoResize();
    $(window).on("resize", autoResize);
    myfocus();
  }
  function winResize() {
    $(window).on("resize", function () {
      var div_obj = document.getElementById("div_middle");
      //宽度自适应
      //loginbox
      var fullWidth = document.body.offsetWidth;
      var div_loginBox = document.getElementById("div_loginBox");
      var boxWidth = div_loginBox.offsetWidth;
      var myWidth = div_obj.offsetWidth;
      //if (fullWidth > 1920) {
      //    fullWidth = 1920;
      //}
      div_obj.style.width = fullWidth + "px";
      div_loginBox.style.left = ((fullWidth - boxWidth) / 2 + leftoffset) + "px";
      //logintitle
      var div_loginTitle = document.getElementById("div_loginTitle");
      var titleWidth = div_loginTitle.offsetWidth;
      div_loginTitle.style.left = (fullWidth - titleWidth) / 2 + "px";
    })
  }
  function autoResize() {
@@ -186,14 +136,11 @@
    var div_loginBox = document.getElementById("div_loginBox");
    var boxWidth = div_loginBox.offsetWidth;
    var myWidth = div_obj.offsetWidth;
    //if (fullWidth > 1920) {
    //    fullWidth = 1920;
    //}
    //if (fullWidth > 1920) { fullWidth = 1920; }
    var winWidht = window.innerWidth;
    var winHeight = window.innerHeight - 100;
    var winHeight = window.innerHeight + 50;
    var bgHeight = 1080;
    winWidht += 150;
    if (winWidht >= 1920) {
      $("#div_middle").css("background", "url(../images/NewGJXJlogin/1920/2bg.jpg) no-repeat").css("background-position", "center bottom").css("height", "800px");
      $("#div_middle").css("height", "980px");
@@ -212,12 +159,11 @@
      $(".loginvalifield").css("margin-top", "20px").css("width", "350px").css("height", "45px");
      $("#inputCode").css("margin-left", "46px");
      $(".logintable").css("margin-top", "113px").css("width", "350px").css("height", "470px");
      //$(".logintable").css("margin-top", "210px").css("width", "350px").css("height", "470px");
      $("#carLink div").css("background", "url(../images/NewGJXJlogin/1600/add.png) no-repeat").css("background-position", "3% 40%");
      $("#carLink a").css("margin-left", "50px").css("font-size", "16px");
      $(".loginbtn").css("margin-top", "25px");
      leftoffset = 404;
      bgHeight = 800; //900
      bgHeight = 800;
      div_loginBox.style.left = ((fullWidth - 360) / 2 + leftoffset) + "px";
    } else if (winWidht >= 1440) {
      $("#div_middle").css("background", "url(../images/NewGJXJlogin/1440/2bg.jpg) no-repeat").css("background-position", "center bottom").css("height", "810px");
@@ -249,15 +195,13 @@
      $(".loginvalicode input").css("width", "165px").css("margin-left", "46px").css("font-size", "14px");
      $(".loginvalifield").css("margin-top", "20px").css("width", "300px").css("height", "40px");
      $(".logintable").css("margin-top", "83px").css("width", "300px").css("height", "390px");
      //$(".logintable").css("margin-top", "135px").css("width", "300px").css("height", "390px");
      $("#carLink div").css("background", "url(../images/NewGJXJlogin/1366/add.png) no-repeat").css("background-position", "3.5% 50%").css("margin-top", "25px").css("height", "30px").css("line-height", "30px");
      $("#carLink a").css("margin-left", "50px").css("font-size", "14px");
      $(".loginbtn").css("margin-top", "10px").css("height", "56px");
      leftoffset = 338;
      bgHeight = 668; //731
      bgHeight = 668;
      div_loginBox.style.left = ((fullWidth - 300) / 2 + leftoffset) + "px";
    } else {
      //fullWidth = 1280;
      $("#div_middle").css("background", "url(../images/NewGJXJlogin/1280/2bg.jpg) no-repeat").css("background-position", "center bottom").css("height", "620px");
      $("#loginBox_Title").css("height", "50px").css("line-height", "50px");
      $("#loginBox_Title span").css("font-size", "32px");
@@ -283,7 +227,7 @@
      var marginTop = parseFloat($(".logintable").css("margin-top").replace("px")) + (winHeight - bgHeight);
      $(".logintable").css("margin-top", marginTop + "px");
    }
    //高度自适应
    // é«˜åº¦è‡ªé€‚应
    var fullHeight = document.body.offsetHeight;
    var myHeight = div_obj.offsetHeight;
    if (fullHeight > myHeight) {
@@ -292,69 +236,18 @@
    var div_loginTitle = document.getElementById("div_loginTitle");
    var titleWidth = div_loginTitle.offsetWidth;
    div_loginTitle.style.left = (fullWidth - titleWidth) / 2 + "px";
  }
    //根据参数自动替换标题、背景图片
    var search = window.location.search;
    if (search != "" && search.indexOf("=") > -1) {
      search = decodeURIComponent(search);
      var value = search.split('=')[1];
      if (value.length > 0) {
        var startNum = value.indexOf("//");
        value = value.substring(startNum + 2, value.length);
        var endNum = value.indexOf("/");
        if (endNum > -1) {
          value = value.substring(0, endNum);
        }
        var k = value.indexOf(":");
        if (k > -1) {
          value = value.substring(0, k);
        }
        var host = value;
        if (false) {//host == "10.3.1.37"
          $("body").css("overflow", "auto");
          leftoffset = 375;
          $("body").css("background-color", "#0eade0");
          $("#topBg").show();
          $("#div_loginTitle").show();
          $("#topBgColor").show();
          $("#loginBox_Title").hide();
          $("#carLink").hide();
          $("#otherCarLink").show();
          $(".loginid").css("margin-top", "20px").css("height", "40px").css("width", "279px").css("border-radius", "6px").css("background", "url(../images/GJXJlogin/icon_01.png) no-repeat").css("background-color", "#4987F4").css("background-position", "3% 50%").css("border-bottom", "none");
          $(".loginid input").css("width", "245px").css("margin-left", "33px").css("background-color", "#4987F4").css("color", "#c1d7fd").css("font-size", "14px");
          $(".loginpwd").css("margin-top", "20px").css("height", "40px").css("width", "279px").css("border-radius", "6px").css("background", "url(../images/GJXJlogin/icon_02.png) no-repeat").css("background-color", "#4987F4").css("background-position", "3% 50%").css("border-bottom", "none");
          $(".loginpwd input").css("width", "245px").css("margin-left", "33px").css("background-color", "#4987F4").css("color", "#c1d7fd").css("font-size", "14px");
          $(".loginvalicode").css("height", "40px").css("width", "210px").css("border-radius", "6px").css("background", "url(../images/GJXJlogin/icon_03.png) no-repeat").css("background-color", "#4987F4").css("background-position", "6% 50%");
          $(".loginvalicode input").css("width", "142px").css("margin-left", "37px").css("background-color", "#4987F4").css("color", "#c1d7fd").css("font-size", "14px");
          $(".loginvalifield").css("margin-top", "20px").css("width", "280px").css("border-bottom", "none");
          $("#checkCode").css("height", "40px").css("line-height", "40px");
          $(".loginbtn").css("background", "url(../images/GJXJlogin/login_btn.png) no-repeat").css("margin-top", "15px").css("height", "50px");
          titleWidth = div_loginTitle.offsetWidth;
          $(".logintable").css("margin-top", "170px").css("width", "280px").css("height", "426px");
          div_loginTitle.style.left = (fullWidth - titleWidth) / 2 + "px";
          div_loginBox.style.left = ((fullWidth - 280) / 2 + leftoffset) + "px";
          $("#div_loginTitle").css("background", "url(../images/GJXJlogin/" + host + "_tit.png) no-repeat");
          $("#div_middle").css("background", "url(../images/GJXJlogin/" + host + "_bg.jpg) no-repeat");
          $("#div_middle").css("background-repeat", "no-repeat");
          $("#div_middle").css("background-position", "50% 110%");
          $("#div_middle").css("height", "863px");
          $("#checkCode").css("width", "94px");
          $("#checkCode").css("height", "40px");
          $("#topBgColor").css("background-color", "#3FD0FD");
          $("body").css("background-color", "#31b4ff");
          $("#div_foot").show();
          $("#div_foot").css("background-color", "#31b4ff");
        }
      }
    }
  window.onload = function () {
    noIframe();
    createCode();
    autoResize();
    $(window).on("resize", autoResize);
    document.getElementById('username').focus();
  }
</script>
<script>
  var i = "登录中..."
  //表单提交
  $("#fm1").submit(function () {
    $("#eMsg").html("");
  function sysValidate() {
    // éªŒè¯ç”¨æˆ·åä¸Žå¯†ç 
    var theUsername = document.getElementById("username").value;
    if (theUsername.length <= 0) {
@@ -375,32 +268,75 @@
      $("#inputCode").focus();
      return false;
    }
    else if (inputCode.toUpperCase() != code.toUpperCase()) {
    if (inputCode.toUpperCase() != code.toUpperCase()) {
      $("#eMsg").html("提示:验证码输入有误!");
      $("#inputCode").val("").focus();
      createCode();
      return false;
    }
    //$("#uName").val(encrypt.encrypt(theUsername));
    //$("#uPwd").val(encrypt.encrypt(thePassword));
    //$("#uName").val(Base64.encode(theUsername));
    $("#uName").val(theUsername);
    $("#uPwd").val(Base64.encode(thePassword));
    $(":submit").attr("disabled", true);
    setTimeout(function () {
      $(":submit").attr("disabled", false);
    }, 5000);
    //$(":submit").attr("value", i);
    return true;
  });
  }
  function myLoginSubmit() {
    var theSubmit = document.getElementById("misagh");
    theSubmit.submit();
  var isBusy = fase;
  function sysLogin() {
    if (isBusy || !sysValidate()) {
      return;
    }
    var username = $.trim($("#username").val());
    var password = $("#password").val();
    var service = getQueryStr("service");
    debugger
    var data = {
      "uid": username,
      "pwd": password,
      "bak": service
    };
    $.ajax({
      url: "sign/login",
      type: "POST",
      data: JSON.stringify(data),
      dataType: "json", // html、json、jsonp、script、text
      contentType: "json", // "application/json", "application/x-www-form-urlencoded",
      success: function (rs) {
        alert(rs);
      },
      error: function (e) {
        console.error(e);
        alert("登录出错,请联系管理员!");
      }
    });
  }
  function ajax(url, type, data, dataType, contentType, fn, efn) {
    $.ajax({
      url: url,
      type: type,
      data: data,
      dataType: dataType || "json", // html、json、jsonp、script、text
      contentType: contentType || "application/json", // "application/x-www-form-urlencoded"
      success: function (data) {
        fn(data);
      },
      error: function (e) {
        console.error(e);
        fn();
      }
    });
  }
  // èŽ·å–URL参数
  function getQueryStr(name) {
    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
      return decodeURI(r[2]);
    }
    return null;
  }
</script>
</body>