解决编目系统偶尔因notice.js的原因加载失败问题

master
guoxin 1 year ago
parent 699973e3cd
commit 54cea26eb0
  1. 16
      shandan-bianmu/src/main/resources/static/js/index.js
  2. 3
      shandan-bianmu/src/main/resources/view/index.html
  3. 5
      shandan-system/src/main/resources/static/js/sys/notification/notification.js
  4. 2
      shandan-system/src/main/resources/view/sys/notification/notification.html

@ -1,15 +1,11 @@
layui.extend({
notification: `{/}${ctx}/js/sys/notification/notification` // {/}的意思即代表采用自有路径,即不跟随 base 路径
})
layui.use(['element', 'flow', 'util', 'notification'], function () {
layui.use(['element', 'flow', 'util'], function () {
let element = layui.element;
//setTimeout(()=>{
window.NotificationUtil = layui.notification.init();
setTimeout(()=>{
window.NotificationUtil = notification.init();
// 轮询查询系统未读通知
NotificationUtil.getUnreadNotifications();
//},1500)
},1500)
// 右侧用户导航栏不显示点击状态样式
element.on('nav(user-nav)', function(elem){
$('#user-nav li').removeClass('layui-this')
@ -65,7 +61,7 @@ layui.use(['element', 'flow', 'util', 'notification'], function () {
* 水平导航栏默认点击第一个
*/
const navbarInit = function () {
$("#navbar-top li:first a:first").click();
}
/**
@ -129,7 +125,7 @@ layui.use(['element', 'flow', 'util', 'notification'], function () {
window.onresize = function (ev) {
$(".tab-content-div").css("height", $(".layui-body")[0].offsetHeight + "px");
}
navbarInit();
$("#navbar-top li:first a:first").click();
})

@ -9,7 +9,6 @@
<!-- 引入公用部分 -->
<script th:replace="common/head::static"></script>
<!--<script th:src="@{/js/sys/notification/notification.js}"></script>-->
<script th:src="@{/js/index.js}"></script>
</head>
<body>
<div class="layui-layout layui-layout-admin">
@ -64,6 +63,8 @@
</div>
</div>
<script th:replace="common/head::static-foot"></script>
<script th:src="@{/js/sys/notification/notification.js}"></script>
<script th:src="@{/js/index.js}"></script>
<!-- th:inLine="javascript" 声明以下javascript代码可处理Thymeleaf脚本 -->
<script th:inline="javascript">
const menuList = [[${menuList}]];

@ -6,6 +6,7 @@
* @author GuoXin
* @since 2021/6/11
*/
let notification;
layui.define(['notice', 'jquery', 'layer'], function (exports) {
var notice = layui.notice;
@ -221,7 +222,7 @@ layui.define(['notice', 'jquery', 'layer'], function (exports) {
let NotificationUtil;
const _exports = {
notification = {
init: function () {
let user = sessionStorage.getItem('login_user');
if(user && user.indexOf('{') === 0){
@ -234,5 +235,5 @@ layui.define(['notice', 'jquery', 'layer'], function (exports) {
}
}
}
exports('notification', _exports);
exports('notification', notification);
});

@ -5,7 +5,6 @@
<head>
<!-- 引入公用部分 -->
<script th:replace="common/head::static"></script>
<script th:src="@{/js/sys/notification/notification.js}"></script>
<!-- 样式 -->
<link th:href="@{/css/common/contianer.css}" rel="stylesheet" type="text/css"/>
<style>
@ -36,6 +35,7 @@
</body>
<!-- js -->
<script th:replace="common/head::static-foot"></script>
<script th:src="@{/js/sys/notification/notification.js}"></script>
<!--<script th:src="@{/js/business/review/review.js}"></script>-->
<script>
const sizeInit = () => {