You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

462 rivejä
15 KiB

  1. <% layout('/layouts/default.html', {title: '首页', bodyClass: ''}){ %>
  2. <% } %>
  3. <link rel="stylesheet" href="${ctxStatic}/css/iconfont.css"/>
  4. <link rel="stylesheet" href="${ctxStatic}/css/layui.css" media="all">
  5. <link rel="stylesheet" href="${ctxStatic}/css/lessPackage/index/index.css" media="all">
  6. <style>
  7. body .layui-side .layui-nav {
  8. background-color: #344154 !important;
  9. }
  10. .logo-text{
  11. letter-spacing: 4px !important;
  12. font-size: 28px !important;
  13. font-family: cursive !important;
  14. }
  15. #myFrame html body{
  16. height: 100%;
  17. }
  18. </style>
  19. <body class="layui-layout-body">
  20. <div class="layui-layout layui-layout-admin">
  21. <div class="layui-header" style="background-color: rgb(52 65 83) !important;">
  22. <div class="layui-logo" style="background-color: #344154;height:60px;">
  23. <div class="logo_text" style="letter-spacing: 2px !important;font-size: 16px !important;font-family: system-ui !important;">${(isNotBlank(title!) ? title! + ' - ' : '') + @Global.getConfig('productName')}</div>
  24. </div>
  25. <div class="top_title" style="background-color: rgb(52 65 83);padding-left: 214px;line-height: 55px;">
  26. <i class="iconfont leftIcon icon-mianbaoxie" style="color: #f8f8f8;margin-right: 0 !important;"></i>
  27. <span id="breadnav_0" class="layui-breadcrumb" style="margin-left:10px; display:none;">
  28. <a href="/sso/logout">首页</a>
  29. <span style="margin-left:10px; color:#999;">></span>
  30. </span>
  31. <span id="breadnav_1" class="layui-breadcrumb"></span>
  32. <span id="breadnav_2" class="layui-breadcrumb" ></span>
  33. <span id="breadnav_3" class="layui-breadcrumb" ></span>
  34. </div>
  35. <div class="pull-left" id="title_extend" style="display:none;background-color: rgb(52 65 82);height:60px;width:20%;height:100%;"></div>
  36. <ul class="layui-nav layui-layout-right herder-right">
  37. <li class="layui-nav-item" id="msgLi">
  38. <a id="msg_center" href="javascript:;" style="color:grey;">
  39. <img class="default_notice" src="${ctxStatic}/images/notice.png" alt="消息通知" title="消息通知" width="24" />
  40. <img class="new_notice" src="${ctxStatic}/images/notice-new.png" alt="新的消息通知" title="新的消息通知" width="24" style="display:none" />
  41. </a>
  42. </li>
  43. <li class="layui-nav-item">
  44. <a href="javascript:;">
  45. <i class="iconfont icon-zhanghaoguanli" id="change-psd-select" ></i>
  46. <div class="userInfo" >
  47. <div class="userName" >${user.loginCode}</div>
  48. <div class="userType" >${user.userName}</div>
  49. </div>
  50. </a>
  51. <dl class="layui-nav-child layui-anim layui-anim-upbit" style="min-width:135px !important;left:68px;">
  52. <dd>
  53. <a id="editPwd" href="javascript:;">修改密码</a>
  54. </dd>
  55. <dd>
  56. <a href="${ctx}/logout">退出登录</a>
  57. </dd>
  58. </dl>
  59. </li>
  60. </ul>
  61. </div>
  62. <div class="layui-side layui-bg-black">
  63. <div class="layui-side-scroll">
  64. <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
  65. <ul class="layui-nav layui-nav-tree" lay-filter="test" lay-shrink="all">
  66. <%
  67. var menuList_0 = @UserUtils.getMenuListByParentCode('0');
  68. for(menu_0 in menuList_0){
  69. var menuCode = menu_0.menuCode;
  70. if(@menu_0.getIsMenu() && @menu_0.getIsShow()=='1'){
  71. if(menu_0.menuHref != ''){
  72. var url_0 = '/console' + menu_0.menuHref;
  73. print('<li class="layui-nav-item" ><a id="a_' + menuCode + '" onclick="addNav_1(this)" target="myFrame" href=' + url_0 + '><i class="iconfont leftIcon ' + menu_0.menuIcon + '"></i>' + menu_0.menuNameOrig + '</a></li>');
  74. } else {
  75. var url_0 = 'javascript:;';
  76. print('<li class="layui-nav-item" ><a id="a_' + menuCode + '" onclick="addNav_1(this)" target="myFrame" href=' + url_0 + '><i class="iconfont leftIcon ' + menu_0.menuIcon + '"></i>' + menu_0.menuNameOrig + '</a>');
  77. print('<dl id="' + menuCode + '" class="layui-nav-child">');
  78. var menuList_1 = @UserUtils.getMenuListByParentCode(menuCode);
  79. for(menu_1 in menuList_1){
  80. if(@menu_1.getIsMenu() && @menu_1.getIsShow()=='1'){
  81. var url_1 = '/console' + menu_1.menuHref;
  82. var icon_1 = 'square';
  83. if (@StringUtils.isNotEmpty(menu_1.menuIcon)) {
  84. icon_1 = " pl10 leftIcon "+menu_1.menuIcon;
  85. }
  86. print('<dd><a onclick="addNav_2(this)" target="myFrame" href=' + url_1 + '><i class="iconfont '+icon_1+'"></i>' + menu_1.menuNameOrig + '</a></dd>');
  87. }
  88. }
  89. print('</dl>');
  90. print('</li>');
  91. }
  92. }
  93. }
  94. %>
  95. </ul>
  96. </div>
  97. </div>
  98. <div class="layui-body" style="overflow: hidden !important;">
  99. <!-- 内容主体区域 -->
  100. <iframe id="myFrame" name="myFrame" scrolling="yes" frameborder="0" style="width:100%;height:100%;"></iframe>
  101. </div>
  102. </div>
  103. </body>
  104. <style>
  105. #msgLi .layui-nav-more{
  106. display: none;
  107. }
  108. .layui-nav-tree .layui-nav-bar{
  109. background-color: #FF0000 !important;
  110. }
  111. .layui-side .layui-nav .layui-nav-more{
  112. background: url(${ctxStatic}/images/index/left-bottom.png) no-repeat;
  113. background-size: 100% 100%;
  114. }
  115. .layui-nav .layui-nav-mored,.layui-side .layui-nav-itemed>a .layui-nav-more {
  116. background: url(${ctxStatic}/images/index/left-top.png) no-repeat;
  117. background-size: 100% 100%;
  118. }
  119. .layui-header .layui-nav .layui-nav-more{
  120. background: url(${ctxStatic}/images/index/top-bottom.png) no-repeat;
  121. background-size: 100% 100%;
  122. }
  123. .layui-header .layui-nav .layui-nav-mored{
  124. background: url(${ctxStatic}/images/index/top-top.png) no-repeat;
  125. background-size: 100% 100%;
  126. }
  127. .layui-breadcrumb a{
  128. font-size: 14px !important;
  129. color: #f8f8f8 !important
  130. }
  131. .layui-breadcrumb a:hover{
  132. color: #FF0000 !important;
  133. }
  134. .layui-breadcrumb-img{
  135. display: inline-block;
  136. width: 6px;
  137. height: 8px;
  138. background: url(${ctxStatic}/images/index/layui-breadcrumb-img.png) no-repeat;
  139. background-size: 100% 100%;
  140. }
  141. .layui-nav .layui-this:after, .layui-nav-bar, .layui-nav-tree .layui-nav-itemed:after{
  142. background-color: none !important;
  143. width: 0px !important;
  144. }
  145. #isValidCodeLogin .input-group-addon:nth-of-type(1){
  146. display: none;
  147. }
  148. #canvas{
  149. border: 1px solid #D2D2D2;
  150. border-left: none;
  151. }
  152. .layui-form{
  153. margin-top:-20px;
  154. }
  155. .layui-layer-msg{
  156. z-index:19992000 !important;
  157. }
  158. .layui-side{
  159. background-color: #191919 !important;
  160. }
  161. </style>
  162. <div id="edit_password_layer" class="layui_pop" style="display: none;">
  163. <div class="layui-form-item layui_pop_header">
  164. <div class="layui_header_title">设置新密码</div>
  165. <div class="layui_header_close"></div>
  166. </div>
  167. <form class="layui-form" action="">
  168. <div class="layui-form-item" style="margin-bottom:5px;">
  169. <label class="layui-form-label">输入原密码</label>
  170. <div class="layui-input-block add-delete-btn">
  171. <input id="oldPwd" name="oldPwd" type="password" placeholder="请输入原密码" autocomplete="off" class="layui-input">
  172. <i class="layui-icon reset_input"></i>
  173. <i class="iconfont eye-show do-icon" value=true></i>
  174. </div>
  175. </div>
  176. <div class="layui-form-item" style="margin-bottom:5px;">
  177. <label class="layui-form-label">输入新密码</label>
  178. <div class="layui-input-block add-delete-btn">
  179. <input id="firstPwd" type="password" placeholder="请输入新密码" lay-verify="required|pwd" autocomplete="off" class="layui-input">
  180. <i class="layui-icon reset_input"></i>
  181. <i class="iconfont eye-show do-icon" value=true></i>
  182. </div>
  183. </div>
  184. <div class="layui-form-item" style="margin-bottom:5px;">
  185. <label class="layui-form-label" >再次确认</label>
  186. <div class="layui-input-block add-delete-btn">
  187. <input id="secondPwd" type="password" name="newPwd" lay-verify="required|same" placeholder="请再次确认密码" autocomplete="off" class="layui-input">
  188. <i class="layui-icon reset_input"></i>
  189. <i class="iconfont eye-show do-icon" value=true></i>
  190. </div>
  191. <div style="color: #FF0000;height: 13px;margin-bottom: 15px;margin-top:10px;margin-left:63px;font-size:12px"><span id="add_remind">密码需要8-16位,包含大小写字母、数字和特殊字符(! 或 @ 或 _)</span></div>
  192. </div>
  193. <div class="layui-form-item layui-fotter">
  194. <div class="layui-input-block ">
  195. <button id="cancel" type="button" class="button black center">取消</button>
  196. <button class="button red center" lay-submit lay-filter="pwdForm">确认</button>
  197. </div>
  198. </div>
  199. </form>
  200. </div>
  201. <script>
  202. //JavaScript代码区域
  203. layui.use('element', function(){
  204. var element = layui.element;
  205. });
  206. document.getElementById("a_1022389289833586688").click();
  207. $('#a_1022389289833586688').parent().addClass('layui-this');
  208. //动态设定iframe高度
  209. var hAll = $(".layui-body").height();
  210. var hTop = $(".top_title").outerHeight(true);
  211. // $("#myFrame").css("height",hAll-hTop-3);
  212. var layerIndex = '';
  213. var show_num = [];
  214. layui.use(['layer','form'], function(){
  215. var layer = layui.layer;
  216. var form = layui.form;
  217. form.verify({
  218. pwd: [
  219. /^.*(?=.{8,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@_]).*$/,
  220. '密码不符合规则!'
  221. ],
  222. same: function(value, item){
  223. if(value != $('#firstPwd').val()){
  224. return '两次输入的密码不相同,请检查后重新输入。';
  225. }
  226. },
  227. });
  228. form.on('submit(pwdForm)', function(data){
  229. $.post("${ctx}/sys/index/edit-password", data.field, function(res){
  230. res = JSON.parse(res);
  231. js.showMessage(res.message);
  232. if(res.result == Global.TRUE){
  233. window.location.href = "${ctx}/logout";
  234. }
  235. });
  236. return false;
  237. });
  238. $('#editPwd').off('click').on('click',function(){
  239. layerIndex = layer.open({
  240. type: 1
  241. ,title: false
  242. ,area: ['550px', '290px']
  243. ,shade: 0.5
  244. ,maxmin: false
  245. ,scrollbar: false
  246. ,closeBtn: 0
  247. ,content: $('#edit_password_layer')
  248. });
  249. $("#validCode").focus();
  250. });
  251. $('#cancel').click(function(){
  252. $('#oldPwd').val('');
  253. $('#firstPwd').val('');
  254. $('#secondPwd').val('');
  255. layer.close(layerIndex);
  256. });
  257. $(".layui_header_close").on('click',function(){
  258. $('#oldPwd').val('');
  259. $('#firstPwd').val('');
  260. $('#secondPwd').val('');
  261. layer.close(layerIndex);
  262. });
  263. });
  264. $("#canvas").on('click', function () {
  265. draw(show_num);
  266. })
  267. //改变密码框的显示与隐藏
  268. $(".do-icon").off('click').on('click',function(){
  269. if( $(this).hasClass("eye-show") ){
  270. $(this).removeClass("eye-show")
  271. .addClass("eye-close")
  272. .siblings("input").attr("type","text");
  273. }else if( $(this).hasClass("eye-close") ){
  274. $(this).removeClass("eye-close")
  275. .addClass("eye-show")
  276. .siblings("input").attr("type","password");
  277. }
  278. })
  279. <!--获取用户信息来判断账号类型,以及是否提示用户去修改密码-->
  280. var getUsername = function(){
  281. var password = window.localStorage.getItem("password");
  282. if( password == "123456" ){
  283. layerIndex = layer.open({
  284. type: 1
  285. ,title: false
  286. ,area: ['550px', '290px']
  287. ,shade: 0.5
  288. ,maxmin: false
  289. ,scrollbar: false
  290. ,closeBtn: 0
  291. ,content: $('#edit_password_layer')
  292. });
  293. }
  294. }();
  295. <!--清空input框-->
  296. $("input").focus(function(){
  297. $(this).parent().children(".reset_input").show();
  298. });
  299. $("input").blur(function(){
  300. if($(this).val()=='')
  301. {
  302. $(this).parent().children(".reset_input").hide();
  303. }
  304. });
  305. $(".reset_input").click(function(){
  306. $(this).parent().find('input').val('');
  307. $(this).hide();
  308. });
  309. $(".layui-logo").click(function(){
  310. window.location.reload();
  311. });
  312. $("#msg_center").click(function(){
  313. $(".top_title").hide();
  314. $(".layui-side").hide();
  315. $(".layui-body").css("left","0px");
  316. $("#title_extend").show();
  317. openPage("消息中心", "${ctx}/sys/message/list", 1);
  318. });
  319. // var audioDom = new Audio("${ctxStatic}/audio/baojing2.mp3");
  320. function getMsg(){
  321. $.get("${ctx}/sys/message/query-new-msg", function(result){
  322. var unreadNum = result.data.unreadNum;
  323. var msgList = result.data.newMsg == undefined ? 0 : result.data.newMsg;
  324. var deg = result.data.deg;
  325. <!--更新未读消息角标-->
  326. if(unreadNum > 0) {
  327. $(".default_notice").hide();
  328. $(".new_notice").show();
  329. } else {
  330. $(".default_notice").show();
  331. $(".new_notice").hide();
  332. }
  333. <!--新消息弹框-->
  334. for(var i=0; i<msgList.length; i++){
  335. layer.msg(msgList[i].msgContentEntity.content, {
  336. icon: 6
  337. });
  338. }
  339. if (deg) {
  340. openErrorModal("异常提醒",deg.occurTime+":"+deg.deviceId+" "+deg.deviceEventType.name+(deg.memo?"("+deg.memo+")":""));
  341. //audioDom.setAttribute("loop", true);
  342. //audioDom.play();
  343. setTimeout(function (){
  344. // audioDom.setAttribute("loop", false);
  345. // audioDom.pause();
  346. }, 8000)
  347. }
  348. });
  349. }
  350. function updateToRead(id){
  351. js.ajaxSubmit(
  352. '${ctx}/sys/message/read-msg',
  353. {
  354. "msgId":id,
  355. },
  356. function(res){
  357. js.showMessage(res.message);
  358. }
  359. );
  360. }
  361. getMsg();
  362. var ref = setInterval(function(){
  363. getMsg();
  364. },10000);
  365. var id = null;
  366. /*function myModal() {
  367. /!*$.ajax("/console/sys/gateEvent/fetchData",{
  368. method:"get", async:false, data:{id:id}, dataType:"json", success:function (data){
  369. console.log(data);
  370. }
  371. })
  372. return;
  373. *!/
  374. if (modalFlag>0) {
  375. layer.close(modalFlag);
  376. }
  377. /!*var d = new Date();
  378. var n = d.getHours();*!/
  379. openErrorModal("异常提醒",dateFormat("YYYY-mm-dd HH:MM:SS", new Date())+":GATE003 异常闯入;");
  380. }
  381. setInterval(myModal, 5000);*/
  382. var modalFlag = 0;
  383. function openErrorModal(title, content){
  384. modalFlag = layer.open({
  385. type: 0,
  386. title: title,
  387. closeBtn: 0, //不显示关闭按钮
  388. shade: [0],
  389. btn:["查看详情",'关闭'],
  390. shadeClose:true,
  391. area: ['340px', '160px'],
  392. offset: 'rb', //右下角弹出
  393. time: 0, //2秒后自动关闭
  394. anim: 2,
  395. skin:"layui-layer-molv",
  396. yes:function(adjustPage,layero){ //yes对应第一个按钮“确定”
  397. //do something
  398. //添加完毕,关闭当前页面
  399. /*window.location.href="/console/sys/gateEvent/list"
  400. openPage("消息中心", "${ctx}/sys/gateEvent/list", 1);*/
  401. // audioDom.pause();
  402. layer.closeAll();
  403. layer.open({
  404. type: 2,
  405. title: '设备日志',
  406. shadeClose: true,
  407. shade: false,
  408. maxmin: true, //开启最大化最小化按钮
  409. area: ['100%', '100%'],
  410. content: '${ctx}/sys/gateEvent/list', //最大化页面
  411. success: function(layero,index){
  412. //在回调方法中的第2个参数“index”表示的是当前弹窗的索引。
  413. //通过layer.full方法将窗口放大。
  414. layer.full(index);
  415. }
  416. });
  417. },
  418. btn2:function(){
  419. // audioDom.pause();
  420. },
  421. content: '<div style="margin-right: 10px;color: red;"><p>'+content+'</p></div>', //iframe的url,no代表不显示滚动条 右下角页面
  422. });
  423. }
  424. </script>