diff --git a/admin-core/src/main/resources/static/js/common.js b/admin-core/src/main/resources/static/js/common.js index 1b26efa3..4acf3893 100644 --- a/admin-core/src/main/resources/static/js/common.js +++ b/admin-core/src/main/resources/static/js/common.js @@ -383,7 +383,7 @@ var Common = { ajaxInit: function() { var _role_tag = getHeadTag(); var key = getCookie(_role_tag); - // $.ajaxSetup({headers: { token: getCookie(key) , _role_tag}}) + return {token: getCookie(key) , _role_tag}; }, /** * cookie获取 @@ -401,10 +401,10 @@ var Common = { return va; }, post: function (url, paras, next) { - this.ajaxInit() $.ajax({ url: Common.ctxPath + url, type: "POST", + headers: this.ajaxInit(), data: paras, success: function (rsp) { if (rsp.code != 0) { @@ -429,10 +429,10 @@ var Common = { }, postJSON: function (url, paras, next) { var r = ""; - this.ajaxInit() $.ajax({ url: Common.ctxPath + url, type: "POST", + headers: this.ajaxInit(), contentType:'application/json;charset=utf-8', dataType:'json', data: paras, @@ -462,11 +462,11 @@ var Common = { }, postAjax: function (url, paras) { var r = ""; - this.ajaxInit() $.ajax({ url: Common.ctxPath + url, async: false, type: "POST", + headers: this.ajaxInit(), data: paras, dataType: "json", success: function (rsp) { @@ -482,12 +482,13 @@ var Common = { }, getAjax: function (url, paras) { var r = ""; - this.ajaxInit() + $.ajax({ url: Common.ctxPath + url, async: false, type: "GET", data: paras, + headers: this.ajaxInit(), dataType: "json", success: function (rsp) { r = rsp; diff --git a/web/src/main/java/com/ibeetl/jlw/web/IndexController.java b/web/src/main/java/com/ibeetl/jlw/web/IndexController.java index f85d6b68..10a5b9af 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/IndexController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/IndexController.java @@ -931,8 +931,7 @@ public class IndexController { log.error("教师用户信息:"+ JSONUtil.toJsonStr(teacher)); log.error("学生用户信息:"+ JSONUtil.toJsonStr(student)); - - String roleTagCopy = StringUtils.isNotBlank(roleTag) ? ( "?_role_tag=" + roleTag ) : getLastRoleTag(); + String roleTagCopy = StringUtils.isNotBlank(roleTag) ? ( "?_role_tag=" + roleTag ) : "";//getLastRoleTag() try { //判断是老师还是学生 diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnController.java index 64c4e879..3513e76c 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnController.java @@ -1,8 +1,10 @@ package com.ibeetl.jlw.web; +import cn.hutool.core.collection.ListUtil; import cn.jlw.Interceptor.SCoreUser; import cn.jlw.util.ToolUtils; import cn.jlw.validate.ValidateConfig; +import com.alibaba.fastjson.JSON; import com.ibeetl.admin.core.annotation.Function; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.file.FileService; @@ -99,9 +101,10 @@ public class TeacherOpenCourseHandsOnController{ @GetMapping(MODEL + "/index.do") @Function("teacherOpenCourseHandsOn.query") - public ModelAndView index() { + public ModelAndView index(Long teacherOpenCourseId) { ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseHandsOn/index.html") ; view.addObject("search", TeacherOpenCourseHandsOnQuery.class.getName()); + view.addObject("teacherOpenCourseId", teacherOpenCourseId); return view; } @@ -239,6 +242,128 @@ public class TeacherOpenCourseHandsOnController{ } + // + /** + * 实操列表导出信息 + * @param teacherOpenCourseId 开课ID + * @param classId 班级ID + * @param coreUser + * @return + */ + @GetMapping(MODEL + "/getHandsOnList/export.json") + public JsonResult getHandsOnListExport(GetHandsOnListParam param, + HttpServletRequest request, + HttpServletResponse response, + @SCoreUser CoreUser coreUser) { + if(null == coreUser){ + return JsonResult.failMessage("请登录后再操作"); + }else{ + PageQuery list = teacherOpenCourseHandsOnService.getHandsOnList(param); + + HSSFWorkbook workbook = null; + try { + //表头数据 + String[] header = { + "项目名称", + "观看视频平均得分", + "观看PPT平均得分", + "理论测评平均得分", + "实训操作步骤平均得分", + "报告撰写平均得分" + }; + String[] headerCode = { + "handsOnName", + "videoAvgScore", + "pptAvgScore", + "theoryAvgScore", + "stepAvgScore", + "reportAvgScore" + }; + //数据内容 + List hands = list.getList(); + //内容宽度 + List mapList = JSON.parseArray(JSON.toJSONString(hands), Map.class); + Map widthMap = mapList.get(0); + //声明一个工作簿 + workbook = new HSSFWorkbook(); + //生成一个表格,设置表格名称为"Sheet1" + HSSFSheet sheet = workbook.createSheet("Sheet1"); + //冻结表头 + sheet.createFreezePane(0, 1, 0, 1); + //设置默认列宽度为5个字节 + sheet.setDefaultColumnWidth(5); + //创建第一行表头 + HSSFRow headRow = sheet.createRow(0); + //头部样式 + HSSFCellStyle headerStyle = workbook.createCellStyle(); + //垂直居中 + headerStyle.setVerticalAlignment(VerticalAlignment.CENTER); + //水平居中 + headerStyle.setAlignment(HorizontalAlignment.CENTER); + //单元格样式 + HSSFCellStyle cellStyle = workbook.createCellStyle(); + //垂直居中 + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + //水平居左 + cellStyle.setAlignment(HorizontalAlignment.CENTER); + //自动换行 + cellStyle.setWrapText(true); + //遍历添加表头 + for (int i = 0; i < header.length; i++) { + //设置表格特定的列宽度 + if (null != widthMap.get(headerCode[i])) { + String width = widthMap.get(headerCode[i]).toString().split("\\.")[0]; + int w = Math.max(width.length(), header[i].length() * 3); + sheet.setColumnWidth(i, w * 190); + } + //创建一个单元格 + HSSFCell cell = headRow.createCell(i); + //创建一个内容对象 + HSSFRichTextString text = new HSSFRichTextString(header[i]); + //将内容对象的文字内容写入到单元格中 + cell.setCellValue(text); + //设置样式 + cell.setCellStyle(headerStyle); + } + //遍历结果集,把内容加入表格 + for (int i = 0; i < mapList.size(); i++) { + HSSFRow row = sheet.createRow(i + 1); + row.setHeight((short) (50*10)); + Map map = mapList.get(i); + for (int j = 0; j < headerCode.length; j++) { + HSSFCell cell = row.createCell(j); + cell.setCellStyle(cellStyle); + HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " "); + cell.setCellValue(text); + } + } + //准备将Excel的输出流通过response输出到页面下载 + //八进制输出流 + response.setContentType("application/octet-stream"); + //这后面可以设置导出Excel的名称,此例中名为student.xls + String fileName = ToolUtils.web2fileName(request,"teacherOpenCourseHandsOn(" + TimeTool.getNowTime("YMD") + ").xls"); + response.setHeader("Content-disposition", "attachment;filename="+fileName); + //刷新缓冲 + response.flushBuffer(); + //workbook将Excel写入到response的输出流中,供页面下载 + workbook.write(response.getOutputStream()); + }catch (Exception e){ + e.printStackTrace(); + } finally { + try { + if (null != workbook) { + workbook.close(); + } + if (null != response && null != response.getOutputStream()) { + response.getOutputStream().close(); + } + } catch (Exception e) { } + } + + return JsonResult.success(list); + } + } + /** * 实操列表上方数值 * @param teacherOpenCourseId 开课ID diff --git a/web/src/main/resources/static/js/jlw/teacherOpenCourseHandsOn/index.js b/web/src/main/resources/static/js/jlw/teacherOpenCourseHandsOn/index.js index e2e91af3..23f67328 100644 --- a/web/src/main/resources/static/js/jlw/teacherOpenCourseHandsOn/index.js +++ b/web/src/main/resources/static/js/jlw/teacherOpenCourseHandsOn/index.js @@ -1,16 +1,42 @@ -layui.define([ 'form', 'laydate', 'table' ], function(exports) { +layui.define([ 'form', 'laydate', 'table','laytpl' ], function(exports) { var form = layui.form; var laydate = layui.laydate; var table = layui.table; + var laytpl = layui.laytpl; + var teacherOpenCourseHandsOnTable = null; + var teacherOpenCourseId = $("input[name='teacherOpenCourseId']").val(); + var data={}; + + var ret = Common.getAjax("/jlw/teacherOpenCourseHandsOn/getHandsOnListCount.do?teacherOpenCourseId"+teacherOpenCourseId); + if(ret.code==0){ + data = ret.data; + }else { + Common.info(ret.msg); + } + if ($.isEmpty(data)) { + data = { + videoAvgScore: '', + pptAvgScore: '', + theoryAvgScore: '', + stepAvgScore: '', + reportAvgScore: '' + }; + } + var getTpl = demo.innerHTML + ,view = document.getElementById('view'); + laytpl(getTpl).render(data, function(html){ + view.innerHTML = html; + }); + var view ={ init:function(){ - var that = this + var that = this; this.initTable(); this.initSearchForm(); this.initToolBar(); window.dataReload = function(){ - Lib.doSearchForm($("#searchForm"),teacherOpenCourseHandsOnTable) + Lib.doSearchForm($("#searchForm"),teacherOpenCourseHandsOnTable); that.initToolBar(); } }, @@ -21,94 +47,76 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { elem : '#teacherOpenCourseHandsOnTable', height : Lib.getTableHeight(1), cellMinWidth: 100, - method : 'post', - url : Common.ctxPath + '/jlw/teacherOpenCourseHandsOn/list.json' // 数据接口 + method : 'get', + url : Common.ctxPath + '/jlw/teacherOpenCourseHandsOn/getHandsOnList.do' // 数据接口 /server + ,where:{"teacherOpenCourseId":teacherOpenCourseId} ,page : Lib.tablePage // 开启分页 - ,toolbar: '#toolbar_teacherOpenCourseHandsOn' //自定义头部左侧工具栏 - ,defaultToolbar: ['filter', 'print', 'exports'] //头部右侧工具栏 ,limit : 10, cols : [ [ // 表头 { - type : 'checkbox', - + type : 'numbers', + title:'序号' }, { - field : 'handsOnId', - title : '实操主键', - align:"center", - hideField :false, - hide:$.isEmpty(sx_['handsOnId'])?false:sx_['handsOnId'], - - width : 60, - }, - { - field : 'teacherOpenCourseId', - title : '开课ID', - align:"center", - hideField :false, - hide:$.isEmpty(sx_['teacherOpenCourseId'])?false:sx_['teacherOpenCourseId'], - }, - { - field : 'courseInfoId', - title : '归属课程', - align:"center", - hideField :false, - hide:$.isEmpty(sx_['courseInfoId'])?false:sx_['courseInfoId'], - }, - { - field : 'courseChildNode', - title : '归属章节', - align:"center", - hideField :false, - hide:$.isEmpty(sx_['courseChildNode'])?false:sx_['courseChildNode'], - }, - { - field : 'handsOnName', - title : '实操名称', + field : 'handsOnName', + title : '项目名称', align:"center", hideField :false, - hide:$.isEmpty(sx_['handsOnName'])?false:sx_['handsOnName'], + hide:$.isEmpty(sx_['handsOnName'])?false:sx_['handsOnName'] }, { - field : 'handsOnRecommend', - title : '实操介绍', + field : 'videoAvgScore', + title : '观看视频平均得分', align:"center", hideField :false, - hide:$.isEmpty(sx_['handsOnRecommend'])?false:sx_['handsOnRecommend'], + hide:$.isEmpty(sx_['videoAvgScore'])?false:sx_['videoAvgScore'], + templet:function (d) { + var htm = ''+d.videoAvgScore+''; + return htm + } }, { - field : 'addTime', - title : '添加时间', + field : 'pptAvgScore', + title : '观看PPT平均得分', align:"center", hideField :false, - hide:$.isEmpty(sx_['addTime'])?false:sx_['addTime'], + hide:$.isEmpty(sx_['pptAvgScore'])?false:sx_['pptAvgScore'], + templet:function (d) { + var htm = ''+d.pptAvgScore+''; + return htm + } }, { - field : 'orgId', - title : '组织机构ID', + field : 'theoryAvgScore', + title : '理论测评平均得分', align:"center", hideField :false, - hide:$.isEmpty(sx_['orgId'])?false:sx_['orgId'], + hide:$.isEmpty(sx_['theoryAvgScore'])?false:sx_['theoryAvgScore'], + templet:function (d) { + var htm = ''+d.theoryAvgScore+''; + return htm + } }, { - field : 'userId', - title : '后台用户ID', + field : 'stepAvgScore', + title : '实训操作步骤平均得分', align:"center", hideField :false, - hide:$.isEmpty(sx_['userId'])?false:sx_['userId'], + hide:$.isEmpty(sx_['stepAvgScore'])?false:sx_['stepAvgScore'], + templet:function (d) { + var htm = ''+d.stepAvgScore+''; + return htm + } }, { - field : 'trainingData', - title : '数据集(多个地址,逗号隔开)', + field : 'reportAvgScore', + title : '报告撰写平均得分', align:"center", hideField :false, - hide:$.isEmpty(sx_['trainingData'])?false:sx_['trainingData'], - } - ,{ - field : 'operation_',title : '操作',align:"center", templet: function (d) { - var htm = ''; - htm += ''; - return htm; + hide:$.isEmpty(sx_['reportAvgScore'])?false:sx_['reportAvgScore'], + templet:function (d) { + var htm = ''+d.reportAvgScore+''; + return htm } } @@ -159,6 +167,16 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { Lib.doSearchForm($("#searchForm"), teacherOpenCourseHandsOnTable, 1); view.initToolBar() }, + addButton_cancel:function () { + + parent.Lib.tableRefresh(); + Lib.closeFrame(); + },exportDocument:function () { console.log("h") + /*layer.confirm('是否确定导出课程实操汇总表吗?', function (index) { + $.downFile(Common.ctxPath + "/jlw/teacherOpenCourseStudentSigninSetting/exportSummary.json?teacherOpenCourseId=" + teacherOpenCourseId,'签到汇总表'); + layer.close(index); + });*/ + }, } //触发事件 $('.ext-toolbar').on('click', function() { @@ -184,6 +202,15 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { } }); }); + }else if(obj.event === "videoAvgScore"){ +//teacherOpenCourseId handsOnId + //搜索条件studentOrName + }else if(obj.event === "pptAvgScore"){ + + }else if(obj.event === "theoryAvgScore"){ + }else if(obj.event === "stepAvgScore"){ + + }else if(obj.event === "reportAvgScore"){ } }) } diff --git a/web/src/main/resources/static/js/jlw/teacherOpenCourseMergeCourseInfo/index.js b/web/src/main/resources/static/js/jlw/teacherOpenCourseMergeCourseInfo/index.js index 3e817cc7..4352caeb 100644 --- a/web/src/main/resources/static/js/jlw/teacherOpenCourseMergeCourseInfo/index.js +++ b/web/src/main/resources/static/js/jlw/teacherOpenCourseMergeCourseInfo/index.js @@ -168,8 +168,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { var url = "/jlw/questionLogSummary/index.do?teacherOpenCourseId=" + data.teacherOpenCourseId + "&questionSettingType=CHAPTER_EXERCISE"; Common.openDlg(url,"《"+title+"》/ 章节练习存档"); }else if(obj.event === "kcsc"){ - - var url = "/jlw/questionLogSummary/index.do?teacherOpenCourseId="+data.teacherOpenCourseId; + var url = "/jlw/teacherOpenCourseHandsOn/index.do?teacherOpenCourseId="+data.teacherOpenCourseId; Common.openDlg(url,"《"+title+"》/ 课程实操存档"); } else if (obj.event === "homework") { var url = "/jlw/questionLogSummary/homeworkIndex.do?teacherOpenCourseId=" + data.teacherOpenCourseId; diff --git a/web/src/main/resources/templates/jlw/studentClientLink/applicationOther.html b/web/src/main/resources/templates/jlw/studentClientLink/applicationOther.html index 265ad01f..20bb797a 100644 --- a/web/src/main/resources/templates/jlw/studentClientLink/applicationOther.html +++ b/web/src/main/resources/templates/jlw/studentClientLink/applicationOther.html @@ -90,7 +90,12 @@ title : '应用链接',align:"center" },{ field : 'studentClientLinkImg', - title : '应用图片',align:"center" + title : '应用图片',align:"center", + // templet: function (d) { + // return '' + + // '"'+ + // '' + // } }, { field : 'studentClientLinkDesc', @@ -158,6 +163,24 @@ Common.openDlg(url,"应用管理/编辑应用"); }else if(obj.event === "del"){ deleteInfo(data.studentClientLinkId); + }else if(obj.event === "photos"){ + var json ={ + "title": "", //相册标题 + "id": 123, //相册id + "start": 0, //初始显示的图片序号,默认0 + "data": [ //相册包含的图片,数组格式 + { + "alt": "图片名", + "pid": 666, //图片id + "src": Common.ctxPath + data.studentClientLinkImg, //原图地址 + "thumb": "" //缩略图地址 + } + ] + } + layer.photos({ + photos: json + ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) + }); } }) } diff --git a/web/src/main/resources/templates/jlw/teacherOpenCourseHandsOn/index.html b/web/src/main/resources/templates/jlw/teacherOpenCourseHandsOn/index.html index 60ed4993..70a8ac2b 100644 --- a/web/src/main/resources/templates/jlw/teacherOpenCourseHandsOn/index.html +++ b/web/src/main/resources/templates/jlw/teacherOpenCourseHandsOn/index.html @@ -1,25 +1,47 @@ - - +
+ 返回 +
+ 导出 +
+
+
+
+
+ + +
+ - + + <!–# if(core.searchIsShow(search)) {–> 搜索 - + <!–# }–> 添加 修改 删除 - + <!–# if(!isEmpty(search)) {–> 刷新 - + <!–# }–> -