@ -21,6 +21,10 @@ layui.define([ 'form', 'laydate', 'table','teacherOpenCourseHandsOnSimulationTas
var selectResourcesQuestion = [ ] ;
var tableData4 = [ ] ;
var resourcesQuestionIds = "" ; //选中题目id
var resourcesInfoTable = [ ] ; //资源库的table
var resourcesInfoShowTable = [ ] //选中视频资源后展示的table
var resourcesInfoShowPPTTable = [ ] ; //选中PPT资源后展示的table
var checkStatusData = [ ] ; //资源选中data
var teacherOpenCourseId = $ ( "input[name=teacherOpenCourseId]" ) . val ( ) ;
var typeInfo = $ ( "#taskTypeInfo input[name='taskType']:checked" ) . val ( ) ; //当前操作的类型
@ -74,7 +78,7 @@ layui.define([ 'form', 'laydate', 'table','teacherOpenCourseHandsOnSimulationTas
'<span type="text" class="nameV" style="width: 300px"></span>\n' +
'<span class="mv_m" style="float: right;"></span>\n' +
'<span class="fileUrl" style="display: none;"></span>\n' +
'<div class="layui-progress " lay-showPercent="yes" lay-filter="progressBar" style="margin-top: 1 5px ; width:300px">\n' +
'<div class="layui-progress " lay-showPercent="yes" lay-filter="progressBar" style="margin-top: 1 3% ; width:300px">\n' +
'<div class="layui-progress-bar layui-bg-blue" lay-percent="100%"></div>\n' +
'</div>\n' +
'<span class="closeInfo">X</span>\n' +
@ -116,7 +120,7 @@ layui.define([ 'form', 'laydate', 'table','teacherOpenCourseHandsOnSimulationTas
elem : '#upload-normalPPT'
, url : Common . ctxPath + '/jlw/file/update.do'
, accept : 'file'
, exts : 'ppt|pps|pptx|ppsx|pot|ppa '
, exts : 'ppt|pps|pptx|ppsx|pot|ppa |pdf '
, progress : function ( value ) {
element . progress ( 'progressBarPPT' , value + '%' ) ;
}
@ -125,11 +129,12 @@ layui.define([ 'form', 'laydate', 'table','teacherOpenCourseHandsOnSimulationTas
'<span type="text" class="nameV" style="width: 300px"></span>\n' +
'<span class="mv_m" style="float: right;"></span>\n' +
'<span class="fileUrl" style="display: none;"></span>\n' +
'<div class="layui-progress " lay-showPercent="yes" lay-filter="progressBarPPT" style="margin-top: 1 5px ; width:300px">\n' +
'<div class="layui-progress-bar layui-bg-blue" lay-percent=" 0%"></div>\n' +
'<div class="layui-progress " lay-showPercent="yes" lay-filter="progressBarPPT" style="margin-top: 1 3% ; width:300px">\n' +
'<div class="layui-progress-bar layui-bg-blue" lay-percent=" 10 0%"></div>\n' +
'</div>\n' +
'<span class="closeInfo">X</span>\n' +
'</div>' ) ;
element . init ( ) ; //进度条更新
} ,
before : function ( obj ) {
obj . preview ( function ( index , file , result ) {
@ -177,11 +182,12 @@ layui.define([ 'form', 'laydate', 'table','teacherOpenCourseHandsOnSimulationTas
'<span type="text" class="nameV" style="width: 300px"></span>\n' +
'<span class="mv_m" style="float: right;"></span>\n' +
'<span class="fileUrl" style="display: none;"></span>\n' +
'<div class="layui-progress " lay-showPercent="yes" lay-filter="progressBarFile" style="margin-top: 1 5px ; width:300px">\n' +
'<div class="layui-progress-bar layui-bg-blue" lay-percent=" 0%"></div>\n' +
'<div class="layui-progress " lay-showPercent="yes" lay-filter="progressBarFile" style="margin-top: 1 3% ; width:300px">\n' +
'<div class="layui-progress-bar layui-bg-blue" lay-percent=" 10 0%"></div>\n' +
'</div>\n' +
'<span class="closeInfo">X</span>\n' +
'</div>' ) ;
element . init ( ) ; //进度条更新
} ,
before : function ( obj ) {
obj . preview ( function ( index , file , result ) {
@ -537,6 +543,8 @@ layui.define([ 'form', 'laydate', 'table','teacherOpenCourseHandsOnSimulationTas
editor . setToolbarAutoFixed ( false ) ;
}
}
resourcesInfoShowTable . reload ( { data : [ ] } ) ;
resourcesInfoShowPPTTable . reload ( { data : [ ] } ) ;
// $("input[name='taskTitle']").val("");
// $("input[name='taskScore']").val("");
// $("input[name='taskOrder']").val("");
@ -602,5 +610,222 @@ layui.define([ 'form', 'laydate', 'table','teacherOpenCourseHandsOnSimulationTas
getScoreInfo ( ) ;
} ) ;
}
//视频资源库button
$ ( "#videoClick" ) . click ( function ( obj ) {
updataResourcesOpenRe ( 1 ) ;
} ) ;
//PPT资源库button
$ ( "#pptClick" ) . click ( function ( obj ) {
updataResourcesOpenRe ( 2 ) ;
} ) ;
/*资源库上传弹出框*/
function updataResourcesOpenRe ( resourcesInfoType ) {
checkStatusData = [ ] ;
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 ) ; } ) ; //搜索
table . reload ( 'resourcesInfoTable' ) ; //刷新table
} , yes : function ( index ) {
var checkStatus = table . checkStatus ( "resourcesInfoTable" ) ; //获取选中行状态
var dataNew = checkStatus . data , ids = Common . concatBatchId ( dataNew , "resourcesInfoId" ) ; //获取选中行数据
if ( resourcesInfoType == 1 ) {
resourcesInfoShowInfo ( dataNew )
} else if ( resourcesInfoType == 2 ) {
resourcesInfoShowPPTInfo ( 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 '<span class="textType">' + text + '</span>' ;
}
} ,
{
field : 'userId' ,
title : '操作' ,
width : 80 ,
align : "center" ,
templet : function ( d ) {
var htm = '<button type="button" class="layui-btn layui-btn-xs bg_button" lay-event="previewPage">查看</button></a>' ;
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 ) {
checkStatusData = table . checkStatus ( "resourcesInfoTable" ) . data ;
var htm = "已选中:" ;
var resourcesInfoTable = obj . data ;
if ( obj . checked ) {
htm += checkStatusData . length ;
//按钮逻辑Lib.buttonEnable()
} else {
htm += checkStatusData . length ;
}
$ ( "#checkNumber" ) . html ( htm )
} )
}
function resourcesInfoShowInfo ( data ) {
resourcesInfoShowTable = 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 '<span class="textType">' + text + '</span>' ;
}
} ,
{
field : 'userId' ,
title : '操作' ,
width : 160 ,
align : "center" ,
templet : function ( d ) {
var htm = '<button type="button" class="layui-btn layui-btn-xs bg_button" lay-event="previewPage">查看</button></a>' ;
htm += '<button type="button" class="layui-btn layui-btn-xs bg_button" lay-event="del">删除</button></a>' ;
return htm ;
}
}
] ]
} ) ;
table . on ( 'tool(resourcesInfoShowTable)' , function ( obj ) {
var data = obj . data ;
if ( obj . event === 'previewPage' ) { //预览
Lib . downloadFile ( data ) ;
} else if ( obj . event === 'del' ) {
checkStatusData . splice ( data , 1 ) ; // 删除
resourcesInfoShowTable . reload ( { data : checkStatusData } ) ;
}
} ) ;
} ; function resourcesInfoShowPPTInfo ( data ) {
resourcesInfoShowPPTTable = table . render ( {
elem : '#resourcesInfoShowPPTTable' ,
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 '<span class="textType">' + text + '</span>' ;
}
} ,
{
field : 'userId' ,
title : '操作' ,
width : 160 ,
align : "center" ,
templet : function ( d ) {
var htm = '<button type="button" class="layui-btn layui-btn-xs bg_button" lay-event="previewPage">查看</button></a>' ;
htm += '<button type="button" class="layui-btn layui-btn-xs bg_button" lay-event="del">删除</button></a>' ;
return htm ;
}
}
] ]
} ) ;
table . on ( 'tool(resourcesInfoShowPPTTable)' , function ( obj ) {
var data = obj . data ;
if ( obj . event === 'previewPage' ) { //预览
Lib . downloadFile ( data ) ;
} else if ( obj . event === 'del' ) {
checkStatusData . splice ( data , 1 ) ; // 删除
resourcesInfoShowPPTTable . reload ( { data : checkStatusData } ) ;
}
} ) ;
}
/*资源表格搜索*/
/*资源表格搜索*/
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 ) ;
} ) ;