login-3.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>后台管理-登陆</title>
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta http-equiv="Access-Control-Allow-Origin" content="*">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  10. <meta name="apple-mobile-web-app-capable" content="yes">
  11. <meta name="format-detection" content="telephone=no">
  12. <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <style>
  18. .main-body {top:50%;left:50%;position:absolute;-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);-o-transform:translate(-50%,-50%);transform:translate(-50%,-50%);overflow:hidden;}
  19. .login-main .login-bottom .center .item input {display:inline-block;width:227px;height:22px;padding:0;position:absolute;border:0;outline:0;font-size:14px;letter-spacing:0;}
  20. .login-main .login-bottom .center .item .icon-1 {background:url(../images/icon-login.png) no-repeat 1px 0;}
  21. .login-main .login-bottom .center .item .icon-2 {background:url(../images/icon-login.png) no-repeat -54px 0;}
  22. .login-main .login-bottom .center .item .icon-3 {background:url(../images/icon-login.png) no-repeat -106px 0;}
  23. .login-main .login-bottom .center .item .icon-4 {background:url(../images/icon-login.png) no-repeat 0 -43px;position:absolute;right:-10px;cursor:pointer;}
  24. .login-main .login-bottom .center .item .icon-5 {background:url(../images/icon-login.png) no-repeat -55px -43px;}
  25. .login-main .login-bottom .center .item .icon-6 {background:url(../images/icon-login.png) no-repeat 0 -93px;position:absolute;right:-10px;margin-top:8px;cursor:pointer;}
  26. .login-main .login-bottom .tip .icon-nocheck {display:inline-block;width:10px;height:10px;border-radius:2px;border:solid 1px #9abcda;position:relative;top:2px;margin:1px 8px 1px 1px;cursor:pointer;}
  27. .login-main .login-bottom .tip .icon-check {margin:0 7px 0 0;width:14px;height:14px;border:none;background:url(../images/icon-login.png) no-repeat -111px -48px;}
  28. .login-main .login-bottom .center .item .icon {display:inline-block;width:33px;height:22px;}
  29. .login-main .login-bottom .center .item {width:288px;height:35px;border-bottom:1px solid #dae1e6;margin-bottom:35px;}
  30. .login-main {width:428px;position:relative;float:left;}
  31. .login-main .login-top {height:117px;background-color:#148be4;border-radius:12px 12px 0 0;font-family:SourceHanSansCN-Regular;font-size:30px;font-weight:400;font-stretch:normal;letter-spacing:0;color:#fff;line-height:117px;text-align:center;overflow:hidden;-webkit-transform:rotate(0);-moz-transform:rotate(0);-ms-transform:rotate(0);-o-transform:rotate(0);transform:rotate(0);}
  32. .login-main .login-top .bg1 {display:inline-block;width:74px;height:74px;background:#fff;opacity:.1;border-radius:0 74px 0 0;position:absolute;left:0;top:43px;}
  33. .login-main .login-top .bg2 {display:inline-block;width:94px;height:94px;background:#fff;opacity:.1;border-radius:50%;position:absolute;right:-16px;top:-16px;}
  34. .login-main .login-bottom {width:428px;background:#fff;border-radius:0 0 12px 12px;padding-bottom:53px;}
  35. .login-main .login-bottom .center {width:288px;margin:0 auto;padding-top:40px;padding-bottom:15px;position:relative;}
  36. .login-main .login-bottom .tip {clear:both;height:16px;line-height:16px;width:288px;margin:0 auto;}
  37. body {background:url(../images/loginbg.png) 0% 0% / cover no-repeat;position:static;font-size:12px;}
  38. input::-webkit-input-placeholder {color:#a6aebf;}
  39. input::-moz-placeholder {/* Mozilla Firefox 19+ */ color:#a6aebf;}
  40. input:-moz-placeholder {/* Mozilla Firefox 4 to 18 */ color:#a6aebf;}
  41. input:-ms-input-placeholder {/* Internet Explorer 10-11 */ color:#a6aebf;}
  42. input:-webkit-autofill {/* 取消Chrome记住密码的背景颜色 */ box-shadow:0 0 0 1000px white inset !important;}
  43. html {height:100%;}
  44. .login-main .login-bottom .tip {clear:both;height:16px;line-height:16px;width:288px;margin:0 auto;}
  45. .login-main .login-bottom .tip .login-tip {font-family:MicrosoftYaHei;font-size:12px;font-weight:400;font-stretch:normal;letter-spacing:0;color:#9abcda;cursor:pointer;}
  46. .login-main .login-bottom .tip .forget-password {font-stretch:normal;letter-spacing:0;color:#1391ff;text-decoration:none;position:absolute;right:62px;}
  47. .login-main .login-bottom .login-btn {width:288px;height:40px;background-color:#1E9FFF;border-radius:16px;margin:24px auto 0;text-align:center;line-height:40px;color:#fff;font-size:14px;letter-spacing:0;cursor:pointer;border:none;}
  48. .login-main .login-bottom .center .item .validateImg {position:absolute;right:1px;cursor:pointer;height:36px;border:1px solid #e6e6e6;}
  49. .footer {left:0;bottom:0;color:#fff;width:100%;position:absolute;text-align:center;line-height:30px;padding-bottom:10px;text-shadow:#000 0.1em 0.1em 0.1em;font-size:14px;}
  50. .padding-5 {padding:5px !important;}
  51. .footer a,.footer span {color:#fff;}
  52. @media screen and (max-width:428px) {.login-main {width:360px !important;}
  53. .login-main .login-top {width:360px !important;}
  54. .login-main .login-bottom {width:360px !important;}
  55. }
  56. </style>
  57. </head>
  58. <body>
  59. <div class="main-body">
  60. <div class="login-main">
  61. <div class="login-top">
  62. <span>智能弓箭-后台登录</span>
  63. <span class="bg1"></span>
  64. <span class="bg2"></span>
  65. </div>
  66. <form class="layui-form login-bottom">
  67. <div class="center">
  68. <div class="item">
  69. <select name="serverIndex" lay-filter="serverIndex-selector">
  70. <option value="0">中国区</option>
  71. <option value="1">海外区</option>
  72. </select>
  73. </div>
  74. <div class="item">
  75. <span class="icon icon-2"></span>
  76. <input type="text" name="username" lay-verify="required" placeholder="请输入登录账号" maxlength="24"/>
  77. </div>
  78. <div class="item">
  79. <span class="icon icon-3"></span>
  80. <input type="password" name="password" lay-verify="required" placeholder="请输入密码" maxlength="20">
  81. <span class="bind-password icon icon-4"></span>
  82. </div>
  83. <div id="validatePanel" class="item" style="width: 137px;">
  84. <input type="text" name="captcha" placeholder="请输入验证码" maxlength="4">
  85. <img id="refreshCaptcha" class="validateImg">
  86. </div>
  87. </div>
  88. <div class="tip">
  89. <span class="icon-nocheck icon-check" id="icon-ccc"></span>
  90. <span class="login-tip">保持登录</span>
  91. <!-- <a href="javascript:" class="forget-password">忘记密码?</a> -->
  92. </div>
  93. <div class="layui-form-item" style="text-align:center; width:100%;height:100%;margin:0px;">
  94. <button type="button" class="login-btn" lay-submit="" lay-filter="login">立即登录</button>
  95. </div>
  96. </form>
  97. </div>
  98. </div>
  99. <!-- <div class="footer">
  100. ©版权所有 2014-2018 叁贰柒工作室<span class="padding-5">|</span><a target="_blank" href="http://www.miitbeian.gov.cn">粤ICP备16006642号-2</a>
  101. </div> -->
  102. <script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
  103. <script src="../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
  104. <script src="../src/js/myConfig.js"></script>
  105. <script>
  106. // 获取浏览器类型
  107. function getBrowserType() {
  108. // 获取浏览器 userAgent
  109. let ua = navigator.userAgent
  110. // 是否为 Opera
  111. let isOpera = ua.indexOf('Opera') > -1
  112. // 返回结果
  113. if (isOpera) { return 'Opera' }
  114. // 是否为 IE
  115. let isIE = (ua.indexOf('compatible') > -1) && (ua.indexOf('MSIE') > -1) && !isOpera
  116. let isIE11 = (ua.indexOf('Trident') > -1) && (ua.indexOf("rv:11.0") > -1)
  117. // 返回结果
  118. if (isIE11) { return 'IE11'
  119. } else if (isIE) {
  120. // 检测是否匹配
  121. let re = new RegExp('MSIE (\\d+\\.\\d+);')
  122. re.test(ua)
  123. // 获取版本
  124. let ver = parseFloat(RegExp["$1"])
  125. // 返回结果
  126. if (ver == 7) { return 'IE7'
  127. } else if (ver == 8) { return 'IE8'
  128. } else if (ver == 9) { return 'IE9'
  129. } else if (ver == 10) { return 'IE10'
  130. } else { return "IE" }
  131. }
  132. // 是否为 Edge
  133. let isEdge = ua.indexOf("Edge") > -1
  134. // 返回结果
  135. if (isEdge) { return 'Edge' }
  136. // 是否为 Firefox
  137. let isFirefox = ua.indexOf("Firefox") > -1
  138. // 返回结果
  139. if (isFirefox) { return 'Firefox' }
  140. let isWX = navigator.userAgent.toLowerCase().includes("wechat")
  141. if (isWX) { return 'WeChat' }
  142. // 是否为 UC
  143. let isUC= ua.indexOf("UCBrowser") > -1
  144. // 返回结果
  145. if (isUC) { return 'UC' }
  146. // 是否为 QQ
  147. let isQQ= ua.indexOf("QQBrowser") > -1
  148. // 返回结果
  149. if (isUC) { return 'QQ' }
  150. // 是否为 Safari
  151. let isSafari = (ua.indexOf("Safari") > -1) && (ua.indexOf("Chrome") == -1)
  152. // 返回结果
  153. if (isSafari) { return "Safari" }
  154. // 是否为 Chrome
  155. let isChrome = (ua.indexOf("Chrome") > -1) && (ua.indexOf("Safari") > -1) && (ua.indexOf("Edge") == -1)
  156. // 返回结果
  157. if (isChrome) { return 'Chrome' }
  158. // 都不是
  159. return 'Unknown'
  160. }
  161. </script>
  162. <script src="https://pv.sohu.com/cityjson?ie=utf-8"></script><!-- 搜狐api-获取ip和地区 -->
  163. <script>
  164. //获取user用户信息(浏览器类型、IP地址、地区)
  165. function getUserMsg() {
  166. let userMsgList = [];
  167. userMsgList.push(getBrowserType());
  168. if (window["returnCitySN"]) {
  169. userMsgList.push(returnCitySN["cip"] ?? "IP未知");
  170. userMsgList.push(returnCitySN["cname"] ?? "地区未知");
  171. }
  172. return userMsgList.join(" ");
  173. }
  174. </script>
  175. <script>
  176. layui.use(['form','jquery'], function () {
  177. var $ = layui.jquery,
  178. form = layui.form,
  179. layer = layui.layer;
  180. // 登录过期的时候,跳出ifram框架
  181. if (top.location != self.location) top.location = self.location;
  182. $('.bind-password').on('click', function () {
  183. if ($(this).hasClass('icon-5')) {
  184. $(this).removeClass('icon-5');
  185. $("input[name='password']").attr('type', 'password');
  186. } else {
  187. $(this).addClass('icon-5');
  188. $("input[name='password']").attr('type', 'text');
  189. }
  190. });
  191. $('.icon-nocheck').on('click', function () {
  192. if ($(this).hasClass('icon-check')) {
  193. $(this).removeClass('icon-check');
  194. } else {
  195. $(this).addClass('icon-check');
  196. }
  197. });
  198. // 进行登录操作
  199. form.on('submit(login)', function (data) {
  200. data = data.field;
  201. if (data.username == '') {
  202. layer.msg('用户名不能为空');
  203. return false;
  204. }
  205. if (data.password == '') {
  206. layer.msg('密码不能为空');
  207. return false;
  208. }
  209. if (data.captcha == '') {
  210. layer.msg('验证码不能为空');
  211. return false;
  212. }
  213. if (data.captcha != captchaCode) {
  214. layer.msg('验证码不正确')
  215. return false;
  216. }
  217. window.setServerIndex(data.serverIndex);
  218. requestAPI({
  219. url: "/admin/admin/login",
  220. type: "POST",
  221. data: {
  222. username: data.username,
  223. password: data.password,
  224. userMsg: getUserMsg()
  225. },
  226. success: (data) => {
  227. if (data.code == 0) {
  228. let token = data.data;
  229. let tokenKeep = $("#icon-ccc").hasClass('icon-check');
  230. window.saveLoginAuth(token, tokenKeep);
  231. layer.msg("登录成功", {time: 600},function () {
  232. window.location = '../index.html?v=' + Date.now();
  233. });
  234. } else {
  235. layer.msg(data.msg);
  236. }
  237. }
  238. });
  239. return false;
  240. });
  241. });
  242. //验证码
  243. var captchaCode = 2222222222222222;
  244. function refreshCaptcha() {
  245. captchaCode = 1000 + Math.floor(Math.random() * 9000);
  246. getBinary(window.getNewServerURL() + "/api/createCaptcha", {code: captchaCode}, (res) => {
  247. $("#refreshCaptcha").attr("src", URL.createObjectURL(res));
  248. });
  249. }
  250. $("#refreshCaptcha").on("click", refreshCaptcha);
  251. refreshCaptcha();
  252. </script>
  253. </body>
  254. </html>