From 87471ca937aaff1b864916b7857d2f6ec211bd19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E4=B8=B9ab?= <1421553879@qq.com> Date: Fri, 30 Dec 2022 04:26:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../index.js | 4 +- .../jlw/courseInfo/courseConfigureNew.html | 304 ++++++++++-------- 2 files changed, 167 insertions(+), 141 deletions(-) diff --git a/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/index.js b/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/index.js index 1db7efa3..27d8efad 100644 --- a/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/index.js +++ b/web/src/main/resources/static/js/jlw/teacherOpenCourseStudentSigninLog/index.js @@ -99,7 +99,7 @@ layui.define([ 'form', 'laydate', 'table','laytpl'], function(exports) { hide: $.isEmpty(sx_['teacherOpenCourseIdText']) ? false : sx_['teacherOpenCourseIdText'], }, { - field: 'teacherOpenCourseStudentSigninLogAddTime', + field: 'teacherOpenCourseStudentSigninSettingSessionTime', title: '签到日期', align: "center", hideField: false, @@ -276,7 +276,7 @@ layui.define([ 'form', 'laydate', 'table','laytpl'], function(exports) { var param = { "teacherOpenCourseStudentSigninSettingSessionTime":$("select[name='teacherOpenCourseStudentSigninSettingSessionTime']").val(), "classId":$("#studentForm select[name='classId']").val(), - "studentOrName":$("#studentForm input[name='studentOrName']").val(), + "studentSnOrName":$("#studentForm input[name='studentOrName']").val(), 'teacherOpenCourseId':teacherOpenCourseId }; diff --git a/web/src/main/resources/templates/jlw/courseInfo/courseConfigureNew.html b/web/src/main/resources/templates/jlw/courseInfo/courseConfigureNew.html index 5dad7d59..22d37175 100644 --- a/web/src/main/resources/templates/jlw/courseInfo/courseConfigureNew.html +++ b/web/src/main/resources/templates/jlw/courseInfo/courseConfigureNew.html @@ -88,7 +88,7 @@
@@ -135,7 +135,7 @@
- +
@@ -180,15 +180,16 @@ //拖拽上传 upload.render({ elem: '#resourcesUpload' - ,url: Common.ctxPath + '/jlw/file/update.do' //此处用的是第三方的 http 请求演示,实际使用时改成您自己的上传接口即可。 + ,url: Common.ctxPath + '/jlw/file/update.do' ,done: function(res){ layer.msg('上传成功'); layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', Common.ctxPath + res.data.src); } }); var uploadInst = upload.render({ - elem: '#test1' //绑定元素 + elem: '#test1' //上传图文 , url: Common.ctxPath + '/jlw/file/update.do' + ,accept:'file' , done: function (res) { //上传完毕回调 layer.msg('上传成功'); @@ -199,104 +200,110 @@ }); var courseInfoTable = function () { - var ret = Common.getAjax("/jlw/courseInfo/getCourseResources.json", {courseInfoId: courseInfoParentId}); - var data = ret.data; - if (ret.code == 0) { - ret.data.forEach(item => { - item.resourcesInfo.forEach(function (e, i) { - e.courseInfoParentId = e.courseInfoId; - e.courseInfoId = 0; - e.courseInfoName = e.resourcesInfoName; - data.push(e); - }) - }); - } - treetable.render({ - elem: '#courseInfoTable', - height: Lib.getTableHeight(1), - cellMinWidth: 100, - data: data, - treeColIndex: 0, //树形图标显示在第几列 - treeSpid: courseInfoParentId, //最上级的父级id - treeIdName: 'courseInfoId', //id字段的名称 - treePidName: 'courseInfoParentId', //父级节点字段 - treeDefaultClose: true, //是否默认折叠 - treeLinkage: true //父级展开时是否自动展开所有子级 - , limit: 1000 - , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据 - return { - "code": res.status, //解析接口状态 - "msg": res.message, //解析提示文本 - "count": res.total, //解析数据长度 - "data": res.rows.item //解析数据列表 - }; - } - , cols: [[ // 表头 - { - field: 'LAY_TABLE_INDEX', - title: '序号', - align: "center", - }, - { - field: 'courseInfoName', - title: '目录名称', - }, - { - field: 'resourcesInfoType', - title: '资源类型', - align: "center", - templet: function (d) { - //资源类型(1视频 2PPT 3PDF 4链接 5图片) - var css = ''; - var value = ""; - if (d.resourcesInfoType === 1) { - value = "视频"; - css = "shiping"; - } else if (d.resourcesInfoType === 2) { - value = "PPT"; - css = "ppt"; - } else if (d.resourcesInfoType === 3) { - value = "PDF"; - css = "pdf"; - } else if (d.resourcesInfoType === 4) { - value = "链接"; - css = "lianjie"; - } else if (d.resourcesInfoType === 5) { - value = "图片"; - css = "tupian"; - } - return '' + value + ''; + layer.load(1); + var data=[]; + setTimeout(function () { + var ret = Common.getAjax("/jlw/courseInfo/getCourseResources.json", {courseInfoId: courseInfoParentId}); + data = ret.data; + if(ret.code == 0){ + data.forEach(item => { + item.resourcesInfo.forEach(function (e, i) { + e.courseInfoParentId = e.courseInfoId; + e.courseInfoId = 0; + e.courseInfoName = e.resourcesInfoName; + data.push(e); + }) + }); + treetable.render({ + elem: '#courseInfoTable', + height: Lib.getTableHeight(1), + cellMinWidth: 100, + data: data, + treeColIndex: 0, //树形图标显示在第几列 + treeSpid: courseInfoParentId, //最上级的父级id + treeIdName: 'courseInfoId', //id字段的名称 + treePidName: 'courseInfoParentId', //父级节点字段 + treeDefaultClose: true, //是否默认折叠 + treeLinkage: true //父级展开时是否自动展开所有子级 + , limit: 1000 + , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据 + return { + "code": res.status, //解析接口状态 + "msg": res.message, //解析提示文本 + "count": res.total, //解析数据长度 + "data": res.rows.item //解析数据列表 + }; } - }, - { - field: 'courseInfoId', - title: '操作', - align: "center", - templet: function (d) { - var htm = ''; - if (d.courseInfoType === 2) { - htm += '添加子章节'; - } else if (d.courseInfoType === 3) { - htm += '上传资源'; - htm += '添加链接'; - htm += '添加图文'; - } - if (!$.isEmpty(d.resourcesInfoType)) { - htm += '查看'; - htm += '上传'; + , cols: [[ // 表头 + { + field: 'LAY_TABLE_INDEX', + title: '序号', + align: "center", + }, + { + field: 'courseInfoName', + title: '目录名称', + }, + { + field: 'resourcesInfoType', + title: '资源类型', + width:120, + align: "center", + templet: function (d) { + //资源类型(1视频 2PPT 3PDF 4链接 5图片) + var css = ''; + var value = ""; + if (d.resourcesInfoType === 1) { + value = "视频"; + css = "shiping"; + } else if (d.resourcesInfoType === 2) { + value = "PPT"; + css = "ppt"; + } else if (d.resourcesInfoType === 3) { + value = "PDF"; + css = "pdf"; + } else if (d.resourcesInfoType === 4) { + value = "链接"; + css = "lianjie"; + } else if (d.resourcesInfoType === 5) { + value = "图片"; + css = "tupian"; + } + return '' + value + ''; + } + }, + { + field: 'courseInfoId', + title: '操作', + align: "center", + templet: function (d) { + var htm = ''; + if (d.courseInfoType === 2) { + htm += '添加子章节'; + } else if (d.courseInfoType === 3) { + htm += '上传资源'; + htm += '添加链接'; + htm += '添加图文'; + } + if (!$.isEmpty(d.resourcesInfoType)) { + htm += '查看'; + htm += '上传'; + } + htm += '编辑'; + htm += '删除'; + htm += '拖动'; + if (!$.isEmpty(d.resourcesInfoType)) { + htm += '上移'; + htm += '下移'; + } + return htm; + } } - htm += '编辑'; - htm += '删除'; - htm += '拖动'; - if (!$.isEmpty(d.resourcesInfoType)) { - htm += '上移'; - htm += '下移'; - } - return htm; - } - } - ]] - }); + ]] + }); + layer.closeAll(); + } + }, 10); }; courseInfoTable(); /*新增章目录*/ @@ -335,16 +342,15 @@ }; addOpen("",'子章节名称',"",param); }else if (obj.event === 'updataResources') {//上传资源 - var that = this; updataResourcesOpen(); }else if (obj.event === 'addLine') {//添加链接 - addLine(); + addLine(data.courseInfoId); } else if (obj.event === 'addPW') {//添加图文 - addPW(); + addPW(data.courseInfoId); }else if (obj.event === 'look') {//查看 Lib.downloadFile(data); }else if (obj.event === 'update') {//上传 - updataResourcesOpenLocal(); + updataResourcesOpen(); }else if(obj.event === 'edit'){ var title="章节目录"; var param = {}; @@ -571,7 +577,7 @@ /*资源表格搜索*/ function searchList() { var param = { - "courseInfoId": $("#edit_dialog select[name='courseInfoId_1']").val(), + "courseInfoId_0": $("#edit_dialog select[name='courseInfoId_1']").val(), "resourcesInfoName": $("#edit_dialog input[name = 'resourcesInfoName']").val() }; resourcesTable.reload({ @@ -583,7 +589,7 @@ } /*添加链接*/ - function addLine() { + function addLine(courseInfoId) { layer.open({ type: 1, title: "添加链接", @@ -591,7 +597,6 @@ btn: ['保存', '关闭'], content: $("#addLine_dialog"), success: function (layero, index) { - }, yes: function (index) { var resourcesInfoName = $("#addLine_dialog input[name='resourcesInfoName']").val(); var resourcesInfoContent = $("#addLine_dialog input[name='resourcesInfoContent']").val(); @@ -611,30 +616,41 @@ }); return; } - var param = {resourcesInfoName: resourcesInfoName, resourcesInfoContent: resourcesInfoContent,resourcesInfoType:4}; - Common.info("保存成功!!"); - console.log(param) - layer.close(index); - return; - var ret = Common.postAjax("/jlw/courseInfo/edit.json", param); - layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, { - offset: ['50%'], - icon: ret.code == 0 ? 1 : 2, - time: 1500 //2秒关闭(如果不配置,默认是3秒) - }, function () { - if (ret.code == 0) { - layer.close(index); - } + var param = { + 'resourcesInfoName': resourcesInfoName, + 'resourcesInfoContent': resourcesInfoContent, + 'resourcesInfoType':4, + 'courseInfoId':courseInfoId + }; + + layer.load(0,{ + shadeClose: false, + shade: [0.5] }); + setTimeout(function () { + var ret = Common.postAjax("/jlw/resourcesInfo/add.json", param); + layer.close(); + layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, { + offset: ['50%'], + icon: ret.code == 0 ? 1 : 2, + time: 1500 //2秒关闭(如果不配置,默认是3秒) + },function () { + if (ret.code == 0) { + courseInfoTable(); + layer.close(index); + } + }); + }, 50); + }, btn2: function (index, layero) { layer.close(index); } }); } - var courseInfoContent_ = layedit.build('resourcesInfoFiles', {height: 200}); //题干 + var courseInfoContent_ = layedit.build('resourcesInfoContent', {height: 200}); //题干 /*添加图文*/ - function addPW() { + function addPW(courseInfoId) { layer.open({ type: 1, title: "添加图文", @@ -645,30 +661,40 @@ }, yes: function (index) { var resourcesInfoName = $("#addPW_dialog input[name='resourcesInfoName']").val(); - var resourcesInfoFiles = layedit.getContent(courseInfoContent_); + var resourcesInfoContent = layedit.getContent(courseInfoContent_); if ($.isEmpty(resourcesInfoName)) { - layer.msg("请输入资源名称!", { + layer.msg("请输入图文名称!", { offset: ['50%'], icon: 2, time: 2000 //2秒关闭(如果不配置,默认是3秒) }); return; } - var param = {resourcesInfoName: resourcesInfoName, resourcesInfoFiles: resourcesInfoFiles}; - Common.info("保存成功!!"); - console.log(param) - layer.close(index); - return; - var ret = Common.postAjax("/jlw/courseInfo/edit.json", param); - layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, { - offset: ['50%'], - icon: ret.code == 0 ? 1 : 2, - time: 1500 //2秒关闭(如果不配置,默认是3秒) - }, function () { - if (ret.code == 0) { - layer.close(index); - } + var param = { + 'resourcesInfoName': resourcesInfoName, + 'resourcesInfoContent': resourcesInfoContent, + 'resourcesInfoType':5, + 'courseInfoId':courseInfoId + }; + layer.load(0,{ + shadeClose: false, + shade: [0.5] }); + setTimeout(function () { + var ret = Common.postAjax("/jlw/resourcesInfo/add.json", param); + layer.close(); + layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, { + offset: ['50%'], + icon: ret.code == 0 ? 1 : 2, + time: 1500 //2秒关闭(如果不配置,默认是3秒) + }, function () { + if (ret.code == 0) { + layer.close(index) + courseInfoTable(); + } + }); + }, 10); + }, btn2: function (index, layero) { layer.close(index); }