diff --git a/web/src/main/resources/static/js/jlw/handsOnSimulationTasks/add.js b/web/src/main/resources/static/js/jlw/handsOnSimulationTasks/add.js
index 84a042b3..0e687d8b 100644
--- a/web/src/main/resources/static/js/jlw/handsOnSimulationTasks/add.js
+++ b/web/src/main/resources/static/js/jlw/handsOnSimulationTasks/add.js
@@ -1,12 +1,16 @@
layui.define([ 'form','laytpl', 'laydate', 'table','element','handsOnSimulationTasksApi', 'upload', 'layedit','layer','table'], function(exports) {
- var form = layui.form;
- var laytpl = layui.laytpl;
var handsOnSimulationTasksApi = layui.handsOnSimulationTasksApi;
- var index = layui.index;
- var element = layui.element, upload = layui.upload, layedit = layui.layedit
+ var form = layui.form,
+ laytpl = layui.laytpl,
+ index = layui.index,
+ element = layui.element,
+ upload = layui.upload,
+ layedit = layui.layedit,
+ layer = layui.layer,
+ table = layui.table;
+
element.render();
- var layer = layui.layer;
- var table = layui.table;
+
layedit.set({ //富文本上传图片
uploadImage: {
url: Common.ctxPath + "/jlw/file/update.do",
@@ -20,6 +24,7 @@ layui.define([ 'form','laytpl', 'laydate', 'table','element','handsOnSimulationT
var selectResourcesQuestion = [];
var tableData4 = [];
var resourcesQuestionIds = ""; //选中题目id
+ var resourcesInfoTable = [];
var courseInfoIds = $("input[name=courseInfoId_1]").val();
var typeInfo = $("#taskTypeInfo input[name='taskType']:checked").val(); //当前操作的类型
@@ -72,18 +77,20 @@ layui.define([ 'form','laytpl', 'laydate', 'table','element','handsOnSimulationT
,url: Common.ctxPath +'/jlw/file/update.do'
,accept:'video'
, progress: function(value) {
- element.progress('progressBar',value + '%');
+ var v =
+ element.progress('progressBar',v);
}
,choose: function(obj){
$("#mp4Info").append('
\n' +
'
\n' +
- '
\n' +
+ '
\n' +
'
\n' +
'
\n' +
- '
\n' +
+ '
\n' +
'
\n' +
'
X\n' +
'
');
+ element.init();//进度条更新
},
before: function(obj) {
obj.preview(function(index, file, result) {
@@ -92,6 +99,7 @@ layui.define([ 'form','laytpl', 'laydate', 'table','element','handsOnSimulationT
var size = (file.size/1014).toFixed(1)+'kb';
$('.progressCss_mp4:last .mv_m').html(size);
});
+
}
,done: function(res){
//如果上传失败
@@ -127,13 +135,14 @@ layui.define([ 'form','laytpl', 'laydate', 'table','element','handsOnSimulationT
,choose: function(obj){
$("#pptInfo").append('\n' +
'
\n' +
- '
\n' +
+ '
\n' +
'
\n' +
'
\n' +
- '
\n' +
+ '
\n' +
'
\n' +
'
X\n' +
'
');
+ element.init();//进度条更新
},
before: function(obj) {
obj.preview(function(index, file, result) {
@@ -179,13 +188,14 @@ layui.define([ 'form','laytpl', 'laydate', 'table','element','handsOnSimulationT
choose: function(obj){
$("#fileInfo").append('\n' +
'
\n' +
- '
\n' +
+ '
\n' +
'
\n' +
'
\n' +
- '
\n' +
+ '
\n' +
'
\n' +
'
X\n' +
'
');
+ element.init();//进度条更新
},
before: function(obj) {
obj.preview(function(index, file, result) {
@@ -603,5 +613,201 @@ layui.define([ 'form','laytpl', 'laydate', 'table','element','handsOnSimulationT
getScoreInfo();
});
}
+
+ $("#videoClick").click(function (obj) {
+ updataResourcesOpenRe("",1);
+ });
+
+ /*资源库上传弹出框*/
+ function updataResourcesOpenRe(dataOld,resourcesInfoType) {
+ layer.open({
+ type: 1,
+ title: "资源库上传",
+ shadeClose: true,
+ btn: ['保存', '关闭'],
+ btnAlign: 'c',
+ area: ['820px', '600px'],
+ content: $("#edit_dialog"),
+ success: function (layero, index) {
+ loadResourcesInfo(resourcesInfoType);
+ $(".search").unbind();
+ $(".search").click(function () {searchList(resourcesInfoType);}); //搜索
+ }, yes: function (index) {
+ var checkStatus = table.checkStatus("resourcesInfoTable"); //获取选中行状态
+ var dataNew = checkStatus.data, ids = Common.concatBatchId(dataNew, "resourcesInfoId"); //获取选中行数据
+
+ resourcesInfoShowTable(dataNew)
+
+ form.render()
+ layer.close(index);
+ }, btn2: function (index, layero) {
+ layer.close(index);
+ }
+ });
+ }
+
+ //资源库表格
+ function loadResourcesInfo(resourcesInfoType) {
+ $("#edit_dialog input[name='resourcesInfoName']").val("");
+ resourcesInfoTable = table.render({
+ elem: '#resourcesInfoTable',
+ height: Lib.getTableHeight(),
+ cellMinWidth: 100,
+ method: 'post',
+ even: true,
+ //url: Common.ctxPath + '/jlw/resourcesInfo/list.json' // 数据接口
+ url: Common.ctxPath + '/jlw/resourcesInfo/resourcesList.json' // 数据接口
+ , where: getParamRe(resourcesInfoType)
+ , page: Lib.tablePage // 开启分页
+ , limit: 10,
+ cols: [[ // 表头
+ {
+ type: 'checkbox'
+ },
+ {
+ field: 'resourcesInfoName', title: '资源名称', align: "center", style: "text-align: left;"
+ },
+ {
+ field: 'courseInfoParentParentName', title: '归属课程', align: "center", width: 150
+ },
+ {
+ field: 'resourcesInfoType', width: 150, title: '资源类型', align: "center", templet: function (d) {//(1视频 2PPT 3PDF)
+ var text = d.resourcesInfoType == 1 ? "视频" : d.resourcesInfoType == 2 ? "PPT" : d.resourcesInfoType == 3 ? "PDF" : d.resourcesInfoType == 4 ? "链接" : d.resourcesInfoType == 5 ? "图文" : '-';
+ return '' + text + '';
+ }
+ },
+ {
+ field: 'userId',
+ title: '操作',
+ width: 80,
+ align: "center",
+ templet: function (d) {
+ var htm = '';
+ return htm;
+ }
+ }
+ ]]
+ });
+ table.on('tool(resourcesInfoTable)', function (obj) {
+ var data = obj.data;
+ if (obj.event === 'previewPage') { //预览
+ Lib.downloadFile(data);
+ }
+ });
+ table.on('checkbox(resourcesInfoTable)', function(obj){
+ var htm = "已选中:";
+ var resourcesInfoTable = obj.data;
+ if(obj.checked){
+ htm += table.checkStatus("resourcesInfoTable").data.length;
+ //按钮逻辑Lib.buttonEnable()
+ }else{
+ htm += table.checkStatus("resourcesInfoTable").data.length;
+ }
+ $("#checkNumber").html(htm)
+ })
+ }
+
+ function resourcesInfoShowTable(data) {
+ table.render({
+ elem: '#resourcesInfoShowTable',
+ height: Lib.getTableHeight(),
+ cellMinWidth: 100,
+ method: 'post',
+ even: true,
+ data:data,
+ cols: [[ // 表头
+ {
+ field: 'resourcesInfoName', title: '资源名称', align: "center", style: "text-align: left;"
+ },
+ {
+ field: 'courseInfoParentParentName', title: '归属课程', align: "center", width: 150
+ },
+ {
+ field: 'resourcesInfoType', width: 150, title: '资源类型', align: "center", templet: function (d) {//(1视频 2PPT 3PDF)
+ var text = d.resourcesInfoType == 1 ? "视频" : d.resourcesInfoType == 2 ? "PPT" : d.resourcesInfoType == 3 ? "PDF" : d.resourcesInfoType == 4 ? "链接" : d.resourcesInfoType == 5 ? "图文" : '-';
+ return '' + text + '';
+ }
+ },
+ {
+ field: 'userId',
+ title: '操作',
+ width: 160,
+ align: "center",
+ templet: function (d) {
+ var htm = '';
+ htm += '';
+ return htm;
+ }
+ }
+ ]]
+ });
+ table.on('tool(resourcesInfoShowTable)', function (obj) {
+ var data = obj.data;
+ if (obj.event === 'previewPage') { //预览
+ Lib.downloadFile(data);
+ }else if(obj.event === 'del'){
+ /*
+ resourcesInfoTable.reload({
+ where: getParamRe(resourcesInfoType),
+ page: {
+ curr: 1
+ }
+ });*/
+ console.log(table.cache.resourcesInfoShowTable)
+ }
+ });
+ }
+
+ /*资源数据提交*/
+ function postResourcesInfo(id, param,index) {
+ layer.load(0,{
+ shadeClose: false,
+ shade: [0.5]
+ });
+ setTimeout(function () {
+ var url = "/jlw/resourcesInfo/add.json";
+ if (!$.isEmpty(id)) {
+ url = "/jlw/resourcesInfo/edit.json";
+ }
+ var ret = Common.postAjax(url, param);
+ if (ret.code == 0) {
+ layer.close(index);
+ courseInfoTable();
+ }
+ layer.msg(ret.code == 0 ? "操作成功!" : ret.msg, {
+ offset: ['50%'],
+ icon: ret.code == 0 ? 1 : 2,
+ time: 1500 //2秒关闭(如果不配置,默认是3秒)
+ }, function () {
+
+ layer.closeAll();
+ if (ret.code == 0) {
+ Lib.tableRefresh();
+ }
+ });
+ }, 50);
+ }
+
+ /*资源表格搜索*/
+ /*资源表格搜索*/
+ function searchList(resourcesInfoType) {
+ resourcesInfoTable.reload({
+ where: getParamRe(resourcesInfoType),
+ page: {
+ curr: 1
+ }
+ });
+ }
+
+ /*资源库搜索条件*/
+ function getParamRe(resourcesInfoType){
+ var param = {
+ "courseInfoFullId": $("#edit_dialog select[name='courseInfoId_1']").val(),
+ "resourcesInfoName": $("#edit_dialog input[name = 'resourcesInfoName']").val(),
+ "resourcesInfoType":resourcesInfoType
+ };
+ return param;
+ }
+
exports('add',view);
});
diff --git a/web/src/main/resources/templates/jlw/handsOnSimulationTasks/add.html b/web/src/main/resources/templates/jlw/handsOnSimulationTasks/add.html
index e76d9b60..70f34e07 100644
--- a/web/src/main/resources/templates/jlw/handsOnSimulationTasks/add.html
+++ b/web/src/main/resources/templates/jlw/handsOnSimulationTasks/add.html
@@ -119,7 +119,11 @@
添加视频
+
@@ -509,6 +516,10 @@
+
+
@@ -521,6 +532,7 @@
type="button" id="addButton" lay-submit="" lay-filter="form">确定
+