login_back20171128.jsp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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><t:mutiLang langKey="jeect.platform"/></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. <!--[if lte IE 9]>
  27. <link rel="stylesheet" href="plug-in/ace/css/ace-part2.css" class="ace-main-stylesheet" />
  28. <![endif]-->
  29. <!--[if lte IE 9]>
  30. <link rel="stylesheet" href="plug-in/ace/css/ace-ie.css" />
  31. <![endif]-->
  32. <!-- ace settings handler -->
  33. <script src="plug-in/ace/js/ace-extra.js"></script>
  34. <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  35. <!--[if lte IE 8]>
  36. <script src="plug-in/ace/js/html5shiv.js"></script>
  37. <script src="plug-in/ace/js/respond.js"></script>
  38. <![endif]-->
  39. </head>
  40. <body class="login-layout light-login">
  41. <div class="main-container">
  42. <div class="main-content">
  43. <div class="row">
  44. <div class="col-sm-10 col-sm-offset-1">
  45. <div class="login-container">
  46. <div class="center">
  47. <h1 id="id-text2" class="grey">
  48. <i class="ace-icon fa fa-leaf green"></i>
  49. JEECG 演示系统
  50. </h1>
  51. <h4 class="blue" id="id-company-text">www.jeecg.org</h4>
  52. </div>
  53. <div class="space-6"></div>
  54. <div class="position-relative">
  55. <div id="login-box" class="login-box visible widget-box no-border">
  56. <div class="widget-body">
  57. <!--update-begin--Author:zhangliang Date:20170628 for:TASK #2116 【性能问题】优化登录逻辑---------------------->
  58. <form id="loinForm" class="form-horizontal" method="post">
  59. <!--update-end--Author:zhangliang Date:20170628 for:TASK #2116 【性能问题】优化登录逻辑---------------------->
  60. <!-- add-begin--Author:zhoujf Date:20170602 for:单点登录 -->
  61. <input type="hidden" id="ReturnURL" name="ReturnURL" value="${ReturnURL }"/>
  62. <!-- add-end--Author:zhoujf Date:20170602 for:单点登录 -->
  63. <div class="widget-main">
  64. <div class="alert alert-warning alert-dismissible" role="alert" id="errMsgContiner">
  65. <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  66. <div id="showErrMsg"></div>
  67. </div>
  68. <h4 class="header blue lighter bigger">
  69. <i class="ace-icon fa fa-coffee green"></i>
  70. 用户登录
  71. </h4>
  72. <div class="space-6"></div>
  73. <label class="block clearfix">
  74. <span class="block input-icon input-icon-right">
  75. <input type="text" name="userName" class="form-control" placeholder="请输入用户名" id="userName" value="admin"/>
  76. <i class="ace-icon fa fa-user"></i>
  77. </span>
  78. </label>
  79. <label class="block clearfix">
  80. <span class="block input-icon input-icon-right">
  81. <input type="password" name="password" class="form-control" placeholder="请输入密码" id="password" value="123456"/>
  82. <i class="ace-icon fa fa-lock"></i>
  83. </span>
  84. </label>
  85. <label class="block clearfix">
  86. <!-- <div class="input-group">
  87. <input type="text" style="width:150px" name="randCode" class="form-control" placeholder="请输入验证码" id="randCode"/>
  88. <span class="input-group-addon" style="padding: 0px;"><img id="randCodeImage" src="randCodeImage" /></span>
  89. </div> -->
  90. <!-- 开发临时修改 -->
  91. <div class="input-group" style="display: none">
  92. <input type="text" style="width:150px" name="randCode" class="form-control" placeholder="请输入验证码" id="randCode" value=""/>
  93. <span class="input-group-addon" style="padding: 0px;"><img id="randCodeImage" src="randCodeImage" /></span>
  94. </div>
  95. </label>
  96. <div class="space"></div>
  97. <div class="clearfix">
  98. <label class="inline">
  99. <input type="checkbox" class="ace" id="on_off" name="remember" value="yes"/>
  100. <span class="lbl">记住用户名</span>
  101. </label>
  102. <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>
  103. <button type="button" id="but_login" onclick="checkUser()" class="width-35 pull-right btn btn-sm btn-primary">
  104. <i class="ace-icon fa fa-key"></i>
  105. <span class="bigger-110" >登录</span>
  106. </button>
  107. </div>
  108. <div class="space-4"></div>
  109. </div>
  110. <div class="toolbar clearfix">
  111. <div style="float: right">
  112. <a href="#" class="forgot-password-link">
  113. 语言
  114. <i class="ace-icon fa fa-arrow-right"></i>
  115. <t:dictSelect id="langCode" field="langCode" typeGroupCode="lang" hasLabel="false" extendJson="{style:'padding:2px; width:80px;'}" defaultVal="zh-cn"></t:dictSelect>
  116. </a>
  117. </div>
  118. </div>
  119. </form>
  120. </div>
  121. </div>
  122. <div class="center"><h4 class="blue" id="id-company-text">&copy; JEECG版权所有 v_3.7</h4></div>
  123. <div class="navbar-fixed-top align-right">
  124. <br />
  125. &nbsp;
  126. <a id="btn-login-dark" class="blue" href="#" onclick="darkStyle()">Dark</a>
  127. &nbsp;
  128. <span class="blue">/</span>
  129. &nbsp;
  130. <a id="btn-login-blur" class="blue" href="#" onclick="blurStyle()">Blur</a>
  131. &nbsp;
  132. <span class="blue">/</span>
  133. &nbsp;
  134. <a id="btn-login-light" class="blue" href="#" onclick="lightStyle()">Light</a>
  135. &nbsp; &nbsp; &nbsp;
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <script type="text/javascript" src="plug-in/jquery/jquery-1.9.0.min.js"></script>
  144. <script type="text/javascript" src="plug-in/jquery/jquery.cookie.js"></script>
  145. <script type="text/javascript" src="plug-in/mutiLang/en.js"></script>
  146. <script type="text/javascript" src="plug-in/mutiLang/zh-cn.js"></script>
  147. <script type="text/javascript" src="plug-in/login/js/jquery.tipsy.js"></script>
  148. <script type="text/javascript" src="plug-in/login/js/iphone.check.js"></script>
  149. <!-- add-begin--Author:gengjiajia Date:20160727 for:TASK #1217 【IE兼容】jeecg h+首页兼容性问题,不兼容的浏览器直接切换套shortcut风格 -->
  150. <script type="text/javascript" src="plug-in/login/js/login.js"></script>
  151. <!-- add-end--Author:gengjiajia Date:20160727 for:TASK #1217 【IE兼容】jeecg h+首页兼容性问题,不兼容的浏览器直接切换套shortcut风格 -->
  152. <script type="text/javascript">
  153. $(function(){
  154. optErrMsg();
  155. });
  156. $("#errMsgContiner").hide();
  157. function optErrMsg(){
  158. $("#showErrMsg").html('');
  159. $("#errMsgContiner").hide();
  160. }
  161. //输入验证码,回车登录
  162. $(document).keydown(function(e){
  163. if(e.keyCode == 13) {
  164. //update-begin--Author:weict Date:20170512 for:TASK #1958 【bug】jeecg 登录bug--------------------
  165. setTimeout("$('#but_login').click()","100");
  166. //update-end--Author:weict Date:20170512 for:TASK #1958 【bug】jeecg 登录bug----------------------
  167. }
  168. });
  169. //验证用户信息
  170. function checkUser(){
  171. if(!validForm()){
  172. return false;
  173. }
  174. newLogin();
  175. }
  176. //表单验证
  177. function validForm(){
  178. if($.trim($("#userName").val()).length==0){
  179. showErrorMsg("请输入用户名");
  180. return false;
  181. }
  182. if($.trim($("#password").val()).length==0){
  183. showErrorMsg("请输入密码");
  184. return false;
  185. }
  186. if($.trim($("#randCode").val()).length==0){
  187. showErrorMsg("请输入验证码");
  188. return false;
  189. }
  190. return true;
  191. }
  192. //登录处理函数
  193. function newLogin(orgId) {
  194. setCookie();
  195. //update-begin--Author:zhangliang Date:20170628 for:TASK #2116 【性能问题】优化登录逻辑
  196. var actionurl="loginController.do?login";//提交路径
  197. var checkurl="loginController.do?checkuser";//验证路径
  198. //update-end--Author:zhangliang Date:20170628 for:TASK #2116 【性能问题】优化登录逻辑
  199. var formData = new Object();
  200. var data=$(":input").each(function() {
  201. formData[this.name] =$("#"+this.name ).val();
  202. });
  203. formData['orgId'] = orgId ? orgId : "";
  204. //语言
  205. formData['langCode']=$("#langCode").val();
  206. formData['langCode'] = $("#langCode option:selected").val();
  207. $.ajax({
  208. async : false,
  209. cache : false,
  210. type : 'POST',
  211. url : checkurl,// 请求的action路径
  212. data : formData,
  213. error : function() {// 请求失败处理函数
  214. },
  215. success : function(data) {
  216. var d = data; // ------ $.parseJSON(data);
  217. if (d.success) {
  218. if (d.attributes.orgNum > 1) {
  219. //用户拥有多个部门,需选择部门进行登录
  220. var title, okButton;
  221. if($("#langCode").val() == 'en') {
  222. title = "Please select Org";
  223. okButton = "Ok";
  224. } else {
  225. title = "请选择所属部门";
  226. okButton = "确定";
  227. }
  228. $.dialog({
  229. id: 'LHG1976D',
  230. title: title,
  231. max: false,
  232. min: false,
  233. drag: false,
  234. resize: false,
  235. content: 'url:userController.do?userOrgSelect&userId=' + d.attributes.user.id,
  236. lock:true,
  237. button : [ {
  238. name : okButton,
  239. focus : true,
  240. callback : function() {
  241. iframe = this.iframe.contentWindow;
  242. var orgId = $('#orgId', iframe.document).val();
  243. //update-begin---author:scott---date:20160529--for:变更采用ajax方式提高效率----
  244. formData['orgId'] = orgId ? orgId : "";
  245. $.ajax({
  246. async : false,
  247. cache : false,
  248. type : 'POST',
  249. url : 'loginController.do?changeDefaultOrg',// 请求的action路径
  250. data : formData,
  251. error : function() {// 请求失败处理函数
  252. },
  253. success : function(data) {
  254. window.location.href = actionurl;
  255. }
  256. });
  257. //update-begin---author:scott---date:20160529--for:变更采用ajax方式提高效率----
  258. this.close();
  259. return false;
  260. }
  261. }],
  262. close: function(){
  263. setTimeout("window.location.href='"+actionurl+"'", 10);
  264. }
  265. });
  266. } else {
  267. window.location.href = actionurl;
  268. }
  269. } else {
  270. showErrorMsg(d.msg);
  271. //update-begin--Author:xuelin Date:20170328 for:[#1822]【体验问题】登录页面,当密码或验证错误的时候 让这验证码自动刷新--------------------
  272. if(d.msg === "用户名或密码错误" || d.msg === "验证码错误")
  273. reloadRandCodeImage();
  274. GetSessionCode();
  275. //update-end--Author:xuelin Date:20170328 for:[#1822]【体验问题】登录页面,当密码或验证错误的时候 让这验证码自动刷新----------------------
  276. }
  277. }
  278. });
  279. }
  280. //登录提示消息显示
  281. function showErrorMsg(msg){
  282. $("#errMsgContiner").show();
  283. $("#showErrMsg").html(msg);
  284. window.setTimeout(optErrMsg,3000);
  285. }
  286. /**
  287. * 刷新验证码
  288. */
  289. $('#randCodeImage').click(function(){
  290. reloadRandCodeImage();
  291. GetSessionCode();
  292. });
  293. function reloadRandCodeImage() {
  294. var date = new Date();
  295. var img = document.getElementById("randCodeImage");
  296. img.src='randCodeImage?a=' + date.getTime();
  297. //console.log(img.src);
  298. }
  299. /**
  300. * 异步获取session中的验证码
  301. */
  302. function GetSessionCode() {
  303. $.ajax({
  304. async : false,
  305. cache : false,
  306. type : 'POST',
  307. url : 'loginController.do?myCode',// 请求的action路径'loginController.do?myCode'
  308. data : '',
  309. error : function() {// 请求失败处理函数
  310. },
  311. success : function(data) {
  312. $("#randCode").val(data.substring(1,5));
  313. //console.log(data.substring(1,5));
  314. }
  315. });
  316. }
  317. function darkStyle(){
  318. $('body').attr('class', 'login-layout');
  319. $('#id-text2').attr('class', 'red');
  320. $('#id-company-text').attr('class', 'blue');
  321. e.preventDefault();
  322. }
  323. function lightStyle(){
  324. $('body').attr('class', 'login-layout light-login');
  325. $('#id-text2').attr('class', 'grey');
  326. $('#id-company-text').attr('class', 'blue');
  327. e.preventDefault();
  328. }
  329. function blurStyle(){
  330. $('body').attr('class', 'login-layout blur-login');
  331. $('#id-text2').attr('class', 'white');
  332. $('#id-company-text').attr('class', 'light-blue');
  333. e.preventDefault();
  334. }
  335. //设置cookie
  336. function setCookie()
  337. {
  338. if ($('#on_off').val() == '1') {
  339. $("input[iscookie='true']").each(function() {
  340. $.cookie(this.name, $("#"+this.name).val(), "/",24);
  341. $.cookie("COOKIE_NAME","true", "/",24);
  342. });
  343. } else {
  344. $("input[iscookie='true']").each(function() {
  345. $.cookie(this.name,null);
  346. $.cookie("COOKIE_NAME",null);
  347. });
  348. }
  349. }
  350. //读取cookie
  351. function getCookie()
  352. {
  353. var COOKIE_NAME=$.cookie("COOKIE_NAME");
  354. if (COOKIE_NAME !=null) {
  355. $("input[iscookie='true']").each(function() {
  356. $($("#"+this.name).val( $.cookie(this.name)));
  357. if("admin" == $.cookie(this.name)) {
  358. $("#randCode").focus();
  359. } else {
  360. $("#password").val("");
  361. $("#password").focus();
  362. }
  363. });
  364. $("#on_off").attr("checked", true);
  365. $("#on_off").val("1");
  366. }
  367. else
  368. {
  369. $("#on_off").attr("checked", false);
  370. $("#on_off").val("0");
  371. $("#randCode").focus();
  372. }
  373. }
  374. $(document).ready(function(){
  375. GetSessionCode();
  376. });
  377. </script>
  378. <%=lhgdialogTheme %>
  379. </body>
  380. </html>