login.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <!DOCTYPE html>
  2. <html lang="en"
  3. xmlns:th="http://www.thymeleaf.org"
  4. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  5. layout:decorate="~{home/common/common}">
  6. <head>
  7. <meta charset="UTF-8">
  8. <title>登录页</title>
  9. <style>
  10. html, body {
  11. height: 100%;
  12. }
  13. .icon-tips {
  14. display: inline-block;
  15. position: absolute;
  16. top: 5px;
  17. right: -26px;
  18. border: solid 1px #dadada;
  19. width: 20px;
  20. height: 20px;
  21. line-height: 20px;
  22. border-radius: 50%;
  23. color: #666;
  24. padding-left: 5px;
  25. }
  26. </style>
  27. </head>
  28. <body layout:fragment="content">
  29. <link rel="stylesheet" th:href="@{/home/css/login.css}">
  30. <link rel="stylesheet" th:href="@{/home/plugin/bootstrap/css/bootstrap.css}">
  31. <script type="text/javascript" th:src="@{/h-ui/lib/jquery.validation/1.14.0/jquery.validate.min.js}"></script>
  32. <script type="text/javascript" th:src="@{/h-ui/lib/jquery.validation/1.14.0/validate-methods.js}"></script>
  33. <script type="text/javascript" th:src="@{/h-ui/lib/jquery.validation/1.14.0/messages_zh.js}"></script>
  34. <script type="text/javascript" th:src="@{/h-ui/static/h-ui/js/H-ui.min.js}"></script>
  35. <script type="text/javascript" th:src="@{/h-ui/static/h-ui.admin/js/H-ui.admin.js}"></script>
  36. <script type="text/javascript" th:src="@{/js/common/base.js}"></script>
  37. <!-- 头部导航 -->
  38. <div style="border-bottom: solid 2px #2976CE">
  39. <div th:replace="~{home/common/headerLogin :: headerLogin}"></div>
  40. </div>
  41. <!-- 主体内容 -->
  42. <!-- 主体内容 -->
  43. <div class="main" style="padding-bottom: 0;">
  44. <div class="container content projects" style="margin-top: 60px;">
  45. <div class="row">
  46. <div class="col-sm-6 col-md-6 col-lg-6 col-sm-offset-3 col-md-offset-3 col-lg-offset-3">
  47. <div class="page-container">
  48. <form action="" method="post">
  49. <div style="padding: 10px 30px 0px 30px;">
  50. <div style="position: relative;">
  51. <div class="input-group">
  52. <span class="input-group-addon" id="basic-addon1">
  53. <i class=" iconfont icon-yonghuming1"></i>
  54. </span>
  55. <input type="text" class="form-control" name="username" id="name"
  56. aria-describedby="sizing-addon1" placeholder="用户名">
  57. </div>
  58. <!--<span class="icon-tips" title="批量导入的企业账号为组织机构代码">?</span>-->
  59. </div>
  60. <div style="position: relative;">
  61. <div class="input-group">
  62. <span class="input-group-addon"><i class=" iconfont icon-mima"></i></span>
  63. <input type="password" name="password" class="form-control" placeholder="密码">
  64. </div>
  65. <!--<span class="icon-tips" title="批量导入的企业账号密码为组织机构代码后6位">?</span>-->
  66. </div>
  67. <button type="button" class="button login-btn"
  68. th:onclick="'javascript:onLine(\'/home/login\');'">登 录
  69. </button>
  70. <!--<button type="button" class="button"-->
  71. <!--th:onclick="'javascript:register(\'注册\',\'/home/toRegister\',\'800\',\'500\');'">注 册-->
  72. <!--</button>-->
  73. <!-- 20200703 注释老的注册功能-->
  74. <!-- <button type="button" class="button"
  75. th:onclick="'javascript:register(\'注册\',\'/home/chooseRegister\',\'800\',\'500\');'">注 册
  76. </button>-->
  77. <!-- 注释代码为注册功能维护中 -->
  78. <!--<button type="button" class="button"
  79. onclick="javascript:alert('注册功能维护中, 敬请谅解...');">注 册
  80. </button>-->
  81. <span style="color: #2976CE;text-decoration: underline;cursor: pointer;font-size: 15px; margin: 10px 0;"
  82. th:onclick="'javascript:reset(\'忘记密码\',\'/home/toReset\',\'800\',\'500\');'">忘记密码
  83. </span>
  84. </div>
  85. </form>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <!--页底-->
  92. <div class="w1300 copyright" style="position: absolute; bottom: 0; width: 100%;">
  93. <span>苏州高新区经济发展委员会&emsp;&emsp;保留版权所有</span>
  94. </div>
  95. <script th:inline="javascript">
  96. var base64 = new Base64();
  97. var pagePath = $("meta[name='_ctx']").attr("content");
  98. pagePath = pagePath.substring(0, pagePath.length - 1);
  99. var c_name = "DoNotAskAgain";
  100. function onLine(url) {
  101. var usernameObj = $("input[name = 'username']");
  102. var passwordObj = $("input[name = 'password']");
  103. var username = base64.encode($.trim(usernameObj.val()));
  104. var password = base64.encode($.trim(passwordObj.val()));
  105. var maskValue = "xxxxxxxxxxxxxxxxxxxxx".substring(0, password.length);
  106. $("input[name = 'password']").value = maskValue;
  107. $.ajax({
  108. type: "POST",
  109. dataType: "json",
  110. url: pagePath + url,
  111. data: {
  112. "username": username,
  113. "password": password,
  114. "timestamp": new Date().getTime()
  115. },
  116. beforeSend: function () {
  117. if (!username) {
  118. warningMessage("请输入用户名!");
  119. usernameObj.focus();
  120. return false;
  121. }
  122. if (!password) {
  123. warningMessage("请输入密码!");
  124. passwordObj.focus();
  125. return false;
  126. }
  127. }, success: function (result) {
  128. if (result.success) {
  129. // redirectToIndustrialCarrier();
  130. localStorage.setItem("user_name", result.obj.userName);
  131. localStorage.setItem("user_Type", result.obj.userType);
  132. localStorage.setItem("user_id", result.obj.userId);
  133. localStorage.setItem("INDUSTRIAL_CARRIER", result.obj.token);
  134. var safetySupervision = localStorage.getItem("safetySupervision");
  135. localStorage.removeItem("safetySupervision");
  136. var electricFurnaceMonitoring = localStorage.getItem("dljkxt");
  137. localStorage.removeItem("dljkxt");
  138. var lyjjjcpt = localStorage.getItem("lyjjjcpt");
  139. localStorage.removeItem("lyjjjcpt");
  140. var industrialCarrier = localStorage.getItem("industrialCarrier");
  141. localStorage.removeItem("industrialCarrier");
  142. var industrialLand = localStorage.getItem("industrialLand");
  143. localStorage.removeItem("industrialLand");
  144. var platformHome = localStorage.getItem("platformHome");
  145. localStorage.removeItem("platformHome");
  146. var requiredUserType = localStorage.getItem("requiredUserType");
  147. localStorage.removeItem("requiredUserType");
  148. var activityUrl = localStorage.getItem("activityUrl");
  149. localStorage.removeItem("activityUrl");
  150. var returnUrl = localStorage.getItem("returnUrl");
  151. localStorage.removeItem("returnUrl");
  152. var errorMsg = localStorage.getItem("errorMsg");
  153. localStorage.removeItem("errorMsg");
  154. //进入安监系统
  155. if (safetySupervision) {
  156. window.location.href = "http://202.102.20.60:8008/zf/#/login?username=" + result.obj.userName;
  157. return;
  158. }
  159. //进入电炉监控系统
  160. if (electricFurnaceMonitoring) {
  161. window.location.href = "http://202.102.20.60:8008/ly/#/login?username=" + result.obj.userName;
  162. return;
  163. }
  164. //进入楼宇经济监测平台首字母
  165. if (lyjjjcpt) {
  166. window.location.href = "http://112.4.85.47:8000/lyzf/#/login?username=" + result.obj.userName;
  167. return;
  168. }
  169. //进入工业厂房
  170. if (industrialCarrier) {
  171. window.location.href = pagePath.substring(0, pagePath.lastIndexOf("/")) + '/industry/home/#/home';
  172. // window.open(pagePath.substring(0,pagePath.lastIndexOf("/")) + '/industry/home/#/home');
  173. return;
  174. }
  175. //进入工业用地
  176. if (industrialLand) {
  177. window.open(pagePath.substring(0, pagePath.lastIndexOf("/")) + '/industry/home/#/industrialReserve');
  178. return;
  179. }
  180. //进入新门户首页
  181. if (platformHome) {
  182. window.location.href = pagePath + '/index';
  183. return;
  184. }
  185. //个人用户登录直接进入首页
  186. if (result.obj.userType === 5) {
  187. if (activityUrl) {
  188. window.location.href = activityUrl;
  189. return;
  190. }
  191. window.location.href = pagePath + '/index';
  192. return;
  193. }
  194. if (result.obj.firstLogin == null || result.obj.firstLogin == 0) {
  195. //第一次登录 取后台改密码
  196. window.location.href = pagePath + "/admin/home";
  197. //window.open(pagePath + "/admin/home");
  198. return;
  199. }
  200. smileMessage(result.message);
  201. if (activityUrl) {
  202. //只有某一类用户可以执行操作,比如门户项目申报只能企业用户申报
  203. if (requiredUserType) {
  204. if (requiredUserType == result.obj.userType) {
  205. window.location.href = activityUrl;
  206. return;
  207. } else {
  208. if (returnUrl) {
  209. sadMessage(errorMsg);
  210. window.location.href = returnUrl;
  211. return;
  212. } else {
  213. window.location.href = pagePath + "/home";
  214. return;
  215. }
  216. }
  217. } else {
  218. window.location.href = activityUrl;
  219. return;
  220. }
  221. }
  222. if (result.obj.firstLogin == 1 && result.obj.userType == 3) {
  223. localStorage.setItem("url", "/build/company/companyInfo")
  224. //window.location.href = pagePath + "/build/company/companyInfo";
  225. //return;
  226. }
  227. if (!result.obj.isComplete) {
  228. layer_show("完善信息", pagePath + "/home/toComplete", 800, 600);
  229. return;
  230. }
  231. window.location.href = pagePath + "/admin/home";
  232. //window.open(pagePath + "/admin/home");
  233. } else {
  234. sadMessage(result.message);
  235. }
  236. }
  237. });
  238. }
  239. function register(title, url, w, h) {
  240. var index = layer_show(title, pagePath + url, w, h);
  241. console.log("登录页:" + index);
  242. //默认全屏
  243. layer.full(index);
  244. }
  245. function reset(title, url, w, h) {
  246. layer_show(title, pagePath + url, w, h);
  247. }
  248. $("body").keydown(function () {
  249. if (event.keyCode == "13") {//keyCode=13是回车键
  250. $('.login-btn').trigger("click");
  251. }
  252. });
  253. function getCookie(c_name) {
  254. if (document.cookie.length > 0) {
  255. c_start = document.cookie.indexOf(c_name + "=")
  256. if (c_start != -1) {
  257. c_start = c_start + c_name.length + 1
  258. c_end = document.cookie.indexOf(";", c_start)
  259. if (c_end == -1) c_end = document.cookie.length
  260. return unescape(document.cookie.substring(c_start, c_end))
  261. }
  262. }
  263. return ""
  264. }
  265. if (!getCookie(c_name)) {
  266. layer.open({
  267. title: '提示!'
  268. , content: '建议使用chrome浏览器、ie8及以上浏览器访问'
  269. , btn: ['知道了', '不再提示']
  270. , yes: function (index, layero) {
  271. layer.close(index);
  272. }
  273. , btn2: function (index, layero) {
  274. document.cookie = c_name + "=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
  275. return true
  276. }
  277. });
  278. }
  279. function redirectToIndustrialCarrier() {
  280. $.ajax({
  281. url: pagePath + "/token/create",
  282. type: "get",
  283. dataType: "json",
  284. data: {
  285. timeStamp: new Date()
  286. },
  287. success: function (result) {
  288. console.log(result);
  289. if (result.success) {
  290. var token = result.obj;
  291. console.log(token);
  292. localStorage.setItem("INDUSTRIAL_CARRIER", token);
  293. }
  294. }
  295. });
  296. }
  297. </script>
  298. </body>
  299. </html>
  300. <style type="text/css">
  301. .red {
  302. color: #D0021B;
  303. padding: 0 5px;
  304. }
  305. .footer {
  306. position: fixed;
  307. bottom: 0;
  308. padding: 10px 0 0;
  309. }
  310. .form-group {
  311. padding-top: 30px;
  312. margin-bottom: 0;
  313. margin-left: 0;
  314. margin-right: 0;
  315. }
  316. .input-group {
  317. margin-top: 25px;
  318. }
  319. @media (min-width: 1200px) {
  320. .container {
  321. padding: 0 100px
  322. }
  323. }
  324. @media (min-width: 1600px) {
  325. .content {
  326. margin-top: 150px !important
  327. }
  328. }
  329. body {
  330. font-family: "华文细黑";
  331. /*width: 100%;*/
  332. /*height: 100%;*/
  333. /*background: url(".././home/image/background.png") no-repeat;*/
  334. /*background-size: 100%;*/
  335. /*background-position: bottom;*/
  336. }
  337. .layui-layer-padding {
  338. color: #333
  339. }
  340. /*.main{
  341. background: url(.././image/background.png) no-repeat 4px 5px;
  342. }*/
  343. </style>