diff --git a/admin-core/src/main/resources/static/js/common.js b/admin-core/src/main/resources/static/js/common.js index 318c5ca8..b4909070 100644 --- a/admin-core/src/main/resources/static/js/common.js +++ b/admin-core/src/main/resources/static/js/common.js @@ -1,50 +1,100 @@ /*一些基础的js方法,基础的业务js方法在lib.js里*/ -$.ajaxSetup({ - xhrFields:{ - withCredentials:true - }, - crossDomain:true, - headers:{ - "_sign":localStorage.getItem("_sign") // TP不用改动任何代码 - }, - beforeSend: function (XMLHttpRequest) {//ajax请求之前 - if(this.url.indexOf(".json") >=0 && (this.url.indexOf("add") >=0 || this.url.indexOf("edit") >=0 || this.url.indexOf("set") >=0)){ - layer.load(1); - } - //$("#loading_message").show(); - }, - complete: function (XMLHttpRequest, textStatus) {//responseText - if(this.url.indexOf(".json") >=0 && (this.url.indexOf("add") >=0 || this.url.indexOf("edit") >=0 || this.url.indexOf("set") >=0)){ - layer.closeAll('loading');//关闭加载层 - } - if (!$.isEmpty(XMLHttpRequest.responseJSON) && XMLHttpRequest.responseJSON.code == 401) { - layer.msg("网页已过期,请重新登陆!", { - offset: ['50%'], - icon: 2, - time: 2000 //2秒关闭(如果不配置,默认是3秒) - }, function () { - window.open(Common.ctxPath); - }); - return; - } - if (XMLHttpRequest.statusText == 'error' && !$.isEmpty(XMLHttpRequest.responseText)) { - var r = $.parseJSON(XMLHttpRequest.responseText); - if (r.code == 401) { - layer.msg("网页已过期,请重新登陆!", { - offset: ['50%'], - icon: 2, - time: 2000 //2秒关闭(如果不配置,默认是3秒) - }, function () { - window.open(Common.ctxPath); - }); - } - return; +var open = window.XMLHttpRequest.prototype.open, + send = window.XMLHttpRequest.prototype.send; +function openReplacement(method, url, async, user, password) { + return open.apply(this, arguments); +} + +function getCookie(key){ + var va = null; + for (let str of document.cookie.split(";")) { + var kv = str.split("="); + if (kv[0] == key || Number(kv[0]+'') == Number(key+'') || kv[0] === key || (kv[0]+'') == (key+'') || (kv[0].indexOf(key)>=0 && key.indexOf('TOKEN') >= 0)) { + va = kv[1]; + break; } - }, - error: function () { - //ajax请求失败 - }, -}); + } + return va; +} + +//获取_role_tag +function getHeadTag(){ + var reg = new RegExp("(^|&)_role_tag=([^&]*)(&|$)"),tokenInfo = ""; //构造一个含有目标参数的正则表达式对象 + var r = window.location.search.substr(1).match(reg); //匹配目标参数 + if (r == null) { + r = parent.window.location.search.substr(1).match(reg); //匹配目标参数 + } + if (r == null) { + r = parent.parent.window.location.search.substr(1).match(reg); //匹配目标参数 + } + if (r != null) { + return unescape(r[2]); + } + return null; +} + +function sendReplacement(data) { //添加请求头 + var _role_tag = getHeadTag(); + this.setRequestHeader("_role_tag", _role_tag); + var key = getCookie(_role_tag); + this.setRequestHeader("token", getCookie(key)); + return send.apply(this, arguments); +} + +window.XMLHttpRequest.prototype.open = openReplacement; +window.XMLHttpRequest.prototype.send = sendReplacement; +// $.ajaxSetup({ +// complete: function (XMLHttpRequest) {//ajax请求之前 +// console.log(1111111) +// } +// }); +/*一些基础的js方法,基础的业务js方法在lib.js里*/ +// $.ajaxSetup({ +// xhrFields:{ +// withCredentials:true +// }, +// crossDomain:true, +// headers:{ +// "_sign":localStorage.getItem($.getKeyInfo("_sign")) // TP不用改动任何代码 +// }, +// beforeSend: function (XMLHttpRequest) {//ajax请求之前 +// if(this.url.indexOf(".json") >=0 && (this.url.indexOf("add") >=0 || this.url.indexOf("edit") >=0 || this.url.indexOf("set") >=0)){ +// layer.load(1); +// } +// //$("#loading_message").show(); +// }, +// complete: function (XMLHttpRequest, textStatus) {//responseText +// if(this.url.indexOf(".json") >=0 && (this.url.indexOf("add") >=0 || this.url.indexOf("edit") >=0 || this.url.indexOf("set") >=0)){ +// layer.closeAll('loading');//关闭加载层 +// } +// if (!$.isEmpty(XMLHttpRequest.responseJSON) && XMLHttpRequest.responseJSON.code == 401) { +// layer.msg("网页已过期,请重新登陆!", { +// offset: ['50%'], +// icon: 2, +// time: 2000 //2秒关闭(如果不配置,默认是3秒) +// }, function () { +// window.open(Common.ctxPath); +// }); +// return; +// } +// if (XMLHttpRequest.statusText == 'error' && !$.isEmpty(XMLHttpRequest.responseText)) { +// var r = $.parseJSON(XMLHttpRequest.responseText); +// if (r.code == 401) { +// layer.msg("网页已过期,请重新登陆!", { +// offset: ['50%'], +// icon: 2, +// time: 2000 //2秒关闭(如果不配置,默认是3秒) +// }, function () { +// window.open(Common.ctxPath); +// }); +// } +// return; +// } +// }, +// error: function () { +// //ajax请求失败 +// }, +// }); if(typeof Object.assign != 'function') { (function() { @@ -191,7 +241,7 @@ var Common = { // }); var optionsData = Object.assign({}, { type: 2, - content: Common.ctxPath + url, + content: Common.ctxPath + $.getUrlAddTag(url), title: title || '', maxmin: false , cancel: function () { @@ -208,7 +258,7 @@ var Common = { topOpenDlg: function (url, title) { var index = top.layer.open({ type: 2, - content: Common.ctxPath + url, + content: Common.ctxPath + $.getUrlAddTag(url), title: title, area: ['100%', '100%'], maxmin: false @@ -348,13 +398,15 @@ var Common = { * cookie获取 */ cookieGet: function(key) { + var va = null; for (let str of document.cookie.split(";")) { var kv = str.split("="); - if (kv[0] === key) { - return kv[1]; + if (kv[0] == key || Number(kv[0]+'') == Number(key+'') || kv[0] === key || (kv[0]+'') == (key+'') || (kv[0].indexOf(key)>=0 && key.indexOf('TOKEN') >= 0)) { + va = kv[1]; + break; } } - return null; + return va; }, post: function (url, paras, next) { this.ajaxInit() @@ -652,10 +704,6 @@ var Common = { } else { return ""; } - },getUrlParam:function(name) {//获取url中的参数 - var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 - var r = window.location.search.substr(1).match(reg); //匹配目标参数 - if (r != null) return unescape(r[2]); return null; //返回参数值 },getLocalTime:function (nS) {//时间戳转换成时间格式 return new Date(parseInt(nS)).format('yyyy-MM-dd HH:mm:ss'); },getFormatDate:function (d) { @@ -696,6 +744,39 @@ var Common = { let noWan = num % 10000; if (noWan.toString().length < 4) noWan = "0" + noWan; return overWan ? getWan(overWan) + "万" + getWan(noWan) : getWan(num); + }, getUrlParam: function (name) {//获取url中的参数 + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 + var r = window.location.search.substr(1).match(reg); //匹配目标参数 + if (r != null) return unescape(r[2]); + return null; //返回参数值 + }, getUrlAddTag: function (url) { //给地址添加标记 + var reg = new RegExp("(^|&)_role_tag=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 + var r = window.location.search.substr(1).match(reg); //匹配目标参数 + if (r == null) { + r = parent.window.location.search.substr(1).match(reg); //匹配目标参数 + } + if (r == null) { + r = parent.parent.window.location.search.substr(1).match(reg); //匹配目标参数 + } + if (r != null) { + if (url.indexOf("?") >= 0) { + url += "&_role_tag=" + unescape(r[2]); + } else { + url += "?_role_tag=" + unescape(r[2]); + } + } + + return url; + }, + getKeyInfo:function (val){ //组装缓存的key值 + const tag = getHeadTag(); //拿到头部指定参数 + if($.isEmpty(tag)){ + const tokenKye = getCookie(tag);; //根据唯一值拿存token的key + if(!$.isEmpty(tokenKye)){ + return val + "_" + tokenKye; //传入的值 + 当前人的token的key + } + } + return val; } }); diff --git a/admin-core/src/main/resources/static/js/lib.js b/admin-core/src/main/resources/static/js/lib.js index 5db63183..02a2415b 100644 --- a/admin-core/src/main/resources/static/js/lib.js +++ b/admin-core/src/main/resources/static/js/lib.js @@ -1143,7 +1143,7 @@ var Lib = { //循环选择包装 var packNum = 0;//用于做当前商品选择包装位置 计数 function f(data,n,tag) { - sessionStorage.setItem("packagingSelection",JSON.stringify(data[packNum]));//将传入的数据数组一条一条的存入缓存中 用于选择包装页面一个商品一个商品的选择包装 + sessionStorage.setItem($.getKeyInfo("packagingSelection"),JSON.stringify(data[packNum]));//将传入的数据数组一条一条的存入缓存中 用于选择包装页面一个商品一个商品的选择包装 var btn = ['下一个', '取消']; if((data.length - 1) == packNum){ btn = ['上一个','确定','取消']; diff --git a/admin-core/src/main/resources/static/plugins/frame/js/fsTab.js b/admin-core/src/main/resources/static/plugins/frame/js/fsTab.js index 9066973e..a5523fde 100644 --- a/admin-core/src/main/resources/static/plugins/frame/js/fsTab.js +++ b/admin-core/src/main/resources/static/plugins/frame/js/fsTab.js @@ -37,15 +37,18 @@ layui.define(['element'], function (exports) { layId = dom.attr("menuid");//自己改的 $(elem).attr("lay-id", layId); if (!$.isEmpty(dataUrl)) { - if(dataUrl.indexOf("http://") >= 0 || dataUrl.indexOf("https://") >= 0){ - dataUrl = dataUrl.replace("/server",""); - } - if(layId == '141' || layId == '142' || layId == '143'){ // 护换线请求 护换线应答 护换线检验 等页面直接通过新页面打开 - $(elem).attr("lay-id", ""); - window.open(dataUrl); - }else { - thisTab.add(title, dom.attr("dataUrl"), layId); - } + // if(dataUrl.indexOf("http://") >= 0 || dataUrl.indexOf("https://") >= 0){ + // dataUrl = dataUrl.replace("/server",""); + // } + // if(layId == '141' || layId == '142' || layId == '143'){ // 护换线请求 护换线应答 护换线检验 等页面直接通过新页面打开 + // $(elem).attr("lay-id", ""); + // window.open(dataUrl); + // }else { + // thisTab.add(title, dom.attr("dataUrl"), layId); + // } + var reg = new RegExp("(^|&)_role_tag=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 + var r = window.location.search.substr(1).match(reg); //匹配目标参数 + thisTab.add(title, dataUrl + (r != null?'?_role_tag='+unescape(r[2]):''), layId); } } if (layId == 70) { diff --git a/admin-core/src/main/resources/templates/common/layout.html b/admin-core/src/main/resources/templates/common/layout.html index 18a8a5d5..28c80012 100644 --- a/admin-core/src/main/resources/templates/common/layout.html +++ b/admin-core/src/main/resources/templates/common/layout.html @@ -13,11 +13,11 @@ - - + + - - + + diff --git a/admin-core/src/main/resources/templates/help.html b/admin-core/src/main/resources/templates/help.html index 0331d85a..50798e86 100644 --- a/admin-core/src/main/resources/templates/help.html +++ b/admin-core/src/main/resources/templates/help.html @@ -345,7 +345,7 @@ //打开并跳转到相应的页面 window.openPage = function (layId,title,dataUrl,id) { - sessionStorage.setItem("idInfo", id); + sessionStorage.setItem($.getKeyInfo("idInfo"), id); var len = $(".fsTab .layui-tab-title li").length; var n = 0; for (var i = 0; i < len; i++) { @@ -374,7 +374,7 @@ } window.fsTab =function () { - window.sessionStorage.setItem("fsTabLayId",$(".fsTab .layui-tab-title .layui-this").attr("lay-id")); + window.sessionStorage.setItem($.getKeyInfo("fsTabLayId"),$(".fsTab .layui-tab-title .layui-this").attr("lay-id")); } diff --git a/admin-core/src/main/resources/templates/index.html b/admin-core/src/main/resources/templates/index.html index 99e20e2c..d9920e20 100644 --- a/admin-core/src/main/resources/templates/index.html +++ b/admin-core/src/main/resources/templates/index.html @@ -356,9 +356,9 @@ //监听提醒窗体切换 form.on('checkbox(promptingWindow)', function (data) { if (data.elem.checked) { - window.localStorage.setItem("promptingWindow", "1"); + window.localStorage.setItem($.getKeyInfo("promptingWindow"), "1"); } else { - window.localStorage.setItem("promptingWindow", "2"); + window.localStorage.setItem($.getKeyInfo("promptingWindow"), "2"); //socketEnd();//关闭长连接 } }); @@ -446,7 +446,7 @@ // 处理来电 function handlerCustomerCall(layId, phone) { - window.localStorage.setItem("newCustomerPhone", phone); + window.localStorage.setItem($.getKeyInfo("newCustomerPhone"), phone); openNewPage(layId, "/jlw/customerServiceRecord/index.do?phone=" + phone, "来电管理"); } @@ -489,7 +489,7 @@ //打开订单管理页面 立即查看 function orderPage(orderId) { - window.localStorage.setItem("indexOrderId", orderId); + window.localStorage.setItem($.getKeyInfo("indexOrderId"), orderId); var layId = 70;//订单管理ID var dataUrl = Common.ctxPath + "/jlw/order/index.do"; var title = "订单管理"; diff --git a/web/src/main/resources/static/js/jlw/handsOn/index1.js b/web/src/main/resources/static/js/jlw/handsOn/index1.js index 30e60d4e..1e49ba76 100644 --- a/web/src/main/resources/static/js/jlw/handsOn/index1.js +++ b/web/src/main/resources/static/js/jlw/handsOn/index1.js @@ -157,7 +157,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { maxmin: true, shade: 0.3, title: "知识点绑定", - content: Common.ctxPath + url, + content: Common.ctxPath + $.getUrlAddTag(url), btn: ['确定', '关闭'], yes: function(index, layero) { var iframeWin = layero.find('iframe')[0]; diff --git a/web/src/main/resources/static/js/jlw/schoolClass/add.js b/web/src/main/resources/static/js/jlw/schoolClass/add.js index cb89eb57..e520f23a 100644 --- a/web/src/main/resources/static/js/jlw/schoolClass/add.js +++ b/web/src/main/resources/static/js/jlw/schoolClass/add.js @@ -2,8 +2,8 @@ layui.define([ 'form', 'laydate', 'table','schoolClassApi'], function(exports) { var form = layui.form; var schoolClassApi = layui.schoolClassApi; var index = layui.index; - var student_tag = sessionStorage.getItem("student_tag"); //schoolClass_tag = 1: 学生页面进入 2:班级进入 - sessionStorage.removeItem("student_tag"); + var student_tag = sessionStorage.getItem($.getKeyInfo("student_tag")); //schoolClass_tag = 1: 学生页面进入 2:班级进入 + sessionStorage.removeItem($.getKeyInfo("student_tag")); var view = { init:function(){ Lib.initGenrealForm($("#addForm"),form); @@ -50,7 +50,7 @@ layui.define([ 'form', 'laydate', 'table','schoolClassApi'], function(exports) { } $(".rightUniversitySystemAdd").click(function (){ - sessionStorage.setItem("student_tag",($("input[name='studentId']").val() || '-1')); + sessionStorage.setItem($.getKeyInfo("student_tag"),($("input[name='studentId']").val() || '-1')); var url = "/jlw/universitySystem/add.do"; Common.openDlg(url,""); }); diff --git a/web/src/main/resources/static/js/jlw/student/add.js b/web/src/main/resources/static/js/jlw/student/add.js index 5fb476e2..6bb12bba 100644 --- a/web/src/main/resources/static/js/jlw/student/add.js +++ b/web/src/main/resources/static/js/jlw/student/add.js @@ -2,7 +2,7 @@ layui.define([ 'form', 'laydate', 'table','studentApi'], function(exports) { var form = layui.form; var studentApi = layui.studentApi; var index = layui.index; - sessionStorage.removeItem("student_tag"); + sessionStorage.removeItem($.getKeyInfo("student_tag")); window.load = function (){ //主要用于点击去添加后调用 Lib.getUniversitiesColleges($("#universitiesCollegesId")); @@ -42,21 +42,21 @@ layui.define([ 'form', 'laydate', 'table','studentApi'], function(exports) { //去添加院校 $(".rightOffAdd").click(function (){ - sessionStorage.setItem("student_tag",($("input[name='studentId']").val() || '-1')); + sessionStorage.setItem($.getKeyInfo("student_tag"),($("input[name='studentId']").val() || '-1')); var url = "/jlw/universitiesColleges/add.do"; Common.openDlg(url,""); }); //去添加班级 $(".rightOffClassAdd").click(function (){ - sessionStorage.setItem("student_tag",($("input[name='studentId']").val() || '-1')); + sessionStorage.setItem($.getKeyInfo("student_tag"),($("input[name='studentId']").val() || '-1')); var url = "/jlw/schoolClass/add.do"; Common.openDlg(url,""); }); //去添加专业 $(".rightOffUniversityAdd").click(function (){ - sessionStorage.setItem("student_tag",($("input[name='studentId']").val() || '-1')); + sessionStorage.setItem($.getKeyInfo("student_tag"),($("input[name='studentId']").val() || '-1')); var url = "/jlw/universitySystem/add.do"; Common.openDlg(url,""); }); diff --git a/web/src/main/resources/static/js/jlw/teacher/add.js b/web/src/main/resources/static/js/jlw/teacher/add.js index 5942803b..15d8653f 100644 --- a/web/src/main/resources/static/js/jlw/teacher/add.js +++ b/web/src/main/resources/static/js/jlw/teacher/add.js @@ -2,7 +2,7 @@ layui.define([ 'form', 'laydate', 'table','teacherApi'], function(exports) { var form = layui.form; var teacherApi = layui.teacherApi; var index = layui.index; - sessionStorage.removeItem("teacher_tag"); + sessionStorage.removeItem($.getKeyInfo("teacher_tag")); window.load = function (){ //主要用于点击去添加后调用 Lib.getUniversitiesColleges($("#universitiesCollegesId")); } @@ -23,7 +23,7 @@ layui.define([ 'form', 'laydate', 'table','teacherApi'], function(exports) { //去添加院校信息/添加院校 $(".rightOffAdd").click(function (){ - sessionStorage.setItem("teacher_tag",($("input[name='teacherId']").val() || '-1')); + sessionStorage.setItem($.getKeyInfo("teacher_tag"),($("input[name='teacherId']").val() || '-1')); var url = "/jlw/universitiesColleges/add.do"; Common.openDlg(url,""); }); diff --git a/web/src/main/resources/static/js/jlw/universitiesColleges/add.js b/web/src/main/resources/static/js/jlw/universitiesColleges/add.js index 41b7641a..26612b17 100644 --- a/web/src/main/resources/static/js/jlw/universitiesColleges/add.js +++ b/web/src/main/resources/static/js/jlw/universitiesColleges/add.js @@ -3,10 +3,10 @@ layui.define([ 'form', 'laydate', 'table','universitiesCollegesApi'], function(e var universitiesCollegesApi = layui.universitiesCollegesApi; var index = layui.index; - var student_tag = sessionStorage.getItem("student_tag"); //schoolClass_tag不为空时表示从其他页面进入并非列表添加 - var teacher_tag = sessionStorage.getItem("teacher_tag"); //teacher_tag不为空时表示从其他页面进入并非列表添加 - sessionStorage.removeItem("student_tag"); - sessionStorage.removeItem("teacher_tag"); + var student_tag = sessionStorage.getItem($.getKeyInfo("student_tag")); //schoolClass_tag不为空时表示从其他页面进入并非列表添加 + var teacher_tag = sessionStorage.getItem($.getKeyInfo("teacher_tag")); //teacher_tag不为空时表示从其他页面进入并非列表添加 + sessionStorage.removeItem($.getKeyInfo("student_tag")); + sessionStorage.removeItem($.getKeyInfo("teacher_tag")); var view = { init:function(){ Lib.initGenrealForm($("#addForm"),form); diff --git a/web/src/main/resources/templates/jlw/competition/bigScreenRanking.html b/web/src/main/resources/templates/jlw/competition/bigScreenRanking.html index cc416654..dcd1501e 100644 --- a/web/src/main/resources/templates/jlw/competition/bigScreenRanking.html +++ b/web/src/main/resources/templates/jlw/competition/bigScreenRanking.html @@ -142,8 +142,8 @@ var competitionContestStartTime;//考试开始时间 var competitionContestEndTime;//考试结束时间 - var competitionId = sessionStorage.getItem("competitionId_h_dp"); - var competitionType_dp = sessionStorage.getItem("competitionType_h_dp"); + var competitionId = sessionStorage.getItem($.getKeyInfo("competitionId_h_dp")); + var competitionType_dp = sessionStorage.getItem($.getKeyInfo("competitionType_h_dp")); var tag = competitionType_dp == 1?2:1; var on = 0; var data = Common.getAjax('/getNowTime.do');//系统时间 diff --git a/web/src/main/resources/templates/jlw/competition/patternDetails.html b/web/src/main/resources/templates/jlw/competition/patternDetails.html index c4741ea5..9d523a39 100644 --- a/web/src/main/resources/templates/jlw/competition/patternDetails.html +++ b/web/src/main/resources/templates/jlw/competition/patternDetails.html @@ -739,8 +739,8 @@ $("div[name='personalTable']").show(); $(this).find("a").addClass("on"); } else if (index == 2) { - sessionStorage.setItem("competitionId_h_dp",competitionId); - sessionStorage.setItem("competitionType_h_dp",competitionType); + sessionStorage.setItem($.getKeyInfo("competitionId_h_dp"),competitionId); + sessionStorage.setItem($.getKeyInfo("competitionType_h_dp"),competitionType); //parent.parent.window.location.href=Common.ctxPath + "/jlw/competition/bigScreenRanking.do"; //跳转至大屏幕排行榜页面 //window.open(Common.ctxPath + "/jlw/competition/bigScreenRanking.do"); //跳转至大屏幕排行榜页面 diff --git a/web/src/main/resources/templates/jlw/competition/reviewDetails.html b/web/src/main/resources/templates/jlw/competition/reviewDetails.html index 1bcd884a..0a98e53d 100644 --- a/web/src/main/resources/templates/jlw/competition/reviewDetails.html +++ b/web/src/main/resources/templates/jlw/competition/reviewDetails.html @@ -356,7 +356,7 @@ QNumber = total_0 + total_1 + total_2; $("#ksts").html(QNumber); - var t1 = localStorage.getItem("T1" + ret.studentSn);//单选题map + var t1 = localStorage.getItem($.getKeyInfo("T1" + ret.studentSn));//单选题map t1 = JSON.parse(t1); $.each(!$.isEmpty(ret.data["1"])?ret.data[1]:[],function(key,values){ questionType = 0; @@ -372,7 +372,7 @@ type1Map[values.competitionTaskOneQuestionId]["addTime"] = t1[values.competitionTaskOneQuestionId]["addTime"]; } }); - var t2 = localStorage.getItem("T2" + ret.studentSn);//多选题map + var t2 = localStorage.getItem($.getKeyInfo("T2" + ret.studentSn));//多选题map t2 = JSON.parse(t2); $.each(!$.isEmpty(ret.data["2"])?ret.data[2]:[],function(key,values){ if(questionType == 3){ @@ -390,7 +390,7 @@ type2Map[values.competitionTaskOneQuestionId]["addTime"] = t2[values.competitionTaskOneQuestionId]["addTime"]; } }); - var t3 = localStorage.getItem("T3" + ret.studentSn);//判断题map + var t3 = localStorage.getItem($.getKeyInfo("T3" + ret.studentSn));//判断题map t3 = JSON.parse(t3); $.each(!$.isEmpty(ret.data["3"])?ret.data[3]:[],function(key,values){ if(questionType == 3 ){ @@ -408,9 +408,9 @@ type3Map[values.competitionTaskOneQuestionId]["addTime"] = t3[values.competitionTaskOneQuestionId]["addTime"]; } }); - localStorage.setItem("T1" + ret.studentSn,JSON.stringify(type1Map));//单选题map 写入缓存 - localStorage.setItem("T2" + ret.studentSn,JSON.stringify(type2Map));//多选题map 写入缓存 - localStorage.setItem("T3" + ret.studentSn,JSON.stringify(type3Map));//判断题map 写入缓存 + localStorage.setItem($.getKeyInfo("T1" + ret.studentSn),JSON.stringify(type1Map));//单选题map 写入缓存 + localStorage.setItem($.getKeyInfo("T2" + ret.studentSn),JSON.stringify(type2Map));//多选题map 写入缓存 + localStorage.setItem($.getKeyInfo("T3" + ret.studentSn),JSON.stringify(type3Map));//判断题map 写入缓存 loadLeft(ret.data[Number(questionType) + 1][0].competitionTaskOneQuestionId); }else { layer.msg(ret.msg); diff --git a/web/src/main/resources/templates/jlw/exam/reviewDetails.html b/web/src/main/resources/templates/jlw/exam/reviewDetails.html index 86d2761b..4aecc649 100644 --- a/web/src/main/resources/templates/jlw/exam/reviewDetails.html +++ b/web/src/main/resources/templates/jlw/exam/reviewDetails.html @@ -357,7 +357,7 @@ QNumber = total_0 + total_1 + total_2; $("#ksts").html(QNumber); - var t1 = localStorage.getItem("T1" + ret.studentSn);//单选题map + var t1 = localStorage.getItem($.getKeyInfo("T1" + ret.studentSn));//单选题map t1 = JSON.parse(t1); $.each(!$.isEmpty(ret.data["1"]) ? ret.data[1] : [],function(key,values){ questionType = 0; @@ -373,7 +373,7 @@ type1Map[values.examTaskOneQuestionId]["addTime"] = t1[values.examTaskOneQuestionId]["addTime"]; } }); - var t2 = localStorage.getItem("T2" + ret.studentSn);//多选题map + var t2 = localStorage.getItem($.getKeyInfo("T2" + ret.studentSn));//多选题map t2 = JSON.parse(t2); $.each(!$.isEmpty(ret.data["2"]) ? ret.data[2] : [],function(key,values){ if (questionType == 3) { @@ -391,7 +391,7 @@ type2Map[values.examTaskOneQuestionId]["addTime"] = t2[values.examTaskOneQuestionId]["addTime"]; } }); - var t3 = localStorage.getItem("T3" + ret.studentSn);//判断题map + var t3 = localStorage.getItem($.getKeyInfo("T3" + ret.studentSn));//判断题map t3 = JSON.parse(t3); $.each(!$.isEmpty(ret.data["3"]) ? ret.data[3] : [],function(key,values){ if (questionType == 3) { @@ -409,9 +409,9 @@ type3Map[values.examTaskOneQuestionId]["addTime"] = t3[values.examTaskOneQuestionId]["addTime"]; } }); - localStorage.setItem("T1" + ret.studentSn,JSON.stringify(type1Map));//单选题map 写入缓存 - localStorage.setItem("T2" + ret.studentSn,JSON.stringify(type2Map));//多选题map 写入缓存 - localStorage.setItem("T3" + ret.studentSn,JSON.stringify(type3Map));//判断题map 写入缓存 + localStorage.setItem($.getKeyInfo("T1" + ret.studentSn),JSON.stringify(type1Map));//单选题map 写入缓存 + localStorage.setItem($.getKeyInfo("T2" + ret.studentSn),JSON.stringify(type2Map));//多选题map 写入缓存 + localStorage.setItem($.getKeyInfo("T3" + ret.studentSn),JSON.stringify(type3Map));//判断题map 写入缓存 loadLeft(ret.data[Number(questionType) + 1][0].examTaskOneQuestionId); }else { layer.msg(ret.msg); diff --git a/web/src/main/resources/templates/jlw/previewPage/previewData副本.html b/web/src/main/resources/templates/jlw/previewPage/previewData副本.html index 194cb2b8..5b659825 100644 --- a/web/src/main/resources/templates/jlw/previewPage/previewData副本.html +++ b/web/src/main/resources/templates/jlw/previewPage/previewData副本.html @@ -54,12 +54,12 @@ $("#player-con").show(); const saveTime = function (memoryVideo,currentTime) { - localStorage.setItem(memoryVideo, currentTime); + localStorage.setItem($.getKeyInfo(memoryVideo), currentTime); } const getTime = function (memoryVideo) { //return返回的是自定义起播时间 - return localStorage.getItem(memoryVideo) + return localStorage.getItem($.getKeyInfo(memoryVideo)) } var player = new Aliplayer({ id: "player-con", diff --git a/web/src/main/resources/templates/jlw/resourcesQuestion/importPage.html b/web/src/main/resources/templates/jlw/resourcesQuestion/importPage.html index 062a0fc4..101ace16 100644 --- a/web/src/main/resources/templates/jlw/resourcesQuestion/importPage.html +++ b/web/src/main/resources/templates/jlw/resourcesQuestion/importPage.html @@ -74,7 +74,7 @@ var upload = layui.upload; var laytpl = layui.laytpl; - var resourcesQuestionLocal = localStorage.getItem("resourcesQuestionLocal"); //取出上次导入出现错误的数据 + var resourcesQuestionLocal = localStorage.getItem($.getKeyInfo("resourcesQuestionLocal")); //取出上次导入出现错误的数据 if (!$.isEmpty(resourcesQuestionLocal)) { var getTpl = demo.innerHTML , view = document.getElementById('view'); @@ -96,7 +96,7 @@ done: function (res, index, upload) { //上传后的回调 layer.closeAll('loading'); if (res.code == 0) { - localStorage.setItem("resourcesQuestionLocal", JSON.stringify(res.data)); //存入本次导入出现错误的数据 + localStorage.setItem($.getKeyInfo("resourcesQuestionLocal"), JSON.stringify(res.data)); //存入本次导入出现错误的数据 layer.msg(res.msg, {icon: 1}); var getTpl = demo.innerHTML , view = document.getElementById('view'); diff --git a/web/src/main/resources/templates/jlw/student/importPage.html b/web/src/main/resources/templates/jlw/student/importPage.html index 36be4000..6fd614fd 100644 --- a/web/src/main/resources/templates/jlw/student/importPage.html +++ b/web/src/main/resources/templates/jlw/student/importPage.html @@ -74,7 +74,7 @@ var upload = layui.upload; var laytpl = layui.laytpl; - var studentLocal = localStorage.getItem("studentLocal"); //取出上次导入出现错误的数据 + var studentLocal = localStorage.getItem($.getKeyInfo("studentLocal")); //取出上次导入出现错误的数据 if(!$.isEmpty(studentLocal)){ var getTpl = demo.innerHTML ,view = document.getElementById('view'); @@ -98,7 +98,7 @@ layer.closeAll('loading'); if (res.code == 0) { parent.window.dataReload(); - localStorage.setItem("studentLocal", JSON.stringify(res.data)); //存入本次导入出现错误的数据 + localStorage.setItem($.getKeyInfo("studentLocal"), JSON.stringify(res.data)); //存入本次导入出现错误的数据 layer.msg(res.msg, {icon: 1}); var getTpl = demo.innerHTML ,view = document.getElementById('view'); diff --git a/web/src/main/resources/templates/jlw/studentClientLink/logOnLink.html b/web/src/main/resources/templates/jlw/studentClientLink/logOnLink.html index 925cf41d..b91fd40f 100644 --- a/web/src/main/resources/templates/jlw/studentClientLink/logOnLink.html +++ b/web/src/main/resources/templates/jlw/studentClientLink/logOnLink.html @@ -57,7 +57,7 @@ } }, initTable:function(){ - var sx_ = localStorage.getItem("studentClientLinkTable_field_"+Common.userInfoId); //筛选值显示、隐藏缓存 + var sx_ = localStorage.getItem($.getKeyInfo("studentClientLinkTable_field_"+Common.userInfoId)); //筛选值显示、隐藏缓存 if($.isEmpty(sx_)){sx_ = {};}else {sx_ = JSON.parse(sx_);} studentClientLinkTable = table.render({ elem : '#studentClientLinkTable', diff --git a/web/src/main/resources/templates/jlw/studentClientLink/popularizeLink.html b/web/src/main/resources/templates/jlw/studentClientLink/popularizeLink.html index 09d0be3d..6f10db4b 100644 --- a/web/src/main/resources/templates/jlw/studentClientLink/popularizeLink.html +++ b/web/src/main/resources/templates/jlw/studentClientLink/popularizeLink.html @@ -57,7 +57,7 @@ } }, initTable:function(){ - var sx_ = localStorage.getItem("studentClientLinkTable_field_"+Common.userInfoId); //筛选值显示、隐藏缓存 + var sx_ = localStorage.getItem($.getKeyInfo("studentClientLinkTable_field_"+Common.userInfoId)); //筛选值显示、隐藏缓存 if($.isEmpty(sx_)){sx_ = {};}else {sx_ = JSON.parse(sx_);} studentClientLinkTable = table.render({ elem : '#studentClientLinkTable', diff --git a/web/src/main/resources/templates/jlw/teacher/importPage.html b/web/src/main/resources/templates/jlw/teacher/importPage.html index 8bc8fc89..eb839d46 100644 --- a/web/src/main/resources/templates/jlw/teacher/importPage.html +++ b/web/src/main/resources/templates/jlw/teacher/importPage.html @@ -76,7 +76,7 @@ var upload = layui.upload; var laytpl = layui.laytpl; - var teacherLocal = localStorage.getItem("teacherLocal"); //取出上次导入出现错误的数据 + var teacherLocal = localStorage.getItem($.getKeyInfo("teacherLocal")); //取出上次导入出现错误的数据 if(!$.isEmpty(teacherLocal)){ var getTpl = demo.innerHTML ,view = document.getElementById('view'); @@ -100,7 +100,7 @@ done: function (res, index, upload) { //上传后的回调 layer.closeAll('loading'); if (res.code == 0) { - localStorage.setItem("teacherLocal", JSON.stringify(res.data)); //存入本次导入出现错误的数据 + localStorage.setItem($.getKeyInfo("teacherLocal"), JSON.stringify(res.data)); //存入本次导入出现错误的数据 layer.msg(res.msg, {icon: 1}); var getTpl = demo.innerHTML ,view = document.getElementById('view');