index.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0;" name="viewport" />
  5. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  6. <meta http-equiv="X-UA-Compatible" content="IE=8"/>
  7. <title>南方电网应急指挥系统--登录</title>
  8. <link rel="Shortcut Icon" href="images/favicon.png"/>
  9. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/jquery.js"></script>
  10. <script type="text/javascript" src="/nwyj/scripts/freamwork/com/sinosoft/system/md5/md5.js"></script>
  11. <style>
  12. html{
  13. width:100%;
  14. height:100%;
  15. margin:0px;
  16. overflow: hidden;
  17. }
  18. body{
  19. margin:0px;
  20. width:100%;
  21. height:100%;
  22. background-color: #e5e9ec;
  23. }
  24. .login_contant{
  25. top: 10%;
  26. right: 0;
  27. width:100%;
  28. position: absolute;
  29. }
  30. .login_main{
  31. z-index:-1;
  32. width:100%;
  33. }
  34. /*
  35. .login_logo{
  36. position: absolute;
  37. top: 12%;
  38. right: 45%;
  39. width: 40%;
  40. }
  41. .login_text{
  42. position: absolute;
  43. top: 27%;
  44. right: 19.5%;
  45. width: 18.5%;
  46. font-size: 1.2em;
  47. font-family: "微软雅黑";
  48. text-align:center;
  49. color: white;
  50. } */
  51. .login_form {
  52. position: absolute;
  53. top: 23%;
  54. right: 19.5%;
  55. width: 18.5%;
  56. height: 58%;
  57. }
  58. .login_img{
  59. z-index:-1;
  60. width: 100%;
  61. height: 100%
  62. }
  63. div.login_position{
  64. border: 0px;
  65. padding: 0px 0px 0px 3%;
  66. width: 97%;
  67. white-space: nowrap;
  68. word-break: keep-all;
  69. word-wrap: normal;
  70. line-height: 100%;
  71. position: relative;
  72. margin-bottom: 6.8%;
  73. cursor: text;
  74. }
  75. div.login_user{
  76. height: 48%;
  77. }
  78. div.login_pass{
  79. height: 18%;
  80. }
  81. input{
  82. position:absolute;
  83. bottom:1px;
  84. left: 17%;
  85. border-style: none;
  86. width: 82%;
  87. font-size: 18px;
  88. background-color: transparent;
  89. border: 0px;
  90. outline: none;
  91. /* z-index: 10; */
  92. }
  93. input#username{
  94. height: 33%;
  95. line-height:45px;
  96. }
  97. input#password{
  98. height: 90%;
  99. line-height:45px;
  100. }
  101. .login_button{
  102. text-align: center;
  103. width:100%;
  104. padding: 5% 0px 0px 3%;
  105. width: 97%;
  106. }
  107. .login_button_position{
  108. margin: 0px auto;
  109. cursor:pointer;
  110. border: 0px;
  111. display: inline-block;
  112. width:100%;
  113. }
  114. .login_info{
  115. margin-left:3%;
  116. margin-top: 10%;
  117. font-size: 12px;
  118. }
  119. </style>
  120. </head>
  121. <body onload="document.getElementById('username').focus();GetCookie();">
  122. <div class="login_contant">
  123. <img class="login_main" src="/nwyj/images/index/loginPage_bg.png"/>
  124. <!-- <img class="login_logo" src="/nwyj/images/index/login_logo.png"/>
  125. <div class="login_text"> 应急指挥管理系统</div> -->
  126. <div class="login_form">
  127. <div class="login_user login_position"><img class="login_img" src="/nwyj/images/index/login_user.png"/><input type="text" id="username" onkeyup="clearpassword()" watermark=" 用 户 名 " value=""></div>
  128. <div class="login_pass login_position"><img class="login_img" src="/nwyj/images/index/login_pass.png"/><input type="password" id="password" watermark=" 密 码 " value=""></div>
  129. <div class="login_button">
  130. <img src="/nwyj/images/index/login_login.png" class="login_button_login login_button_position" onclick="login()" ></img>
  131. </div>
  132. <div class="login_info" style="display:none;"></div>
  133. </div>
  134. </div>
  135. <script type="text/javascript" >
  136. //帐号输入框变动时,清空密码框(2015.10.13 梁俊鹏)
  137. function clearpassword(){
  138. $("#password").val("");
  139. }
  140. $(function(){
  141. //防止iframe内出现登录页
  142. if (window != top)
  143. top.location.href = location.href;
  144. //居中
  145. document.getElementById("username").focus();
  146. $("#username").keydown(function(event){
  147. if(event.keyCode==13){
  148. login();
  149. }
  150. })
  151. $("#password").keydown(function(event){
  152. if(event.keyCode==13){
  153. login();
  154. }
  155. })
  156. $(".login_position").live("click",function(){
  157. $(this).find("input").focus();
  158. });
  159. });
  160. //保存cookies
  161. function SetCookie(usern, psw) {
  162. var Then = new Date()
  163. Then.setTime(Then.getTime() + 1866240000000)
  164. document.cookie = "username=" + usern + "%%" + psw + ";expires="
  165. + Then.toGMTString();
  166. }
  167. //获取cookies
  168. function GetCookie() {
  169. var nmpsd;
  170. var nm;
  171. var psd;
  172. var cookieString = new String(document.cookie)
  173. var cookieHeader = "username="
  174. var beginPosition = cookieString.indexOf(cookieHeader)
  175. cookieString = cookieString.substring(beginPosition);
  176. var ends = cookieString.indexOf(";");
  177. if (ends != -1) {
  178. cookieString = cookieString.substring(0, ends);
  179. }
  180. if (beginPosition > -1) {
  181. nmpsd = cookieString.substring(cookieHeader.length);
  182. if (nmpsd != "") {
  183. beginPosition = nmpsd.indexOf("%%");
  184. nm = nmpsd.substring(0, beginPosition);
  185. psd = nmpsd.substring(beginPosition + 2);
  186. document.getElementById("username").value = nm;
  187. document.getElementById("password").value = psd;
  188. }
  189. }
  190. }
  191. //登录
  192. function login() {
  193. var errorMsg = "";
  194. var loginName = document.getElementById("username");
  195. var password = document.getElementById("password");
  196. var pasFormat = true;
  197. if (!loginName.value) {
  198. //errorMsg += "&nbsp;用户名不能为空!";
  199. errorMsg += "用户名不能为空!";
  200. }
  201. if (!password.value) {
  202. errorMsg += "密码不能为空!";
  203. }
  204. var patt = /(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%\^&*?]{8,20}$/g;
  205. var pwd = $("#password").val();
  206. if (!patt.test(pwd)) {
  207. pasFormat = false;
  208. }
  209. if (errorMsg != "") {
  210. $(".login_info").html(errorMsg);
  211. $(".login_info").show();
  212. } else {
  213. $(".login_info").show();
  214. $(".login_info").html("正在登录中...");
  215. if(loginName.value!="" && password.value!=""){
  216. SetCookie(loginName.value,password.value);
  217. }else {
  218. SetCookie("","");
  219. }
  220. //前台做md5加密传输
  221. var md5password = md5(password.value);
  222. //登录处理
  223. $.ajax({
  224. type : "POST",
  225. url : "/nwyj/ws/sys/LoginService/Login",
  226. data : {
  227. "username" : loginName.value,
  228. "password" : md5password
  229. },
  230. success : function(data) {
  231. if (!!data && data.LoginInfo.st == 0) {
  232. $(".login_info").html("登录成功,正在转到主页...");
  233. //debugger;
  234. //console.log(JSON.stringify(data));
  235. window.name = JSON.stringify(data);
  236. //window.name = "NWYJFRAMEWORK";
  237. //alert( window.name);
  238. //window.open("/nwyj/page/frameWork.html",JSON.stringify(data));
  239. window.location = "/nwyj/page/frameWork.html";
  240. } else /* if (!!data && data.LoginInfo.st == 1) */ {
  241. //$(".login_info").html("密码错误次数达到5次,请"+data.LoginInfo.mod_date+"分钟后再登录!");
  242. //} else if(!!data && data.LoginInfo.st == 2){
  243. $(".login_info").html("用户名或密码错误,请重新登录!");
  244. //loginName.value="";
  245. //password.value="";
  246. //loginName.focus();
  247. }
  248. /* else if(!!data && data.LoginInfo.st == 2){
  249. if(data.LoginInfo.mod_date==0){
  250. $(".login_info").html("&nbsp;&nbsp;密码错误次数达到5次,请30分钟后再登录!");
  251. }else{
  252. if(pasFormat){
  253. $(".login_info").html("&nbsp;&nbsp;密码错误!还剩下"+data.LoginInfo.mod_date+"次机会!");
  254. }else{
  255. $(".login_info").html("&nbsp;&nbsp;密码格式错误!还剩下"+data.LoginInfo.mod_date+"次机会!");
  256. }
  257. $(".login_info").html("&nbsp;&nbsp;用户名或密码错误!");
  258. }
  259. }
  260. else if(!!data && data.LoginInfo.st == 3){
  261. $(".login_info").html("&nbsp;&nbsp;用户名或密码错误!");
  262. } */
  263. },
  264. error : function(data) {
  265. $(".login_info").html("登陆失败!");
  266. }
  267. });
  268. }
  269. }
  270. </script>
  271. </body>
  272. </html>