Showing
2 changed files
with
24 additions
and
20 deletions
@@ -265,7 +265,8 @@ layui.define(['laytpl', 'layer'], function (exports) { | @@ -265,7 +265,8 @@ layui.define(['laytpl', 'layer'], function (exports) { | ||
265 | if (that.render.isError) { | 265 | if (that.render.isError) { |
266 | return view.error('请求视图文件异常,状态:' + e.status); | 266 | return view.error('请求视图文件异常,状态:' + e.status); |
267 | } | 267 | } |
268 | - | 268 | + // render中报错,防止出现死循环 |
269 | + that.render.isError = true; | ||
269 | if (e.status === 404) { | 270 | if (e.status === 404) { |
270 | if (!localStorage.getItem('access_token')) { | 271 | if (!localStorage.getItem('access_token')) { |
271 | layer.msg("登录凭证失效,请重新登录验证!", { | 272 | layer.msg("登录凭证失效,请重新登录验证!", { |
@@ -280,7 +281,7 @@ layui.define(['laytpl', 'layer'], function (exports) { | @@ -280,7 +281,7 @@ layui.define(['laytpl', 'layer'], function (exports) { | ||
280 | that.render('template/tips/error'); | 281 | that.render('template/tips/error'); |
281 | } | 282 | } |
282 | 283 | ||
283 | - that.render.isError = true; | 284 | + |
284 | } | 285 | } |
285 | }); | 286 | }); |
286 | return that; | 287 | return that; |
@@ -24,6 +24,14 @@ layui.define(['element', 'admin', 'view'], function (exports) { | @@ -24,6 +24,14 @@ layui.define(['element', 'admin', 'view'], function (exports) { | ||
24 | * hash变更 | 24 | * hash变更 |
25 | */ | 25 | */ |
26 | hashChane: function () { | 26 | hashChane: function () { |
27 | + | ||
28 | + var that = this; | ||
29 | + | ||
30 | + window.onload = function (){ | ||
31 | + // 绑定事件 | ||
32 | + that.bindElemClickEvent(); | ||
33 | + } | ||
34 | + | ||
27 | // debugger | 35 | // debugger |
28 | var hash = window.top.location.hash; | 36 | var hash = window.top.location.hash; |
29 | sessionStorage.setItem("pagePath", hash); | 37 | sessionStorage.setItem("pagePath", hash); |
@@ -82,14 +90,6 @@ layui.define(['element', 'admin', 'view'], function (exports) { | @@ -82,14 +90,6 @@ layui.define(['element', 'admin', 'view'], function (exports) { | ||
82 | }, | 90 | }, |
83 | 91 | ||
84 | ajaxSetupInit: function () { | 92 | ajaxSetupInit: function () { |
85 | - let that = this; | ||
86 | - setTimeout(function () { | ||
87 | - // 绑定菜单点击事件 | ||
88 | - that.bindMenuClickEvent(); | ||
89 | - // 绑定元素点击事件 | ||
90 | - that.bindElemClickEvent(); | ||
91 | - console.log("日志事件注册完成!") | ||
92 | - }, 500) | ||
93 | 93 | ||
94 | // sessionStorage.setItem("batchNo", ""); | 94 | // sessionStorage.setItem("batchNo", ""); |
95 | // sessionStorage.setItem("groupId", ""); | 95 | // sessionStorage.setItem("groupId", ""); |
@@ -145,13 +145,13 @@ layui.define(['element', 'admin', 'view'], function (exports) { | @@ -145,13 +145,13 @@ layui.define(['element', 'admin', 'view'], function (exports) { | ||
145 | var that = this; | 145 | var that = this; |
146 | 146 | ||
147 | // 绑定菜单事件 | 147 | // 绑定菜单事件 |
148 | - // setTimeout(function () { | ||
149 | - // // 绑定菜单点击事件 | ||
150 | - // that.bindMenuClickEvent(); | ||
151 | - // // 绑定元素点击事件 | ||
152 | - // that.bindElemClickEvent(); | 148 | + setTimeout(function () { |
149 | + // 绑定菜单点击事件 | ||
150 | + that.bindMenuClickEvent(); | ||
151 | + // 绑定元素点击事件 | ||
152 | + that.bindElemClickEvent(); | ||
153 | // console.log("日志事件注册完成!") | 153 | // console.log("日志事件注册完成!") |
154 | - // }, 500) | 154 | + }, 500) |
155 | 155 | ||
156 | //lsq给带有title的元素绑定点击事件复制元素内容 2022-09-05 | 156 | //lsq给带有title的元素绑定点击事件复制元素内容 2022-09-05 |
157 | that.copyTitle(); | 157 | that.copyTitle(); |
@@ -290,6 +290,10 @@ layui.define(['element', 'admin', 'view'], function (exports) { | @@ -290,6 +290,10 @@ layui.define(['element', 'admin', 'view'], function (exports) { | ||
290 | } | 290 | } |
291 | //菜单点击传入属性lay-href的值,普通元素传入当前页面路由 | 291 | //菜单点击传入属性lay-href的值,普通元素传入当前页面路由 |
292 | if (flg) { | 292 | if (flg) { |
293 | + // 清空按钮名称 | ||
294 | + sessionStorage.setItem("buttonPath", ""); | ||
295 | + sessionStorage.setItem("buttonName", ""); | ||
296 | + | ||
293 | //that.sendAjaxData(layHref, text) | 297 | //that.sendAjaxData(layHref, text) |
294 | sessionStorage.setItem("menuName", text); | 298 | sessionStorage.setItem("menuName", text); |
295 | sessionStorage.setItem("menuPath", layHref); | 299 | sessionStorage.setItem("menuPath", layHref); |
@@ -312,7 +316,6 @@ layui.define(['element', 'admin', 'view'], function (exports) { | @@ -312,7 +316,6 @@ layui.define(['element', 'admin', 'view'], function (exports) { | ||
312 | */ | 316 | */ |
313 | clickEventHandle(thisObj, key) { | 317 | clickEventHandle(thisObj, key) { |
314 | let that = this; | 318 | let that = this; |
315 | -// debugger | ||
316 | sessionStorage.setItem("groupId",window.generateUUID().replace(/-/g, "")); | 319 | sessionStorage.setItem("groupId",window.generateUUID().replace(/-/g, "")); |
317 | 320 | ||
318 | let layHref = thisObj.attr('lay-href') ? thisObj.attr('lay-href') : ''; | 321 | let layHref = thisObj.attr('lay-href') ? thisObj.attr('lay-href') : ''; |
@@ -357,12 +360,12 @@ layui.define(['element', 'admin', 'view'], function (exports) { | @@ -357,12 +360,12 @@ layui.define(['element', 'admin', 'view'], function (exports) { | ||
357 | // })) | 360 | // })) |
358 | // } | 361 | // } |
359 | setTimeout(function (){ | 362 | setTimeout(function (){ |
360 | - console.log(`${item}元素点击事件绑定完成!`) | 363 | + // console.log(`${item}元素点击事件绑定完成!`) |
361 | $(item).unbind('click.handle').on('click.handle', (function (e) { | 364 | $(item).unbind('click.handle').on('click.handle', (function (e) { |
362 | e.preventDefault(); | 365 | e.preventDefault(); |
363 | that.clickEventHandle($(this), item) | 366 | that.clickEventHandle($(this), item) |
364 | })) | 367 | })) |
365 | - },300) | 368 | + },500) |
366 | }) | 369 | }) |
367 | }, | 370 | }, |
368 | /** | 371 | /** |
@@ -425,7 +428,7 @@ layui.define(['element', 'admin', 'view'], function (exports) { | @@ -425,7 +428,7 @@ layui.define(['element', 'admin', 'view'], function (exports) { | ||
425 | if (val.indexOf('el::') != -1) { | 428 | if (val.indexOf('el::') != -1) { |
426 | let elName = val.replace('el::', ''); | 429 | let elName = val.replace('el::', ''); |
427 | bindContextEvent(elName, 0); | 430 | bindContextEvent(elName, 0); |
428 | - console.log(`${elName}元素右键提示绑定完成!`) | 431 | + // console.log(`${elName}元素右键提示绑定完成!`) |
429 | } | 432 | } |
430 | }) | 433 | }) |
431 | }, 300) | 434 | }, 300) |
-
Please register or login to post a comment