修改首页

This commit is contained in:
haozq 2024-12-16 14:45:26 +08:00
parent 09d6af2ad1
commit 3ac2864d94
2 changed files with 83 additions and 15 deletions

View File

@ -2,7 +2,7 @@
layui.use(['element'], function () {
var element = layui.element;
getLogErr();
//侧边栏点击事件监听
element.on('nav(test)', function(elem){
console.log(elem); //得到当前点击的DOM对象
@ -20,8 +20,70 @@ layui.use(['element'], function () {
}
});
});
//查询日志数据
function getLogErr(){
$.ajax({
headers: {
Authorization: token
},
type: "post",
url: dataUrl + 'system/sys/logs/logWarn',
data: {},
async: false,
success: function (result) {
console.log(result);
if(result.code==200){
if(result.data.warnType==1){
openAlter('日志容量告警',result.data.warnError);
}
if(result.data.logWarn==1){
openAlter('异常告警',result.data.err);
}
}
}
});
}
function openAlter(title,msg){
layer.open({
type: 1 //此处以iframe举例
,title:title
,area: ['390px', '260px']
,shade: 0
,maxmin: true
,content: '<div style="padding: 15px;color:red;">'+ msg + '</div>'
,btn: ['关闭'] //只是为了演示
,yes: function(index,layeo){
console.log(1)
layer.close(index);
} ,btn2: function(){
layer.close();
}
,zIndex: layer.zIndex //重点1
,success: function(layero, index){
layer.setTop(layero); //重点2. 保持选中窗口置顶
//记录索引,以便按 esc 键关闭。事件见代码最末尾处。
layer.escIndex = layer.escIndex || [];
layer.escIndex.unshift(index);
//选中当前层时,将当前层索引放置在首位
layero.on('mousedown', function(){
var _index = layer.escIndex.indexOf(index);
if(_index !== -1){
layer.escIndex.splice(_index, 1); //删除原有索引
}
layer.escIndex.unshift(index); //将索引插入到数组首位
});
}
,end: function(){
//更新索引
if(typeof layer.escIndex === 'object'){
layer.escIndex.splice(0, 1);
}
}
});
}

View File

@ -3,7 +3,10 @@ var indexUrl = "";
let inde1url = '../compreDisplay/compreDisplay.html';
let inde2url = '../compreDisplay/cityHome.html';
let inde3url = '../compreDisplay/dutyHome.html';
let indexAllUrl=[ '../compreDisplay/compreDisplay.html','../compreDisplay/cityHome.html',
'../compreDisplay/dutyHome.html','../base/log/logManage.html']
let indexTwoUrl=['../compreDisplay/cityHome.html','../compreDisplay/dutyHome.html']
let cssUrl=[ '../compreDisplay/compreDisplay.html','../compreDisplay/cityHome.html','../compreDisplay/dutyHome.html'];
layui.use(['layer', 'form', 'element'], function () {
var $ = layui.jquery;
element = layui.element;
@ -27,10 +30,10 @@ layui.use(['layer', 'form', 'element'], function () {
// $('#iframeMain').attr('src', '../compreDisplay/compreDisplay.html');
var user = JSON.parse((us));
// getWzXx(user.orgId);
getMarqueeData();
// getMarqueeData();
window.setTimeout(function () {
// getWzXx(user.orgId);
getMarqueeData();
// getMarqueeData();
}, 6000 * 3);
// if (user.isSup != 3) {
@ -65,17 +68,20 @@ layui.use(['layer', 'form', 'element'], function () {
})
$(this).parents('.layui-nav-child').removeClass('layui-show');
$(this).parents('.layui-nav-item').addClass('layui-that');
console.log($(this).attr("href"));
let indexUrls = $(this).attr("href");
if (indexUrls == inde1url || indexUrls == inde2url || indexUrls == inde3url) {
if (indexUrls == inde2url || indexUrls == inde3url) {//地市+值长
if (indexAllUrl.includes(indexUrls)) {
if (indexTwoUrl.includes(indexUrls)) {//地市+值长
$('#html').css("background", 'url("../../img/cityHome/city_home_back.png") no-repeat 0 0 / 100% 100% transparent');
} else if (indexUrls == inde1url) {
$('#html').css("background", 'url("../../img/back.png") no-repeat 0 0 / 100% 100% transparent');
}
}else{
$('#html').css("background", 'url("../../img/cityHome/city_home_back.png") no-repeat 0 0 / 100% 100% transparent');
}
$("#ifr-box ").css("background-image", "");
$('#indexIframe').attr('src', indexUrls);
if(!cssUrl.includes(indexUrls)){
$('#ifr-box').css('margin-top', '5px');
}
$("#indexIframe").show();
$("#layui-tab").hide();
} else {
@ -124,8 +130,8 @@ layui.use(['layer', 'form', 'element'], function () {
$(".layui-nav-item").each(function () {
$(this).removeClass('layui-that');
$(this).removeClass('layui-this');
console.log($(this).text());
console.log($(this).attr("idx"))
if ($(this).text() == '综合展示' && imea == 0) {
$(this).addClass('layui-that');
$(this).addClass('layui-this');
@ -197,7 +203,8 @@ function initMenu() {
var ind = j + 1;
dd += "<dd><a href='" + childer[j].url + "' idx='" + childer[j].menuId + "' index='" + ind + "' >" + childer[j].menuName + "</a></dd>"
if (j == 0) {
console.log(childer[j].url)
if (childer[j].ur != '../compreDisplay/compreDisplay.html') {
$('#indexIframe').css("margin-top", "50px");
$('#indexIframe').css("height", "96.03%");
@ -307,7 +314,6 @@ function gotofx() {
}
function getIsBg(orgId) {
console.log("orgId==" + orgId)
$.ajax({
url: dataUrl + 'proteam/pot/home/getIsBg?token=' + token,
headers: {
@ -319,7 +325,7 @@ function getIsBg(orgId) {
type: 'post',
async: true,
success: function (result) {
console.log(result);
if (result.data < 1) {//为报岗则进行报岗
openBg();
}