login.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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. <button type="button" class="button"
  74. th:onclick="'javascript:register(\'注册\',\'/home/chooseRegister\',\'800\',\'500\');'">注 册
  75. <!-- 注释代码为注册功能维护中 -->
  76. <!-- <button type="button" class="button"-->
  77. <!-- onclick="javascript:alert('注册功能维护中, 敬请谅解...');">注 册-->
  78. </button>
  79. <span style="color: #2976CE;text-decoration: underline;cursor: pointer;font-size: 15px; margin: 10px 0;"
  80. th:onclick="'javascript:reset(\'忘记密码\',\'/home/toReset\',\'800\',\'500\');'">忘记密码
  81. </span>
  82. </div>
  83. </form>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <!--页底-->
  90. <div class="w1300 copyright" style="position: absolute; bottom: 0; width: 100%;">
  91. <span>苏州高新区经济发展委员会&emsp;&emsp;保留版权所有</span>
  92. </div>
  93. <script th:inline="javascript">
  94. var base64 = new Base64();
  95. var pagePath = $("meta[name='_ctx']").attr("content");
  96. pagePath = pagePath.substring(0, pagePath.length - 1);
  97. var c_name = "DoNotAskAgain";
  98. function onLine(url) {
  99. var usernameObj = $("input[name = 'username']");
  100. var passwordObj = $("input[name = 'password']");
  101. var username = base64.encode($.trim(usernameObj.val()));
  102. var password = base64.encode($.trim(passwordObj.val()));
  103. var maskValue = "xxxxxxxxxxxxxxxxxxxxx".substring(0, password.length);
  104. $("input[name = 'password']").value = maskValue;
  105. $.ajax({
  106. type: "POST",
  107. dataType: "json",
  108. url: pagePath + url,
  109. data: {
  110. "username": username,
  111. "password": password,
  112. "timestamp": new Date().getTime()
  113. },
  114. beforeSend: function () {
  115. if (!username) {
  116. warningMessage("请输入用户名!");
  117. usernameObj.focus();
  118. return false;
  119. }
  120. if (!password) {
  121. warningMessage("请输入密码!");
  122. passwordObj.focus();
  123. return false;
  124. }
  125. }, success: function (result) {
  126. if (result.success) {
  127. // redirectToIndustrialCarrier();
  128. localStorage.setItem("user_name", result.obj.userName);
  129. localStorage.setItem("user_Type", result.obj.userType);
  130. localStorage.setItem("user_id", result.obj.userId);
  131. localStorage.setItem("INDUSTRIAL_CARRIER", result.obj.token);
  132. var safetySupervision = localStorage.getItem("safetySupervision");
  133. localStorage.removeItem("safetySupervision");
  134. var electricFurnaceMonitoring = localStorage.getItem("dljkxt");
  135. localStorage.removeItem("dljkxt");
  136. var lyjjjcpt = localStorage.getItem("lyjjjcpt");
  137. localStorage.removeItem("lyjjjcpt");
  138. var industrialCarrier = localStorage.getItem("industrialCarrier");
  139. localStorage.removeItem("industrialCarrier");
  140. var industrialLand = localStorage.getItem("industrialLand");
  141. localStorage.removeItem("industrialLand");
  142. var platformHome = localStorage.getItem("platformHome");
  143. localStorage.removeItem("platformHome");
  144. var requiredUserType = localStorage.getItem("requiredUserType");
  145. localStorage.removeItem("requiredUserType");
  146. var activityUrl = localStorage.getItem("activityUrl");
  147. localStorage.removeItem("activityUrl");
  148. var returnUrl = localStorage.getItem("returnUrl");
  149. localStorage.removeItem("returnUrl");
  150. var errorMsg = localStorage.getItem("errorMsg");
  151. localStorage.removeItem("errorMsg");
  152. //进入安监系统
  153. if (safetySupervision) {
  154. window.location.href = "http://202.102.20.60:8008/xq/#/login?username=" + result.obj.userName;
  155. return;
  156. }
  157. //进入电炉监控系统
  158. if (electricFurnaceMonitoring) {
  159. window.location.href = "http://202.102.20.60:8008/ly/#/login?username=" + result.obj.userName;
  160. return;
  161. }
  162. //进入楼宇经济监测平台首字母
  163. if (lyjjjcpt) {
  164. window.location.href = "http://112.4.85.47:8000/lyzf/#/login?username=" + result.obj.userName;
  165. return;
  166. }
  167. //进入工业厂房
  168. if (industrialCarrier) {
  169. window.location.href = pagePath.substring(0,pagePath.lastIndexOf("/")) + '/industry/home/#/home';
  170. // window.open(pagePath.substring(0,pagePath.lastIndexOf("/")) + '/industry/home/#/home');
  171. return;
  172. }
  173. //进入工业用地
  174. if (industrialLand){
  175. window.open(pagePath.substring(0,pagePath.lastIndexOf("/")) + '/industry/home/#/industrialReserve');
  176. return;
  177. }
  178. //进入新门户首页
  179. if (platformHome){
  180. window.location.href = pagePath + '/index';
  181. return;
  182. }
  183. //个人用户登录直接进入首页
  184. if (result.obj.userType === 5){
  185. if (activityUrl){
  186. window.location.href = activityUrl;
  187. return;
  188. }
  189. window.location.href = pagePath + '/index';
  190. return;
  191. }
  192. if (result.obj.firstLogin == null || result.obj.firstLogin == 0) {
  193. //第一次登录 取后台改密码
  194. window.location.href = pagePath + "/admin/home";
  195. //window.open(pagePath + "/admin/home");
  196. return;
  197. }
  198. smileMessage(result.message);
  199. if (activityUrl) {
  200. //只有某一类用户可以执行操作,比如门户项目申报只能企业用户申报
  201. if (requiredUserType) {
  202. if (requiredUserType == result.obj.userType) {
  203. window.location.href = activityUrl;
  204. return;
  205. } else {
  206. if (returnUrl) {
  207. sadMessage(errorMsg);
  208. window.location.href = returnUrl;
  209. return;
  210. } else {
  211. window.location.href = pagePath + "/home";
  212. return;
  213. }
  214. }
  215. } else {
  216. window.location.href = activityUrl;
  217. return;
  218. }
  219. }
  220. if (result.obj.firstLogin == 1 && result.obj.userType == 3) {
  221. localStorage.setItem("url", "/build/company/companyInfo")
  222. //window.location.href = pagePath + "/build/company/companyInfo";
  223. //return;
  224. }
  225. if (!result.obj.isComplete) {
  226. layer_show("完善信息", pagePath + "/home/toComplete", 800, 600);
  227. return;
  228. }
  229. window.location.href = pagePath + "/admin/home";
  230. //window.open(pagePath + "/admin/home");
  231. } else {
  232. sadMessage(result.message);
  233. }
  234. }
  235. });
  236. }
  237. function register(title, url, w, h) {
  238. var index = layer_show(title, pagePath + url, w, h);
  239. console.log("登录页:"+index);
  240. //默认全屏
  241. layer.full(index);
  242. }
  243. function reset(title, url, w, h) {
  244. layer_show(title, pagePath + url, w, h);
  245. }
  246. $("body").keydown(function () {
  247. if (event.keyCode == "13") {//keyCode=13是回车键
  248. $('.login-btn').trigger("click");
  249. }
  250. });
  251. function getCookie(c_name) {
  252. if (document.cookie.length > 0) {
  253. c_start = document.cookie.indexOf(c_name + "=")
  254. if (c_start != -1) {
  255. c_start = c_start + c_name.length + 1
  256. c_end = document.cookie.indexOf(";", c_start)
  257. if (c_end == -1) c_end = document.cookie.length
  258. return unescape(document.cookie.substring(c_start, c_end))
  259. }
  260. }
  261. return ""
  262. }
  263. if (!getCookie(c_name)) {
  264. layer.open({
  265. title: '提示!'
  266. , content: '建议使用chrome浏览器、ie8及以上浏览器访问'
  267. , btn: ['知道了', '不再提示']
  268. , yes: function (index, layero) {
  269. layer.close(index);
  270. }
  271. , btn2: function (index, layero) {
  272. document.cookie = c_name + "=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
  273. return true
  274. }
  275. });
  276. }
  277. function redirectToIndustrialCarrier() {
  278. $.ajax({
  279. url: pagePath + "/token/create",
  280. type: "get",
  281. dataType: "json",
  282. data: {
  283. timeStamp: new Date()
  284. },
  285. success: function (result) {
  286. console.log(result);
  287. if (result.success) {
  288. var token = result.obj;
  289. console.log(token);
  290. localStorage.setItem("INDUSTRIAL_CARRIER", token);
  291. }
  292. }
  293. });
  294. }
  295. </script>
  296. </body>
  297. </html>
  298. <style type="text/css">
  299. .red {
  300. color: #D0021B;
  301. padding: 0 5px;
  302. }
  303. .footer {
  304. position: fixed;
  305. bottom: 0;
  306. padding: 10px 0 0;
  307. }
  308. .form-group {
  309. padding-top: 30px;
  310. margin-bottom: 0;
  311. margin-left: 0;
  312. margin-right: 0;
  313. }
  314. .input-group {
  315. margin-top: 25px;
  316. }
  317. @media (min-width: 1200px) {
  318. .container {
  319. padding: 0 100px
  320. }
  321. }
  322. @media (min-width: 1600px) {
  323. .content {
  324. margin-top: 150px !important
  325. }
  326. }
  327. body {
  328. font-family: "华文细黑";
  329. /*width: 100%;*/
  330. /*height: 100%;*/
  331. /*background: url(".././home/image/background.png") no-repeat;*/
  332. /*background-size: 100%;*/
  333. /*background-position: bottom;*/
  334. }
  335. .layui-layer-padding {
  336. color: #333
  337. }
  338. /*.main{
  339. background: url(.././image/background.png) no-repeat 4px 5px;
  340. }*/
  341. </style>