login.jsp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@page import="org.jeecgframework.core.util.SysThemesUtil,org.jeecgframework.core.enums.SysThemesEnum"%>
  3. <%@include file="/context/mytags.jsp"%>
  4. <%
  5. session.setAttribute("lang","zh-cn");
  6. SysThemesEnum sysTheme = SysThemesUtil.getSysTheme(request);
  7. String lhgdialogTheme = SysThemesUtil.getLhgdialogTheme(sysTheme);
  8. %>
  9. <!DOCTYPE html>
  10. <html lang="en">
  11. <head>
  12. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  13. <meta charset="utf-8" />
  14. <title>美都管理平台</title>
  15. <link rel="shortcut icon" href="images/favicon.ico">
  16. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
  17. <!-- bootstrap & fontawesome -->
  18. <link rel="stylesheet" href="plug-in/ace/css/bootstrap.css" />
  19. <link rel="stylesheet" href="plug-in/ace/css/font-awesome.css" />
  20. <link rel="stylesheet" type="text/css" href="plug-in/accordion/css/accordion.css">
  21. <!-- text fonts -->
  22. <link rel="stylesheet" href="plug-in/ace/css/ace-fonts.css" />
  23. <link rel="stylesheet" href="plug-in/ace/css/jquery-ui.css" />
  24. <!-- ace styles -->
  25. <!-- <link rel="stylesheet" href="plug-in/ace/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" /> -->
  26. <link rel="stylesheet" type="text/css" href="css/main.css"/>
  27. <!--[if lte IE 9]>
  28. <link rel="stylesheet" href="plug-in/ace/css/ace-part2.css" class="ace-main-stylesheet" />
  29. <![endif]-->
  30. <!--[if lte IE 9]>
  31. <link rel="stylesheet" href="plug-in/ace/css/ace-ie.css" />
  32. <![endif]-->
  33. <!-- ace settings handler -->
  34. <script src="plug-in/ace/js/ace-extra.js"></script>
  35. <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  36. <!--[if lte IE 8]>
  37. <script src="plug-in/ace/js/html5shiv.js"></script>
  38. <script src="plug-in/ace/js/respond.js"></script>
  39. <![endif]-->
  40. </head>
  41. <body >
  42. <div class="login-wrapper" style="z-index: 999">
  43. <img src="images/loginbg.png" alt="" class="login-bg"/>
  44. <%-- <img src="images/logob.png" />--%>
  45. <div class="logo-wrapper"><img class="logo" src="images/LOGO.png" alt="" /></div>
  46. <div class="content">
  47. <div class="co-left-img">
  48. <img src="images/co-left-img.png"/>
  49. <span class="title-ch" >美都管理平台</span>
  50. </div>
  51. <div class="login-info">
  52. <form id="loinForm" class="form-horizontal" method="post">
  53. <input type="hidden" id="ReturnURL" name="ReturnURL" value="${ReturnURL }"/>
  54. <!-- <div class="widget-main">
  55. <div class="alert alert-warning alert-dismissible" role="alert" id="errMsgContiner">
  56. <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  57. <div id="showErrMsg"></div>
  58. </div>
  59. </div> -->
  60. <p class="user-login">用户登录</p>
  61. <div class="err">
  62. <span id="errMsgTxt"></span>
  63. </div>
  64. <ul class="info-list mt16">
  65. <input type="text" class="nor-input-text" id="userName" name="userName" placeholder="请输入用户名"/>
  66. </ul>
  67. <ul class="info-list mt16">
  68. <input type="password" class="nor-input-text" id="password" name="password" placeholder="请输入密码"/>
  69. </ul>
  70. <!--<ul class="info-list mt16">
  71. <input type="text" style="width:50%;" class="nor-input-text" id="randCode" name="randCode" placeholder="请输入验证码"/>
  72. <span class="input-group-addon" style="padding:0px; float:left; margin-left:10px; "><img id="randCodeImage" src="randCodeImage"/></span>
  73. </ul>-->
  74. <ul class="password-box">
  75. <input type="checkbox" class="checkbox-style" id="on_off" name="remember" value="yes"/>
  76. <label for="" class="sec-text ml8" style="margin-top:2px;">记住密码</label>
  77. </ul>
  78. <button type="button" class="button-login mt24" id="but_login" onclick="checkUser()" >登录</button>
  79. </form>
  80. </div>
  81. </div>
  82. </div>
  83. <%-- <div class="main-container">
  84. <div class="main-content">
  85. <div class="row">
  86. <div class="col-sm-10 col-sm-offset-1">
  87. <div class="login-container">
  88. <div class="center">
  89. <h1 id="id-text2" class="grey">
  90. <i class="ace-icon fa fa-leaf green"></i>
  91. 物业慧管理平台
  92. </h1>
  93. <h4 class="blue" id="id-company-text">www.shenqin.net</h4>
  94. </div>
  95. <div class="space-6"></div>
  96. <div class="position-relative">
  97. <div id="login-box" class="login-box visible widget-box no-border">
  98. <div class="widget-body">
  99. <!--update-begin--Author:zhangliang Date:20170628 for:TASK #2116 【性能问题】优化登录逻辑---------------------->
  100. <form id="loinForm" class="form-horizontal" method="post">
  101. <!--update-end--Author:zhangliang Date:20170628 for:TASK #2116 【性能问题】优化登录逻辑---------------------->
  102. <!-- add-begin--Author:zhoujf Date:20170602 for:单点登录 -->
  103. <input type="hidden" id="ReturnURL" name="ReturnURL" value="${ReturnURL }"/>
  104. <!-- add-end--Author:zhoujf Date:20170602 for:单点登录 -->
  105. <div class="widget-main">
  106. <div class="alert alert-warning alert-dismissible" role="alert" id="errMsgContiner">
  107. <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  108. <div id="showErrMsg"></div>
  109. </div>
  110. <h4 class="header blue lighter bigger">
  111. <i class="ace-icon fa fa-coffee green"></i>
  112. 用户登录
  113. </h4>
  114. <div class="space-6"></div>
  115. <label class="block clearfix">
  116. <span class="block input-icon input-icon-right">
  117. <input type="text" name="userName" class="form-control" placeholder="请输入用户名" id="userName" value="admin"/>
  118. <i class="ace-icon fa fa-user"></i>
  119. </span>
  120. </label>
  121. <label class="block clearfix">
  122. <span class="block input-icon input-icon-right">
  123. <input type="password" name="password" class="form-control" placeholder="请输入密码" id="password" value="123456"/>
  124. <i class="ace-icon fa fa-lock"></i>
  125. </span>
  126. </label>
  127. <label class="block clearfix">
  128. <div class="input-group">
  129. <input type="text" style="width:150px" name="randCode" class="form-control" placeholder="请输入验证码" id="randCode"/>
  130. <span class="input-group-addon" style="padding: 0px;"><img id="randCodeImage" src="randCodeImage" /></span>
  131. </div>
  132. <!-- 开发临时修改 -->
  133. <!-- <div class="input-group" style="display: none">
  134. <input type="text" style="width:150px" name="randCode" class="form-control" placeholder="请输入验证码" id="randCode" value=""/>
  135. <span class="input-group-addon" style="padding: 0px;"><img id="randCodeImage" src="randCodeImage" /></span>
  136. </div> -->
  137. </label>
  138. <div class="space"></div>
  139. <div class="clearfix">
  140. <label class="inline">
  141. <input type="checkbox" class="ace" id="on_off" name="remember" value="yes"/>
  142. <span class="lbl">记住用户名</span>
  143. </label>
  144. <!-- <span> | <a href="mLoginController.do?login&from=singlemessage&isappinstalled=0"><i class="ace-icon fa fa-location-arrow"></i><font color='#428bca'>移动OA</font></a></span> -->
  145. <button type="button" id="but_login" onclick="checkUser()" class="width-35 pull-right btn btn-sm btn-primary">
  146. <i class="ace-icon fa fa-key"></i>
  147. <span class="bigger-110" >登录</span>
  148. </button>
  149. </div>
  150. <div class="space-4"></div>
  151. </div>
  152. <div class="toolbar clearfix">
  153. <div style="float: right">
  154. <a href="#" class="forgot-password-link">
  155. 语言
  156. <i class="ace-icon fa fa-arrow-right"></i>
  157. <t:dictSelect id="langCode" field="langCode" typeGroupCode="lang" hasLabel="false" extendJson="{style:'padding:2px; width:80px;'}" defaultVal="zh-cn"></t:dictSelect>
  158. </a>
  159. </div>
  160. </div>
  161. </form>
  162. </div>
  163. </div>
  164. <div class="center"><h4 class="blue" id="id-company-text">&copy; 美都环卫物业版权所有 v_1.0</h4></div>
  165. <div class="navbar-fixed-top align-right">
  166. <br />
  167. &nbsp;
  168. <a id="btn-login-dark" class="blue" href="#" onclick="darkStyle()">Dark</a>
  169. &nbsp;
  170. <span class="blue">/</span>
  171. &nbsp;
  172. <a id="btn-login-blur" class="blue" href="#" onclick="blurStyle()">Blur</a>
  173. &nbsp;
  174. <span class="blue">/</span>
  175. &nbsp;
  176. <a id="btn-login-light" class="blue" href="#" onclick="lightStyle()">Light</a>
  177. &nbsp; &nbsp; &nbsp;
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. </div> --%>
  185. <script type="text/javascript" src="plug-in/jquery/jquery-1.9.0.min.js"></script>
  186. <script type="text/javascript" src="plug-in/jquery/jquery.cookie.js"></script>
  187. <script type="text/javascript" src="plug-in/mutiLang/en.js"></script>
  188. <script type="text/javascript" src="plug-in/mutiLang/zh-cn.js"></script>
  189. <script type="text/javascript" src="plug-in/login/js/jquery.tipsy.js"></script>
  190. <script type="text/javascript" src="plug-in/login/js/iphone.check.js"></script>
  191. <!-- add-begin--Author:gengjiajia Date:20160727 for:TASK #1217 【IE兼容】jeecg h+首页兼容性问题,不兼容的浏览器直接切换套shortcut风格 -->
  192. <script type="text/javascript" src="plug-in/login/js/login.js"></script>
  193. <!-- add-end--Author:gengjiajia Date:20160727 for:TASK #1217 【IE兼容】jeecg h+首页兼容性问题,不兼容的浏览器直接切换套shortcut风格 -->
  194. <script type="text/javascript">
  195. // 原来的验证
  196. /* $(function(){
  197. optErrMsg();
  198. });
  199. $("#errMsgContiner").hide();
  200. function optErrMsg(){
  201. $("#showErrMsg").html('');
  202. $("#errMsgContiner").hide();
  203. }
  204. //登录提示消息显示
  205. function showErrorMsg(msg){
  206. $("#errMsgContiner").show();
  207. $("#showErrMsg").html(msg);
  208. window.setTimeout(optErrMsg,3000);
  209. } */
  210. $(".err").hide();
  211. var hideErrorMsgTimeOut = "";
  212. var loginSuceess = false;
  213. //显示错误信息
  214. function showErrorMsg(msg){
  215. msg = '<font color="#FF0000">' + msg + '</font>';
  216. $("#errMsgTxt").html(msg);
  217. $(".err").show();
  218. if(hideErrorMsgTimeOut != ""){
  219. clearTimeout(hideErrorMsgTimeOut);
  220. hideErrorMsgTimeOut = "";
  221. }
  222. hideErrorMsgTimeOut = setTimeout(hideErrorMsg,3000);
  223. }
  224. //隐藏错误消息
  225. function hideErrorMsg(){
  226. $("#errMsgTxt").html("");
  227. $(".err").hide();
  228. }
  229. //输入验证码,回车登录
  230. $(document).keydown(function(e){
  231. if(e.keyCode == 13) {
  232. //update-begin--Author:weict Date:20170512 for:TASK #1958 【bug】jeecg 登录bug--------------------
  233. setTimeout("$('#but_login').click()","100");
  234. //update-end--Author:weict Date:20170512 for:TASK #1958 【bug】jeecg 登录bug----------------------
  235. }
  236. });
  237. //验证用户信息
  238. function checkUser(){
  239. if(!validForm()){
  240. return false;
  241. }
  242. newLogin();
  243. }
  244. //表单验证
  245. function validForm(){
  246. if($.trim($("#userName").val()).length==0){
  247. showErrorMsg("请输入用户名");
  248. return false;
  249. }
  250. if($.trim($("#password").val()).length==0){
  251. showErrorMsg("请输入密码");
  252. return false;
  253. }
  254. // if($.trim($("#randCode").val()).length==0){
  255. // showErrorMsg("请输入验证码");
  256. // return false;
  257. // }
  258. return true;
  259. }
  260. //登录处理函数
  261. function newLogin(orgId) {
  262. if(loginSuceess){
  263. return;
  264. }
  265. //setCookie();
  266. if($("#on_off").is(':checked')){
  267. setCookie('user',$("#userName").val(),7); //保存帐号到cookie,有效期7天
  268. setCookie('pswd',window.btoa($("#password").val()),7); //保存密码到cookie,有效期7天
  269. }else{
  270. delCookie('user');
  271. delCookie('pswd');
  272. }
  273. var actionurl="loginController.do?login";//提交路径
  274. var checkurl="loginController.do?checkuser";//验证路径
  275. var formData = new Object();
  276. var data=$(":input").each(function() {
  277. formData[this.name] =$("#"+this.name ).val();
  278. });
  279. formData['orgId'] = orgId ? orgId : "";
  280. //语言
  281. formData['langCode']=$("#langCode").val();
  282. formData['langCode'] = $("#langCode option:selected").val();
  283. $.ajax({
  284. async : false,
  285. cache : false,
  286. type : 'POST',
  287. url : checkurl,// 请求的action路径
  288. data : formData,
  289. error : function() {// 请求失败处理函数
  290. },
  291. success : function(data) {
  292. var d = data;
  293. if(typeof(data)=='string') d = data; // ------ $.parseJSON(data);
  294. if (d.success) {
  295. loginSuceess = true;
  296. showErrorMsg("登录成功!");
  297. if (d.attributes.orgNum > 1) {
  298. //用户拥有多个部门,需选择部门进行登录
  299. var title, okButton;
  300. if($("#langCode").val() == 'en') {
  301. title = "Please select Org";
  302. okButton = "Ok";
  303. } else {
  304. title = "请选择所属部门";
  305. okButton = "确定";
  306. }
  307. $.dialog({
  308. id: 'LHG1976D',
  309. title: title,
  310. max: false,
  311. min: false,
  312. drag: false,
  313. resize: false,
  314. content: 'url:userController.do?userOrgSelect&userId=' + d.attributes.user.id,
  315. lock:true,
  316. button : [ {
  317. name : okButton,
  318. focus : true,
  319. callback : function() {
  320. iframe = this.iframe.contentWindow;
  321. var orgId = $('#orgId', iframe.document).val();
  322. formData['orgId'] = orgId ? orgId : "";
  323. $.ajax({
  324. async : false,
  325. cache : false,
  326. type : 'POST',
  327. url : 'loginController.do?changeDefaultOrg',// 请求的action路径
  328. data : formData,
  329. error : function() {// 请求失败处理函数
  330. },
  331. success : function(data) {
  332. window.location.href = actionurl;
  333. }
  334. });
  335. this.close();
  336. return false;
  337. }
  338. }],
  339. close: function(){
  340. setTimeout("window.location.href='"+actionurl+"'", 10);
  341. }
  342. });
  343. }if (d.attributes.orgNum == -1) {
  344. showErrorMsg("您的所属机构异常,请联系管理员!");
  345. } else {
  346. window.location.href = actionurl;
  347. }
  348. } else {
  349. showErrorMsg(d.msg);
  350. //update-begin--Author:xuelin Date:20170328 for:[#1822]【体验问题】登录页面,当密码或验证错误的时候 让这验证码自动刷新--------------------
  351. if(d.msg === "用户名或密码错误" || d.msg === "验证码错误")
  352. reloadRandCodeImage();
  353. GetSessionCode();
  354. //update-end--Author:xuelin Date:20170328 for:[#1822]【体验问题】登录页面,当密码或验证错误的时候 让这验证码自动刷新----------------------
  355. }
  356. }
  357. });
  358. }
  359. //登录处理函数
  360. /*function newLogin(orgId) {
  361. setCookie();
  362. //update-begin--Author:zhangliang Date:20170628 for:TASK #2116 【性能问题】优化登录逻辑
  363. var actionurl="loginController.do?login";//提交路径
  364. var checkurl="loginController.do?checkuser";//验证路径
  365. //update-end--Author:zhangliang Date:20170628 for:TASK #2116 【性能问题】优化登录逻辑
  366. var formData = new Object();
  367. var data=$(":input").each(function() {
  368. formData[this.name] =$("#"+this.name ).val();
  369. });
  370. formData['orgId'] = orgId ? orgId : "";
  371. //语言
  372. formData['langCode']=$("#langCode").val();
  373. formData['langCode'] = $("#langCode option:selected").val();
  374. $.ajax({
  375. async : false,
  376. cache : false,
  377. type : 'POST',
  378. url : checkurl,// 请求的action路径
  379. data : formData,
  380. error : function() {// 请求失败处理函数
  381. },
  382. success : function(data) {
  383. var d = data; // ------ $.parseJSON(data);
  384. if (d.success) {
  385. if (d.attributes.orgNum > 1) {
  386. //用户拥有多个部门,需选择部门进行登录
  387. var title, okButton;
  388. if($("#langCode").val() == 'en') {
  389. title = "Please select Org";
  390. okButton = "Ok";
  391. } else {
  392. title = "请选择所属部门";
  393. okButton = "确定";
  394. }
  395. $.dialog({
  396. id: 'LHG1976D',
  397. title: title,
  398. max: false,
  399. min: false,
  400. drag: false,
  401. resize: false,
  402. content: 'url:userController.do?userOrgSelect&userId=' + d.attributes.user.id,
  403. lock:true,
  404. button : [ {
  405. name : okButton,
  406. focus : true,
  407. callback : function() {
  408. iframe = this.iframe.contentWindow;
  409. var orgId = $('#orgId', iframe.document).val();
  410. //update-begin---author:scott---date:20160529--for:变更采用ajax方式提高效率----
  411. formData['orgId'] = orgId ? orgId : "";
  412. $.ajax({
  413. async : false,
  414. cache : false,
  415. type : 'POST',
  416. url : 'loginController.do?changeDefaultOrg',// 请求的action路径
  417. data : formData,
  418. error : function() {// 请求失败处理函数
  419. },
  420. success : function(data) {
  421. window.location.href = actionurl;
  422. }
  423. });
  424. //update-begin---author:scott---date:20160529--for:变更采用ajax方式提高效率----
  425. this.close();
  426. return false;
  427. }
  428. }],
  429. close: function(){
  430. setTimeout("window.location.href='"+actionurl+"'", 10);
  431. }
  432. });
  433. } else {
  434. window.location.href = actionurl;
  435. }
  436. } else {
  437. showErrorMsg(d.msg);
  438. //update-begin--Author:xuelin Date:20170328 for:[#1822]【体验问题】登录页面,当密码或验证错误的时候 让这验证码自动刷新--------------------
  439. if(d.msg === "用户名或密码错误" || d.msg === "验证码错误")
  440. reloadRandCodeImage();
  441. GetSessionCode();
  442. //update-end--Author:xuelin Date:20170328 for:[#1822]【体验问题】登录页面,当密码或验证错误的时候 让这验证码自动刷新----------------------
  443. }
  444. }
  445. });
  446. }*/
  447. /**
  448. * 刷新验证码
  449. */
  450. $('#randCodeImage').click(function(){
  451. reloadRandCodeImage();
  452. GetSessionCode();
  453. });
  454. function reloadRandCodeImage() {
  455. var date = new Date();
  456. var img = document.getElementById("randCodeImage");
  457. img.src='randCodeImage?a=' + date.getTime();
  458. //console.log(img.src);
  459. }
  460. /**
  461. * 异步获取session中的验证码
  462. */
  463. function GetSessionCode() {
  464. $.ajax({
  465. async : false,
  466. cache : false,
  467. type : 'POST',
  468. url : 'loginController.do?myCode',// 请求的action路径'loginController.do?myCode'
  469. data : '',
  470. error : function() {// 请求失败处理函数
  471. },
  472. success : function(data) {
  473. $("#randCode").val(data.substring(1,5));
  474. /* alert(data.substring(1,5)); */
  475. //console.log(data.substring(1,5));
  476. }
  477. });
  478. }
  479. function darkStyle(){
  480. $('body').attr('class', 'login-layout');
  481. $('#id-text2').attr('class', 'red');
  482. $('#id-company-text').attr('class', 'blue');
  483. e.preventDefault();
  484. }
  485. function lightStyle(){
  486. $('body').attr('class', 'login-layout light-login');
  487. $('#id-text2').attr('class', 'grey');
  488. $('#id-company-text').attr('class', 'blue');
  489. e.preventDefault();
  490. }
  491. function blurStyle(){
  492. $('body').attr('class', 'login-layout blur-login');
  493. $('#id-text2').attr('class', 'white');
  494. $('#id-company-text').attr('class', 'light-blue');
  495. e.preventDefault();
  496. }
  497. //设置cookie
  498. /* function setCookie()
  499. {
  500. if ($('#on_off').val() == '1') {
  501. $("input[iscookie='true']").each(function() {
  502. $.cookie(this.name, $("#"+this.name).val(), "/",24);
  503. $.cookie("COOKIE_NAME","true", "/",24);
  504. });
  505. } else {
  506. $("input[iscookie='true']").each(function() {
  507. $.cookie(this.name,null);
  508. $.cookie("COOKIE_NAME",null);
  509. });
  510. }
  511. } */
  512. /* //读取cookie
  513. function getCookie()
  514. {
  515. var COOKIE_NAME=$.cookie("COOKIE_NAME");
  516. if (COOKIE_NAME !=null) {
  517. $("input[iscookie='true']").each(function() {
  518. $($("#"+this.name).val( $.cookie(this.name)));
  519. if("admin" == $.cookie(this.name)) {
  520. $("#randCode").focus();
  521. } else {
  522. $("#password").val("");
  523. $("#password").focus();
  524. }
  525. });
  526. $("#on_off").attr("checked", true);
  527. $("#on_off").val("1");
  528. }
  529. else
  530. {
  531. $("#on_off").attr("checked", false);
  532. $("#on_off").val("0");
  533. $("#randCode").focus();
  534. }
  535. } */
  536. $(document).ready(function(){
  537. GetSessionCode();
  538. var oForm = document.getElementById('loinForm');
  539. var oUser = document.getElementById('userName');
  540. var oPswd = document.getElementById('password');
  541. var oRemember = document.getElementById('on_off');
  542. //页面初始化时,如果帐号密码cookie存在则填充
  543. if(getCookie('user') && getCookie('pswd')){
  544. oUser.value = getCookie('user');
  545. oPswd.value = window.atob(getCookie('pswd'));
  546. oRemember.checked = true;
  547. }
  548. /* //复选框勾选状态发生改变时,如果未勾选则清除cookie
  549. oRemember.onchange = function(){
  550. if(!this.checked){
  551. delCookie('user');
  552. delCookie('pswd');
  553. }
  554. }; */
  555. //表单提交事件触发时,如果复选框是勾选状态则保存cookie
  556. /* oForm.onsubmit = function(){
  557. if(remember.checked){
  558. setCookie('user',oUser.value,7); //保存帐号到cookie,有效期7天
  559. setCookie('pswd',oPswd.value,7); //保存密码到cookie,有效期7天
  560. }
  561. }; */
  562. });
  563. /* //复选框勾选状态发生改变时,如果未勾选则清除cookie
  564. function rememberChange(){
  565. if($("#on_off").is(':checked')){
  566. delCookie('user');
  567. delCookie('pswd');
  568. }
  569. } */
  570. //设置cookie
  571. function setCookie(name,value,day){
  572. var date = new Date();
  573. date.setDate(date.getDate() + day);
  574. document.cookie = name + '=' + value + ';expires='+ date;
  575. };
  576. //获取cookie
  577. function getCookie(name){
  578. var reg = RegExp(name+'=([^;]+)');
  579. var arr = document.cookie.match(reg);
  580. if(arr){
  581. return arr[1];
  582. }else{
  583. return '';
  584. }
  585. };
  586. //删除cookie
  587. function delCookie(name){
  588. setCookie(name,"",-1);
  589. };
  590. </script>
  591. <%=lhgdialogTheme %>
  592. </body>
  593. </html>