login_clgs.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  7. <title>登录</title>
  8. <link rel="icon" href="assets/images/favicon.ico" type="image/x-icon"/>
  9. <link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon"/>
  10. <link rel="stylesheet" href="assets/libs/layui/css/layui.css"/>
  11. </head>
  12. <style>
  13. * {
  14. margin: 0px;
  15. padding: 0px;
  16. }
  17. html, body {
  18. width: 100%;
  19. height: 100%;
  20. font-size: 10px;
  21. }
  22. img {
  23. display: block;
  24. }
  25. .index {
  26. width: 100%;
  27. height: 100%;
  28. }
  29. video {
  30. width: 100%;
  31. height: 100%;
  32. object-fit: fill;
  33. position: fixed;
  34. z-index: 10;
  35. }
  36. .index-box {
  37. width: 100%;
  38. height: 100%;
  39. position: fixed;
  40. z-index: 20;
  41. background: url("./login/img/bg_clgs.jpg");
  42. background-size: cover;
  43. }
  44. .logo {
  45. margin: 1rem 2rem;
  46. }
  47. .logo img {
  48. width: 26rem;
  49. }
  50. .logo-box {
  51. position: absolute;
  52. top: 50%;
  53. left: 50%;
  54. width: 70rem;
  55. height: 44rem;
  56. margin-top: -22rem;
  57. margin-left: -35rem;
  58. }
  59. .logo-box > img {
  60. width: 100%;
  61. position: absolute;
  62. }
  63. .main {
  64. width: 34.5rem;
  65. height: 41rem;
  66. position: absolute;
  67. z-index: 30;
  68. /*background: red;*/
  69. right: 2.4rem;
  70. bottom: 0px;
  71. }
  72. .title {
  73. font-size: 2rem;
  74. color: #222222;
  75. text-align: center;
  76. margin-top: 2rem;
  77. margin-bottom: 6rem;
  78. }
  79. .title span {
  80. color: #00A8FF;
  81. }
  82. .username {
  83. margin-left: 3.5rem;
  84. }
  85. .username .user-top {
  86. display: flex;
  87. font-size: 1.4rem;
  88. color: #555555;
  89. }
  90. .username .user-top img {
  91. width: 1.4rem;
  92. height: 1.6rem;
  93. margin-right: 1rem;
  94. }
  95. .username input {
  96. width: 25rem;
  97. height: 3.5rem;
  98. background: rgba(242, 242, 242, 1);
  99. border-radius: 0.4rem;
  100. border: none;
  101. font-size: 1.4rem;
  102. margin-top: 0.5rem;
  103. text-indent: 1rem;
  104. color: #555;
  105. }
  106. input::-webkit-input-placeholder {
  107. color: #999999;
  108. }
  109. .pwd {
  110. margin-top: 1.5rem;
  111. }
  112. .btn {
  113. margin-top: 4rem;
  114. margin-left: 3.5rem;
  115. overflow: hidden;
  116. }
  117. .btn-left {
  118. display: flex;
  119. align-items: center;
  120. float: left;
  121. margin-top: 1rem;
  122. }
  123. .btn-left input {
  124. width: 2rem;
  125. height: 2rem;
  126. }
  127. .btn-left span {
  128. margin-left: 0.5rem;
  129. font-size: 1.4rem;
  130. }
  131. .btn-right {
  132. float: right;
  133. margin-right: 5.8rem;
  134. }
  135. .btn-right p {
  136. width: 10rem;
  137. height: 3.5rem;
  138. background: linear-gradient(135deg, rgba(0, 168, 255, 1), rgba(26, 92, 225, 1));
  139. box-shadow: 0.1rem 0.1rem 1.6rem 0px rgba(34, 98, 225, 0.45);
  140. border-radius: 0.4rem;
  141. font-size: 1.4rem;
  142. color: #FFFFFF;
  143. text-align: center;
  144. line-height: 3.5rem;
  145. }
  146. .tip {
  147. margin-top: 4rem;
  148. text-align: center;
  149. font-size: 1.2rem;
  150. color: #999999;
  151. margin-right: 2.5rem;
  152. }
  153. .index-bottom {
  154. background-color: #dedede;
  155. position: fixed;
  156. bottom: 0;
  157. z-index: 999;
  158. width: 100%;
  159. text-align: center;
  160. }
  161. </style>
  162. <body>
  163. <div class="index">
  164. <!-- <img class="video_back" src="./login/img/bg_clgs.jpg" type="image" muted autoplay="autoplay" loop="loop">-->
  165. <div class="logo1" style="background-color: #FFF;">
  166. <img src="./login/img/logo_clgs.jpg" alt="" style="width: 50rem;padding-left: 30px;">
  167. </div>
  168. <div class="index-box">
  169. <div style="text-align: center;color: #FFF;font-size: 30px; margin-top: 20px;">
  170. <h2>成乐高速公路(扩容建设项目)双重预防机制管理信息系统</h2>
  171. </div>
  172. <form class="layui-form" lay-filter="loginForm">
  173. <div class="logo-box">
  174. <img src="./login/img/login_bg.png" alt="">
  175. <div class="main">
  176. <p class="title">
  177. 账号
  178. <span>安全登录</span>
  179. </p>
  180. <div class="username">
  181. <div class="user-top">
  182. <img src="./login/img/icon_common_user.png" alt="">
  183. <span>用户名</span>
  184. </div>
  185. <div class="bottom">
  186. <input type="text" id="username" name="username" placeholder="请输入用户名" lay-verType="tips"
  187. lay-verify="required" required>
  188. </div>
  189. </div>
  190. <div class="username pwd">
  191. <div class="user-top">
  192. <img src="./login/img/icon_common_user.png" alt="">
  193. <span>密 &nbsp;&nbsp;&nbsp;码</span>
  194. </div>
  195. <div class="bottom">
  196. <input type="password" name="password" placeholder="请输入密码" lay-verType="tips"
  197. lay-verify="required" required>
  198. </div>
  199. </div>
  200. <div class="btn">
  201. <div class="btn-left">
  202. <input type="checkbox" name="checkbox" lay-skin="primary" title="记住密码" checked="">
  203. </div>
  204. <div class="btn-right">
  205. <p id="btn1" lay-filter="login" lay-submit>登录</p>
  206. <!-- <button lay-filter="login" id="btn1" class="layui-btn layui-btn-fluid" lay-submit>登 录</button>-->
  207. </div>
  208. </div>
  209. <!-- <div class="tip">-->
  210. <!-- <p style="-->
  211. <!-- font-size: 16px;-->
  212. <!-- color: #312929;-->
  213. <!-- margin-bottom: 7px;-->
  214. <!--">-->
  215. <!-- 四川成乐高速公路有限责任公司-->
  216. <!-- </p>-->
  217. <!-- <p>-->
  218. <!-- @2020四川蜀兴优创安全科技有限公司提供技术支持-->
  219. <!-- </p>-->
  220. <!-- </div>-->
  221. </div>
  222. </div>
  223. </form>
  224. </div>
  225. <div class="index-bottom" style="text-align: center; font-size: 14px;line-height: 56px; letter-spacing: .5px;">
  226. <p>版权所有:成乐高速公路有限公司&nbsp;蜀ICP备18038273号-3 &nbsp;地址:四川省成都市高新区高彭大道17号&nbsp;技术支持:四川蜀兴优创安全科技有限公司 &nbsp;地址:成都市天府新区顺圣路172号&nbsp;
  227. 网址:<a href="http://www.scsxyc.com" target="_blank">www.scsxyc.com</a></p>
  228. </div>
  229. </div>
  230. </body>
  231. <script type="text/javascript" src="assets/libs/layui/layui.js"></script>
  232. <script type="text/javascript" src="./assets/js/common.js?v=312"></script>
  233. <script>
  234. layui.use(['layer', 'form', 'uParas', 'admin'], function () {
  235. var $ = layui.jquery;
  236. var layer = layui.layer;
  237. var form = layui.form;
  238. var uParas = layui.uParas;
  239. var admin = layui.admin;
  240. /**
  241. * @Author: NanKeYang
  242. * @Description: 本地账号信息
  243. * @Data: 2020/1/3 10:39
  244. */
  245. const LocalInfo = {
  246. localInfoKey: 'user_account',
  247. accountList: [],
  248. init: function () {
  249. this.getLocalInfo();
  250. let accountInfo = this.getDefaultAccount();
  251. if (accountInfo) {
  252. form.val('loginForm', {
  253. username: accountInfo.username,
  254. password: accountInfo.password
  255. });
  256. }
  257. },
  258. /**
  259. * @Author: NanKeYang
  260. * @Description: 获取本地账号信息
  261. * @Data: 2019/12/30 16:55
  262. */
  263. getLocalInfo() {
  264. let localInfo = localStorage.getItem(this.localInfoKey);
  265. if (localInfo) {
  266. this.accountList = JSON.parse(localInfo);
  267. }
  268. },
  269. /**
  270. * @Author: NanKeYang
  271. * @Description: 更新本地存储数据
  272. * @Data: 2019/12/30 17:09
  273. */
  274. updateLocalInfo() {
  275. if (this.accountList.length > 0) {
  276. localStorage.setItem(this.localInfoKey, JSON.stringify(this.accountList));
  277. } else {
  278. localStorage.removeItem(this.localInfoKey);
  279. }
  280. },
  281. /**
  282. * @Author: NanKeYang
  283. * @Description: 记住账号
  284. * @Data: 2019/12/30 16:44
  285. */
  286. rememberAccount(username, password) {
  287. this.removeAccount(username);
  288. let appendData = [{
  289. username: username,
  290. password: password
  291. }]
  292. this.accountList = appendData.concat(this.accountList);
  293. },
  294. /**
  295. * @Author: NanKeYang
  296. * @Description: 删除账号
  297. * @Data: 2019/12/30 17:07
  298. */
  299. removeAccount(username) {
  300. let removeIndex = null;
  301. for (let i = 0; i < this.accountList.length; i++) {
  302. if (username === this.accountList[i].username) {
  303. removeIndex = i;
  304. break;
  305. }
  306. }
  307. if (removeIndex !== null) {
  308. this.accountList.splice(removeIndex, 1);
  309. }
  310. },
  311. /**
  312. * @Author: NanKeYang
  313. * @Description: 获取账号密码
  314. * @Data: 2019/12/30 17:13
  315. */
  316. getAccountPassword(username) {
  317. for (let i = 0; i < this.accountList.length; i++) {
  318. if (username === this.accountList[i].username) {
  319. return this.accountList[i].password;
  320. }
  321. }
  322. },
  323. /**
  324. * @Author: NanKeYang
  325. * @Description: 获取默认账号
  326. * @Data: 2019/12/30 17:41
  327. */
  328. getDefaultAccount() {
  329. return this.accountList.length > 0 ? this.accountList[0] : null;
  330. }
  331. }
  332. LocalInfo.init()
  333. /**
  334. * @Author: NanKeYang
  335. * @Description: 处理回车登录
  336. * @Data: 2020/1/3 10:39
  337. */
  338. document.onkeydown = (e) => {
  339. const key = window.event.keyCode
  340. if (key == 13) {
  341. $('#btn1').click();
  342. }
  343. }
  344. $('#username').blur(function () {
  345. let password = LocalInfo.getAccountPassword('system');
  346. if (password) {
  347. form.val('loginForm', {
  348. password: password
  349. });
  350. }
  351. })
  352. // 表单提交
  353. uParas.clearCache();
  354. form.on('submit(login)', function (obj) {
  355. admin.btnLoading('#btn1', '登录中。。。。');
  356. admin.req(uParas.baseUrl + '/login', obj.field, function (resp) {
  357. //debugger
  358. if (resp.code == 1) {
  359. if (obj.field.checkbox) {
  360. LocalInfo.rememberAccount(obj.field.username, obj.field.password)
  361. } else {
  362. LocalInfo.removeAccount(obj.field.username)
  363. }
  364. LocalInfo.updateLocalInfo();
  365. uParas.loginCache(resp);
  366. location.href = "./index.html"
  367. } else {
  368. layer.msg(resp.msg)
  369. admin.btnLoading('#btn1', '登录', false);
  370. }
  371. }, 'POST');
  372. return false;
  373. });
  374. // 图形验证码
  375. $('.login-captcha').click(function () {
  376. this.src = this.src + '?t=' + (new Date).getTime();
  377. });
  378. });
  379. </script>
  380. </html>