cc-jjsp-web/bns/js/home/home.js

797 lines
30 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var element, form;
var indexUrl = "";
let inde1url = '../compreDisplay/compreDisplay.html';
let inde2url = '../compreDisplay/cityHome.html';
let inde3url = '../compreDisplay/dutyHome.html';
let isClose=false;
let kjIdx = 199999; // 课件学习索引
let bgStatus = "no-need"; // 报岗状态 need需要报岗 no-need 不需要报岗
let layerIndex222 = null;
layui.use(['layer', 'form', 'element'], function () {
var $ = layui.jquery;
element = layui.element;
form = layui.form;
var user = JSON.parse(decrypt(us));
console.log(user)
// 审计日志定时查询
/*capacityTips()
setInterval( async function () {
capacityTips()
}, 1*60*60*1000);
*/
initMenu();//初始化菜单
element.render();//渲染
form.on('submit(formData)', function (data) {
submitData(data);
});
form.on('submit(formDatas)', function (data) {
bgData(data);
});
// 顶部父菜单点击:先统一清除选中态,再按业务处理
try {
$(document).on('click', '.layui-nav>.layui-nav-item>a', function (e) {
// 统一清除与设置选中态,避免多项同时高亮
$('ul li').removeClass('layui-that layui-this');
$(this).parent().addClass('layui-that');
var txt = $.trim($(this).text());
if (txt === '安全管控') {
e.preventDefault();
$("#ifr-box ").css("background-image", "");
$('#indexIframe').attr('src', inde1url);
$("#indexIframe").show();
$("#layui-tab").hide();
return false;
}
});
} catch (err) {}
// 默认首页:进入系统直接展示综合展示页
try {
$('#html').css("background", 'url("../../img/back-gs.png") no-repeat 0 0 / 100% 100% transparent');
$("#ifr-box ").css("background-image", "");
$('#indexIframe').attr('src', inde1url); // ../compreDisplay/compreDisplay.html
$("#indexIframe").show();
$("#layui-tab").hide();
} catch(e) {}
initUserExam(user.userId);
getWzXx(user.orgId);
window.setTimeout(function () {
getWzXx(user.orgId);
}, 6000 * 5);
if (user.isSup != 3) {
$("#dtaxt").css("display", "none");
}
if (user.isSup == 3) {
getIsBg(user.orgId);
}
var org = user.unitName;
if (typeof (org) == "undefined") {
org = "建设分公司";
}
$("#use-org").text(user.roleName + "/" + org);
$("#dtaxt").click(function (e) {
openNewTab('../dutyTask/violationStatistics.html','19','违章管理')
})
//点击事件(兼容 mega menu 内链接)
$("dd>a,li>a,.mega-list a,.group-list a,.sub-list a").click(function (e) {
// 禁止点击:父级且无可跳转地址
var hrefVal = $(this).attr('href');
var isDisabledParent = $(this).hasClass('disabled-parent') || hrefVal === 'javascript:;' || hrefVal === './' || hrefVal === '' || hrefVal == null || hrefVal == undefined;
if (isDisabledParent) {
e.preventDefault();
return;
}
var isFromMega = $(this).closest('.mega-menu').length > 0;
// 特殊:点击顶级“安全管控”或以“安全”开头的菜单,无论是否有下拉,均直接展示综合展示页
var textLabel = $(this).text().trim();
if (!isFromMega && (textLabel === '安全管控' || textLabel.indexOf('安全') === 0)) {
try {
$("#ifr-box ").css("background-image", "");
$('#indexIframe').attr('src', inde1url);
$("#indexIframe").show();
$("#layui-tab").hide();
// 顶部菜单选中态
$('ul li').removeClass('layui-that layui-this');
$(this).parents('.layui-nav-item').addClass('layui-that');
} catch(err){}
e.preventDefault();
return;
}
// 设置子菜单选中样式
if (isFromMega) {
// 子菜单高亮
$(".mega-list a, .group-list a, .sub-list a").removeClass('active');
$(this).addClass('active');
}
if ($(this).next('dl').length === 0) {
e.preventDefault();
$('ul li').each(function () {
if ($(this).hasClass('layui-that') || $(this).hasClass('layui-this')) {
$(this).removeClass('layui-that')
$(this).removeClass('layui-this')
}
})
if ($(this).parents('.layui-nav-child').length > 0) {
$(this).parents('.layui-nav-child').removeClass('layui-show');
}
$(this).parents('.layui-nav-item').addClass('layui-that');
console.log($(this).attr("href"));
// 特殊mega 内部“安全*”也跳转到综合展示页
var menuText = $(this).text().trim();
if (menuText === '安全管控' || menuText.indexOf('安全') === 0) {
$(this).attr('href', inde1url);
}
let indexUrls = $(this).attr("href");
if (indexUrls == inde1url || indexUrls == inde2url || indexUrls == inde3url) {
if (indexUrls == inde2url || indexUrls == inde3url) {//地市+值长
$('#html').css("background", 'url("../../img/cityHome/city_home_back_gs.png") no-repeat 0 0 / 100% 100% transparent');
} else if (indexUrls == inde1url) {
$('#html').css("background", 'url("../../img/back-gs.png") no-repeat 0 0 / 100% 100% transparent');
}
$("#ifr-box ").css("background-image", "");
$('#indexIframe').attr('src', indexUrls);
$("#indexIframe").show();
$("#layui-tab").hide();
} else {
if ($(".layui-tab-title li[lay-id='" + $(this).attr('idx') + "']").length > 0) {
$("#ifr-box ").css("background-image", "url('../../img/tableback.jpg')");
$("#indexIframe").hide();
$("#layui-tab").show();
element.tabChange('menu-tab', $(this).attr('idx'));
} else {
$("#indexIframe").hide();
element.tabAdd('menu-tab', {
title: $(this).text(),
content: "<iframe id='iframeMain' width='100%' height='100%' frameborder='0' src='" + $(this).attr('href') + "' class='layadmin-iframe' ></iframe>"
, id: $(this).attr('idx')
})
$("#ifr-box ").css("background-image", "url('../../img/tableback.jpg')");
$("#layui-tab").show();
element.tabChange('menu-tab', $(this).attr('idx'));
}
var tabr = $(".layui-tab-title").find("li");
let close = tabr.eq(tabr.length - 1).children("i");
close.on('click', function (e) {
//绑定关闭事件
})
}
//关闭事件监听
$(".layui-tab-close").click(function (e) {
var tabr = $(".layui-tab-title").find("li");
var length = tabr.length;
if (length == 0) {//全部关闭了则返回首页
$("#menu-childer").empty();
$("#indexIframe").show();
$("#menu-content").empty();
$("#layui-tab").hide();
$("#ifr-box ").css("background-image", "");
let nowsrc = $('#indexIframe').attr("src");
let imea = "0";
if (nowsrc == inde1url) {//综合暂时
imea = "0";
} else if (nowsrc == inde2url) {//地市首页
imea = "0";
} else if (nowsrc == inde3url) {//地市首页
imea = "0";
}
$(".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');
} else if ($(this).text().indexOf('首页') != '-1' && imea == 1) {
$(this).addClass('layui-that');
$(this).addClass('layui-this');
} else if ($(this).text().indexOf('值长') != '-1' && imea == 2) {
$(this).addClass('layui-that');
$(this).addClass('layui-this');
}
})
}
})
}
// 再次联动父菜单高亮,避免被上面的清除覆盖
if (isFromMega) {
var parentMenuId2 = $(this).closest('.mega-menu').attr('id');
if (parentMenuId2 && parentMenuId2.indexOf('mega-') === 0) {
var pid2 = parentMenuId2.replace('mega-', '');
$("#menu-title .layui-nav-item[idx='" + pid2 + "']").addClass('layui-that layui-this');
}
}
$(".mega-menu").removeClass('show');
});
//$("#layui-tab-title").niceScroll({cursorborder:"",cursorcolor:"#c0c4cc",boxzoom:true});
})
/**
* 初始化菜单
*/
function initMenu() {
var user = JSON.parse(decrypt(us));
var menus = user.menus;
console.log(menus);
if (menus.length > 0 && menus != '[]') {
var num = 0;
var allMenus = "";
var userMenus = "";
let maxMenu=[];
var ul = '<ul class="layui-nav layout" style="width: 100%" >'
let menNums=0;
var megaPanels = ""; // 收集 mega menu 面板
for (let i = 0; i < menus.length; i++) {
var url = menus[i].url;//路径
var menuName = menus[i].menuName;//名称
var childer = menus[i].childer;
var id = menus[i].menuId;
var homeMenu = "";
var usermenu = "";
var isLast = menus[i].last;
if (!isLast) {//默认复制
url = 'javascript:;';
}
if (menuName == '系统管理') {
var dl = "";
var um = ' <button href="javascript:;" style="margin-top: 12px" class="sys-mge-btn common-btn" title="系统管理" ></button>';
if (childer != null && childer.length > 0) {
dl1 = '<dl class="layui-nav-child ">';
var dd = "";
for (let j = 0; j < childer.length; j++) {
dd += "<dd><a index='2' idx='" + childer[j].menuId + "' href='" + childer[j].url + "' >" + childer[j].menuName + "</a></dd>"
}
var dl2 = "</dl>"
dl += dl1 + dd + dl2;
}
usermenu = um + dl;
} else {
menNums++;
if (num == 0) {//
var width = 'width:' + menuName.length * 20 + 'px;';
var li = "<li class='layui-nav-item layui-this' idx='" + id + "' style='margin-right: 5px;'>" +
"<a href='" + url + "' index='1' idx='" + id + "' style='" + width + "' " + (!isLast ? "class='disabled-parent'" : "") + ">" + menuName + "</a>";
if (!isLast) {
if (childer != null && childer.length > 0) {
megaPanels += buildMegaPanel(id, childer, menuName);
}
} else {
indexUrl = url;
$('#indexIframe').attr('src', url);
if (url == inde2url || url == inde3url) {
$('#html').css("background", 'url("../../img/cityHome/city_home_back_gs.png") no-repeat 0 0 / 100% 100% transparent');
}
}
homeMenu += li + "</li>";
} else {
if(menNums>=9){
maxMenu.push(menus[i]);
}else{
var width = menuName.length * 20 + 'px';
var margi = "";
if (menuName.length > 4) {
margi += 'margin-right:5px';
}
var li = "<li class='layui-nav-item ' idx='" + id + "' style='" + margi + "'>" +
"<a href='" + url + "' index='2' idx='" + id + "' style='width: " + width + "' " + (!isLast ? "class='disabled-parent'" : "") + ">" + menuName + "</a>";
if (!isLast) {
if (childer != null && childer.length > 0) {
megaPanels += buildMegaPanel(id, childer, menuName);
}
}
homeMenu += li + "</li>";
}
}
num++;
}
userMenus += usermenu;
allMenus += homeMenu;
}
if(maxMenu.length>0){
let maxdata=addMax(maxMenu);
allMenus += maxdata;
}
var dul = "</ul>"
$("#menu-title").empty();
$("#menu-title").append(ul + allMenus + dul + megaPanels);
$("#menu-user").empty();
$("#menu-user").append(userMenus);
// 绑定悬浮事件
bindMegaMenuEvents();
}
}
function addMax(maxMenu){
if(maxMenu.length==1){
for (var i = 0; i < maxMenu.length; i++) {
var url = maxMenu[i].url;//路径
var menuName = maxMenu[i].menuName;//名称
var childer = maxMenu[i].childer;
var id = maxMenu[i].menuId;
var homeMenu = "";
var usermenu = "";
var isLast = maxMenu[i].last;
if (!isLast) {//默认复制
url = 'javascript:;';
}
var width = menuName.length * 20 + 'px';
var margi = "";
if (menuName.length > 4) {
margi += 'margin-right:5px';
}
var li = "<li class='layui-nav-item ' style='" + margi + "'>" +
"<a href='" + url + "' index='2' idx='" + id + "' style='width: " + width + "'>" + menuName + "</a>";
if (!isLast) {
var dl = "";
if (childer != null && childer.length > 0) {
dl1 = '<dl class="layui-nav-child">';
var dd = ""
for (let j = 0; j < childer.length; j++) {
dd += "<dd><a index='2' idx='" + childer[j].menuId + "' href='" + childer[j].url + "'>" + childer[j].menuName + "</a></dd>"
}
var dl2 = "</dl>"
dl += dl1 + dd + dl2;
}
li += dl;
}
homeMenu += li + "</li>";
}
return homeMenu;
}else{
var width = '更多菜单'.length * 20 + 'px';
let allMenu="";
var li = "<li class='layui-nav-item '>" +
"<a href='javascript:;' index='2' idx='" + 116655 + "' style='width: " + width + "'>" + '更多菜单' + "</a>";
li+= '<dl class="layui-nav-child">';
let childDl="";
for (var i = 0; i < maxMenu.length; i++) {
var url = maxMenu[i].url;//路径
var menuName = maxMenu[i].menuName;//名称
var childer = maxMenu[i].childer;
var id = maxMenu[i].menuId;
var homeMenu = "";
var usermenu = "";
var isLast = maxMenu[i].last;
if (!isLast) {//默认复制
url = 'javascript:;';
}
var dd ="";
if (!isLast) {
if (childer != null && childer.length > 0) {
for (let j = 0; j < childer.length; j++) {
dd += "<dd><a index='2' idx='" + childer[j].menuId + "' href='" + childer[j].url + "'>" + childer[j].menuName + "</a></dd>"
}
}
}
//结束
childDl=childDl+dd;
}
li=li+childDl;
li=li + "</dl></li>";
console.log(li);
return li;
}
}
// 构建 mega menu 面板
function buildMegaPanel(parentId, childer, title){
var html = '';
html += '<div class="mega-menu" id="mega-' + parentId + '">';
html += '<div class="mega-row">';
// 单一容器,交给 CSS 多列在同一容器中换列
html += '<div class="mega-col"><div class="mega-col-inner">';
for (let i = 0; i < childer.length; i++) {
var child = childer[i];
if(child.menuName === '课件学习'){
kjIdx = child.menuId;
}
if (child.childer && child.childer.length > 0) {
html += '<div class="mega-group">';
html += '<div class="group-title"><span class="dot"></span>' + (child.menuName || '') + '</div>';
html += '<div class="group-list">';
for (let k = 0; k < child.childer.length; k++) {
var c = child.childer[k];
if (c.childer && c.childer.length > 0) {
html += '<div class="sub-group">';
html += '<div class="sub-title">' + (c.menuName || '') + '</div>';
html += '<div class="sub-list">';
for (let m = 0; m < c.childer.length; m++) {
var s = c.childer[m];
html += "<a href='" + (s.url || 'javascript:;') + "' idx='" + s.menuId + "'>" + (s.menuName || '') + "</a>";
}
html += '</div>';
html += '</div>';
} else {
html += "<a href='" + (c.url || 'javascript:;') + "' idx='" + c.menuId + "'>" + (c.menuName || '') + "</a>";
}
}
html += '</div>';
html += '</div>';
} else {
html += '<div class="mega-list">';
html += "<a href='" + (child.url || 'javascript:;') + "' idx='" + child.menuId + "'>" + (child.menuName || '') + "</a>";
html += '</div>';
}
}
html += '</div></div>';
html += '</div>';
html += '</div>';
return html;
}
// 绑定 mega menu 事件
function bindMegaMenuEvents() {
var hideTimer = null;
// 悬浮显示:父级菜单进入时显示对应面板,并清除隐藏定时器
$(document)
.off('mouseenter', '#menu-title .layui-nav-item')
.on('mouseenter', '#menu-title .layui-nav-item', function(){
if (hideTimer) { clearTimeout(hideTimer); hideTimer = null; }
var idx = $(this).attr('idx');
$(".mega-menu").removeClass('show');
if (idx) {
var megaPanel = $("#mega-"+idx);
if (megaPanel.length > 0) {
megaPanel.addClass('show');
}
}
})
// 父级菜单离开时,稍作延时隐藏,给鼠标移动到面板的时间
.off('mouseleave', '#menu-title .layui-nav-item')
.on('mouseleave', '#menu-title .layui-nav-item', function(){
if (hideTimer) { clearTimeout(hideTimer); }
hideTimer = setTimeout(function(){
$(".mega-menu").removeClass('show');
}, 160);
});
// 在 mega 面板上移动时保持显示;离开时再延时隐藏,避免抖动
$(document)
.off('mouseenter', '.mega-menu')
.on('mouseenter', '.mega-menu', function(){
if (hideTimer) { clearTimeout(hideTimer); hideTimer = null; }
$(this).addClass('show');
})
.off('mouseleave', '.mega-menu')
.on('mouseleave', '.mega-menu', function(){
if (hideTimer) { clearTimeout(hideTimer); }
var self = this;
hideTimer = setTimeout(function(){
$(self).removeClass('show');
}, 160);
});
}
/*日期动态展示*/
showTime();
setInterval("showTime()", 1000);//间隔多少毫秒执行一次
function showTime() {
let dateTime = new Date();
let year = dateTime.getFullYear(); //获取年份
let month = dateTime.getMonth() + 1; //获取月份
month = month < 10 ? "0" + month : month; //月份小于10则前面加个"0"
let date = dateTime.getDate(); //获取日
date = date < 10 ? "0" + date : date;
let hour = dateTime.getHours(); //获取小时
hour = hour < 10 ? "0" + hour : hour;
let minute = dateTime.getMinutes(); //获取分钟
minute = minute < 10 ? "0" + minute : minute;
let second = dateTime.getSeconds(); //获取秒
second = second < 10 ? "0" + second : second;
let day = dateTime.getDay()
//年月日时分秒赋值给dateTime
dateTime = year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
$('#currentTime').html(dateTime);
}
/**
* 退出登录
* 记录日志需要调用后端
*/
/*function logout() {
localStorage.setItem("tokens", "");
localStorage.setItem("us", "");
$.ajax({
url: dataUrl + 'auth/loginOut',
type: 'post',
beforeSend:function(xhr){
xhr.setRequestHeader("Authorization",token)
},
success: function (res) {
window.location.href = "../../../login.html";
}
});
}*/
//url
function gotofx() {
window.open(jj_jc_url);
}
function getIsBg(orgId) {
$.ajax({
url: dataUrl + 'proteam/pot/home/getIsBg?token=' + token,
headers: {
"encrypt": sm3(JSON.stringify({ orgId: orgId }))
},
data: {
orgId: orgId,
},
type: 'post',
async: true,
success: function (result) {
console.log(result);
bgStatus = result.data.isNeedBg;
if (result.data.num < 1) {//为报岗则进行报岗
openBg();
}
},
});
}
function getWzXx(orgId) {
$.ajax({
url: dataUrl + 'proteam/pot/home/getWzXx?token=' + token,
headers: {
"encrypt": sm3(JSON.stringify({ orgId: orgId }))
},
data: {
orgId: orgId,
},
type: 'post',
async: true,
success: function (result) {
if (result.data > 0) {
var text = "您有" + result.data + "条违章信息,请及时处理!";
$("#dtaxt").text(text);
if (user.isSup == 3) {
if(!isClose){
openWZInfo();
}
}
} else {
$("#dtaxt").empty();
}
},
});
}
function notice() {
if ($(".layui-tab-title li[lay-id='99999999999999']").length > 0) {
$("#ifr-box ").css("background-image", "url('../../img/tableback.jpg')");
$("#indexIframe").hide();
$("#layui-tab").show();
element.tabChange('menu-tab', '99999999999999');
} else {
$("#indexIframe").hide();
element.tabAdd('menu-tab', {
title: '消息通知',
content: "<iframe id='iframeMain' width='100%' height='100%' frameborder='0' src='../../html/notice/notice.html' class='layadmin-iframe' ></iframe>"
, id: '99999999999999'
})
$("#ifr-box ").css("background-image", "url('../../img/tableback.jpg')");
$("#layui-tab").show();
element.tabChange('menu-tab', '99999999999999');
//关闭事件监听
$(".layui-tab-close").click(function (e) {
let tabr = $(".layui-tab-title").find("li");
let length = tabr.length;
if (length === 0) {//全部关闭了则返回首页
$("#menu-childer").empty();
$("#indexIframe").show();
$("#menu-content").empty();
$("#layui-tab").hide();
$("#ifr-box ").css("background-image", "");
}
})
}
}
function openNewTab(url, id, title) {
if ($(".layui-tab-title li[lay-id='" + id + "']").length > 0) {
$("#ifr-box ").css("background-image", "url('../../img/tableback.jpg')");
$("#indexIframe").hide();
$("#layui-tab").show();
element.tabChange('menu-tab', id);
} else {
$("#indexIframe").hide();
element.tabAdd('menu-tab', {
title: title,
content: "<iframe id='iframeMain' width='100%' height='100%' frameborder='0' src=" + url + " class='layadmin-iframe' ></iframe>"
, id: id
})
$("#ifr-box ").css("background-image", "url('../../img/tableback.jpg')");
$("#layui-tab").show();
element.tabChange('menu-tab', id);
}
//关闭事件监听
$(".layui-tab-close").click(function (e) {
var tabr = $(".layui-tab-title").find("li");
var length = tabr.length;
if (length == 0) {//全部关闭了则返回首页
$("#menu-childer").empty();
$("#indexIframe").show();
$("#menu-content").empty();
$("#layui-tab").hide();
$("#ifr-box ").css("background-image", "");
let nowsrc = $('#indexIframe').attr("src");
let imea = "0";
if (nowsrc == inde1url) {//综合暂时
imea = "0";
} else if (nowsrc == inde2url) {//地市首页
imea = "1";
} else if (nowsrc == inde3url) {//地市首页
imea = "2";
}
$(".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');
} else if ($(this).text().indexOf('首页') != '-1' && imea == 1) {
$(this).addClass('layui-that');
$(this).addClass('layui-this');
} else if ($(this).text().indexOf('值长') != '-1' && imea == 2) {
$(this).addClass('layui-that');
$(this).addClass('layui-this');
}
})
}
})
}
function closePage(){
element.tabDelete('menu-tab', '160000');
element.tabDelete('menu-tab', '190000');
}
function initUserExam(){
}
function test() {
$("#indexIframe").hide();
element.tabAdd('menu-tab', {
title: '消息通知',
content: "<iframe id='iframeMain' width='100%' height='100%' frameborder='0' src='../../html/notice/notice.html' class='layadmin-iframe' ></iframe>"
, id: '99999999999999'
})
$("#ifr-box ").css("background-image", "url('../../img/tableback.jpg')");
$("#layui-tab").show();
element.tabChange('menu-tab', '99999999999999');
//关闭事件监听
$(".layui-tab-close").click(function (e) {
let tabr = $(".layui-tab-title").find("li");
let length = tabr.length;
if (length === 0) {//全部关闭了则返回首页
$("#menu-childer").empty();
$("#indexIframe").show();
$("#menu-content").empty();
$("#layui-tab").hide();
$("#ifr-box ").css("background-image", "");
}
})
}
// 校验密码
function verifyPass(){
openIframeByParamObj6("verifyPass", '校验', "verifyPass.html", "28%", "35%", {});
}
//初始化默认考试
function initUserExam(param){
$.ajax({
url: dataUrl + 'proteam/sys/exam/initUserExam',
headers: {
"Authorization": token
},
data: {
userId: param,
},
type: 'post',
async: true,
success: function (result) {
console.log(result);
// 查询当前账号是否完成当日考试
getIsFinishDayExam(param);
},
});
}
// 查询当前账号是否完成当日考试
function getIsFinishDayExam(userId){
try {
$('#dayExam').empty();
$('#studyTask').empty();
let url = dataUrl + "proteam/sys/exam/getAnswerStatusByUser";
let params = { userId: userId}
ajaxRequest2(url, "POST", params, true, function (result) {
if (result.code === 200) {
let answerStatus = result.data.answerStatus,
studyTaskStatus = result.data.studyTaskStatus;
if(answerStatus === 0){
let scroll = '<marquee behavior="scroll" style="color: #f12d2d; letter-spacing:1px;cursor: pointer;font-weight: bold;font-size: 16px;">当日考试未完成,请尽快完成考试!!!</marquee>';
$('.datas').before('<div id="dayExam" style="width:16%;padding: 0 20px;" onclick="openDayExam()">'+scroll+'</div>');
$('.datas').css({'width':'17%'});
}else if(answerStatus === 1){
$('.datas').before('<div id="dayExam" style="width:16%;color:#52CA68;cursor: pointer;text-align: center;" onclick="openDayExam()">当日考试已完成</div>');
$('.datas').css({'width':'17%'});
}
if(studyTaskStatus === 1){
let scroll2 = '<marquee behavior="scroll" style="color: #f12d2d; letter-spacing:1px;cursor: pointer;font-weight: bold;font-size: 16px;">您有新的学习任务,请尽快完成学习!!!</marquee>';
$('.datas').before('<div id="studyTask" style="width:16%;padding: 0 20px;" onclick="openStudyTask()">'+scroll2+'</div>');
$('.datas').css({'width':'17%'});
}else if(studyTaskStatus === 0){
$('.datas').before('<div id="studyTask" style="width:16%;color:#52CA68;cursor: pointer;text-align: center;" onclick="openStudyTask()">学习任务已完成</div>');
$('.datas').css({'width':'17%'});
}
}
}, function (xhr) {
error(xhr)
}, null, token);
} catch (error) {
console.error('发生错误:', error.message);
}
}
// 打开每日考试
function openDayExam(){
openIframeByParamObj("openDayExam", '每日考试', "../../html/studyExam/dayExam.html", "82%", "80%", {});
}
// 刷新每日考试状态
function reloadDayExamStatus(){
var user = JSON.parse(decrypt(us));
$('#dayExam').remove();
getIsFinishDayExam(user.userId);
}
// 打开学习任务
function openStudyTask(){
openNewTab('../studyExam/studyCourseware.html',kjIdx,'课件学习')
}