From ab06d9cf8df9fda6f3a26eda46853cbddb4816e2 Mon Sep 17 00:00:00 2001 From: zk <zk@honggroup.com.cn> Date: Wed, 14 Dec 2022 14:08:45 +0800 Subject: [PATCH] 当时永久登录用户时,自动刷新首页优化 --- hg-monitor-web-base/src/main/resources/static/src/controller/main-biz-card.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/hg-monitor-web-base/src/main/resources/static/src/controller/main-biz-card.js b/hg-monitor-web-base/src/main/resources/static/src/controller/main-biz-card.js index bec2d2c..5667dff 100644 --- a/hg-monitor-web-base/src/main/resources/static/src/controller/main-biz-card.js +++ b/hg-monitor-web-base/src/main/resources/static/src/controller/main-biz-card.js @@ -2034,14 +2034,29 @@ layui.define(['common', 'swiper', 'admin', 'commonDetail', 'mxClient', 'sessions type: "get", success: function (res) { if (res.success) { - var lgn = localStorage.getItem("lgn"); - if (res.str && res.str.indexOf(lgn) != -1) { - refresh(); + if (res.str && res.str.length>0) { + var lgn = localStorage.getItem("lgn"); + var userNames = res.str.split(","); + if (isStrInArray(lgn,userNames)){ //当当前用户是配置的永久登录用户时,进行首页自动刷新 + refresh(); + } } } } }); } + /** + * 判定数组包含指定字符串 + * */ + function isStrInArray(str, arr) { + let n = arr.length; + for (let i = 0; i < n; i++) { + if (arr[i] == str) { + return true; + } + } + return false; + } function refresh(){ setInterval(function (){ loadBizInfo(); -- libgit2 0.24.0