课程配置

beetlsql3-dev
姚丹ab 2 years ago
parent 3e21913c12
commit e56c039749

@ -1116,6 +1116,15 @@ var Lib = {
a.setAttribute('download', name); //a.download='文件名'
a.setAttribute('target', '_blank'); //a.download='文件名'
a.click();
},downloadFileOpen:function (data){ //下载指定文件/或者预览文件 resourcesInfoType资源类型(1视频 2课件(ppt 、pdf) 3附件)
if(data.resourcesInfoType == 3){//前端下载文件
var a = document.createElement('a');
a.setAttribute('href', Common.ctxPath + data.resourcesInfoContent); //a.href='文件链接'
a.setAttribute('download', data.resourcesInfoName); //a.download='文件名'
a.click();
}else{
window.location.href = Common.ctxPath + "/coursewareViewing?courseId="+data.teacherOpenCourseId;
}
},competitionStatus:function(value){
return value == 1?'报名未开始':value == 2?'报名中':value == 3?'报名结束': value == 4?'大赛开始': value == 5?'任务一进行中':
value == 6?'任务一结束':value == 7?'任务二进行中':value == 8?'任务二结束':value == 9?'任务三进行中':value == 10?'任务三结束':value == 11?'大赛结束':'';

@ -532,10 +532,10 @@ public class TeacherOpenCourseMergeCourseInfoController {
//跳转至课程配置页面
@GetMapping(MODEL + "/courseConfigureNew.do")
@Function("teacherOpenCourseMergeCourseInfo.add")
public ModelAndView courseConfigureNew(Long teacherOpenCourseMergeCourseInfoId) {
public ModelAndView courseConfigureNew(Long teacherOpenCourseld) {
ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseMergeCourseInfo/courseConfigureNew.html");
TeacherOpenCourseMergeCourseInfo teacherOpenCourseMergeCourseInfo = teacherOpenCourseMergeCourseInfoService.queryById(teacherOpenCourseMergeCourseInfoId);
view.addObject("courseInfo", teacherOpenCourseMergeCourseInfo);
// TeacherOpenCourseMergeCourseInfo teacherOpenCourseMergeCourseInfo = teacherOpenCourseMergeCourseInfoService.queryById(teacherOpenCourseMergeCourseInfoId);
view.addObject("courseInfoId", teacherOpenCourseld);
return view;
}

@ -115,9 +115,8 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
}, initTableTool: table.on('tool(courseInfoTable)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
console.log(data)
if(data.sourceType == 1){
var url = "/jlw/teacherOpenCourseMergeCourseInfo/courseConfigureNew.do?teacherOpenCourseMergeCourseInfoId="+data.courseInfoId;
var url = "/jlw/teacherOpenCourseMergeCourseInfo/courseConfigureNew.do?teacherOpenCourseld="+data.courseInfoId;
Common.openDlg(url,"");
}else if(data.sourceType == 2){
var url = "/jlw/courseInfo/add.do?courseInfoId="+data.courseInfoId;

@ -113,12 +113,12 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
up: function () {
var data = Common.getMoreDataFromTable(table, "handsOnTable");
var ids = Common.concatBatchId(data, "handsOnId");
upDrown(1, data.resourcesQuestionId);
upDrown(1, data.resourcesQuestionId,data.sourceType);
},
down: function () {
var data = Common.getMoreDataFromTable(table, "handsOnTable");
var ids = Common.concatBatchId(data, "handsOnId");
upDrown(2, data.resourcesQuestionId);
upDrown(2, data.resourcesQuestionId,data.sourceType);
},
search: function () {
Lib.doSearchForm($("#searchForm"), resourcesQuestionTable, 1);
@ -237,11 +237,12 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
}
//上下架
function upDrown(status, ids) {
function upDrown(status, ids ,sourceType) {
layer.confirm(status == 1 ? '是否确定上架该试题?' : '是否确定下架该试题?', function (index) {
var ret = Common.postAjax("/jlw/resourcesQuestion/putOnShelves.json", {
resourcesQuestionId: ids,
questionStatus: status
questionStatus: status,
sourceType:sourceType
});
layer.msg(ret.code == 0 ? "操作成功!" : ret.msg, {
offset: ['50%'],

@ -5,9 +5,11 @@
.layui-table a {
margin-right: 10px;
}
a{
a {
cursor: pointer;
}
.shiping {
color: red;
border: 2px solid red;
@ -49,18 +51,20 @@
border-radius: 5px;
padding: 3px
}
/*select超出展示*/
#edit_dialog {
position: relative;
overflow: visible !important;
}
</style>
<input name="courseInfoId" type="hidden" value="${courseInfo.courseInfoId}"/>
<input name="courseInfoId" type="hidden" value="${courseInfoId}"/>
<div class="layui-row" style="margin: 0 auto;">
<a class="layui-btn layui-btn-primary" id="addButton-cancel" style="margin-bottom: 10px;">返回</a>
<a class="layui-btn bg_button" id="addButton" style="margin-bottom: 10px;">新增章目录</a>
<!--<a class="layui-btn bg_button" id="addButton" style="margin-bottom: 10px;">新增章目录</a>-->
<a class="layui-btn" id="foldTrue" style="margin-bottom: 10px;">全部展开</a>
<a class="layui-btn layui-bg-gray" id="foldFalse" style="margin-bottom: 10px;">全部折叠</a>
<h1 id="titleName"></h1>
</div>
<table id="teacherOpenCourseMergeCourseInfoTable" lay-filter="teacherOpenCourseMergeCourseInfoTable"></table>
<!--本地上传-->
@ -73,15 +77,16 @@
<div id="uploadDemoView" style="display: none;">
<hr>
<span style="color: #1E9FFF;">上传成功</span>
<input type="hidden" name="resourcesInfoContent" />
<input type="hidden" name="resourcesInfoId" />
<input type="hidden" name="resourcesInfoContent"/>
<input type="hidden" name="resourcesInfoId"/>
</div>
</div>
</div>
</div>
<div class="layui-col-xs6" style="padding: 20px">
<div class="grid-demo">
<p>上传须知:</p> <p style="text-indent: 2em;">1、可上传视频格式MP4</p>
<p>上传须知:</p>
<p style="text-indent: 2em;">1、可上传视频格式MP4</p>
<p style="text-indent: 2em;">2、可上传文档包括word、ppt、pdf</p>
<p style="text-indent: 2em;">3、默认使用文件名称可自行修改</p>
<!--<div class="el-col el-col-12">
@ -92,7 +97,8 @@
<div class="layui-form-item">
<label class="layui-form-label" style="width: 90px;">资源名称:</label>
<div class="layui-input-block" style="margin-left: 120px">
<input type="text" style="width: 90%;" name="resourcesInfoName" placeholder="请输入资源名称" autocomplete="off" class="layui-input">
<input type="text" style="width: 90%;" name="resourcesInfoName" placeholder="请输入资源名称" autocomplete="off"
class="layui-input">
</div>
</div>
</div>
@ -205,31 +211,33 @@
var teacherOpenCourseMergeCourseInfoAllData = [];
var courseInfoParentId = $("input[name='courseInfoId']").val();
var resourcesTable = [];
layedit.set({ //富文本上传图片
uploadImage: {
url: Common.ctxPath + "/jlw/file/update.do",
imgUrl:Common.ctxPath
imgUrl: Common.ctxPath
}
});
var courseInfoContent_;
upload.render({
elem: '#resourcesUpload'
,url: Common.ctxPath + '/jlw/file/update.do'
, url: Common.ctxPath + '/jlw/file/update.do'
, accept: 'file'
,exts:"ppt|pptx|pdf|mp4|doc|docx"
,done: function(res){
if(res.code == 0){
, exts: "ppt|pptx|pdf|mp4|doc|docx"
, done: function (res) {
if (res.code == 0) {
$("#uploadDemoView").show();
layer.msg('上传成功');
$('#resources_demo input[name="resourcesInfoName"]').val(res.data.name);
if (!$.isEmpty(res.data.cvPDFUrl)){
if (!$.isEmpty(res.data.cvPDFUrl)) {
$('#resources_demo input[name="resourcesInfoContent"]').val(res.data.cvPDFUrl);
}else {
} else {
$('#resources_demo input[name="resourcesInfoContent"]').val(res.data.src);
}
}else {
} else {
layer.msg(res.msg);
}
}
@ -251,49 +259,59 @@
var teacherOpenCourseMergeCourseInfoTable = function () {
layer.load(1);
setTimeout(function () {
var ret = Common.getAjax("/jlw/teacherOpenCourseMergeCourseInfo/getCourseResources.json?courseInfoId="+courseInfoParentId);
teacherOpenCourseMergeCourseInfoAllData = ret.data;
if(ret.code == 0){
var ret = Common.postAjax("/jlw/teacherOpenCourseMergeCourseInfo/getTreeByTeacherOpenCourseId.json", {teacherOpenCourseId: courseInfoParentId});
var treeSpid = ret.data.teacherOpenCourseMergeCourseInfoId;
if (ret.code == 0) {
$("#titleName").html(ret.data.courseInfoName)
var data = ret.data;
var index_parent = 1;
var index_child = 1;
var index_child_child = 1;
var courseInfoParentIdOld;
var courseInfoIdOld;
teacherOpenCourseMergeCourseInfoAllData.forEach((item,index) => {
/*根据课程类型值判断章节*/
if(item.courseInfoType == 2){
item.courseInfoNo = numberfilter(index_parent);
index_parent++;
courseInfoParentIdOld = item.courseInfoParentId;
courseInfoIdOld = item.courseInfoId;
index_child =1;
}
index_child_child=1
teacherOpenCourseMergeCourseInfoAllData.forEach((em,i) => {
if(item.courseInfoType == 2 && (item.courseInfoId == em.courseInfoParentId)){
em.courseInfoNo = index_child;
index_child ++;
}
if(item.courseInfoType == 3 && (item.courseInfoId == em.courseInfoParentId)){
em.courseInfoNo = item.courseInfoNo+"."+index_child_child;
index_child_child++;
if(!$.isEmpty(data.children)){
data.children.forEach((item, index) => {
/*根据课程类型值判断章节*/
if(item.courseInfoType == 2){
item.courseInfoNo = numberfilter(index_parent);
index_parent++;
index_child = 1;
}
teacherOpenCourseMergeCourseInfoAllData.push(item)
index_child_child = 1
if(!$.isEmpty(item.children)){
item.children.forEach((em, i) => {
if(item.courseInfoType == 2 && (item.teacherOpenCourseMergeCourseInfoId == em.courseInfoParentId)){
em.courseInfoNo = index_child;
index_child++;
}
if (item.courseInfoType == 3 && (item.teacherOpenCourseMergeCourseInfoId == em.courseInfoParentId)) {
em.courseInfoNo = item.courseInfoNo + "." + index_child_child;
index_child_child++;
}
teacherOpenCourseMergeCourseInfoAllData.push(em);
for(var key in em.resourcesInfo){
em.resourcesInfo[key].courseInfoParentId = em.resourcesInfo[key].teacherOpenCourseMergeCourseInfoId;
em.resourcesInfo[key].teacherOpenCourseMergeCourseInfoId = 0;
em.resourcesInfo[key].courseInfoName = em.resourcesInfo[key].resourcesInfoName;
em.resourcesInfo[key].courseInfoNo = '';
teacherOpenCourseMergeCourseInfoAllData.push(em.resourcesInfo[key]);
}
});
}
if(!$.isEmpty(item.resourcesInfo)){
item.resourcesInfo.forEach(function (e, i) {
e.courseInfoParentId = e.teacherOpenCourseMergeCourseInfoId;
e.teacherOpenCourseMergeCourseInfoId = 0;
e.courseInfoName = e.resourcesInfoName;
e.courseInfoNo = '';
teacherOpenCourseMergeCourseInfoAllData.push(e);
});
}
});
}
});
item.resourcesInfo.forEach(function (e, i) {
e.courseInfoParentId = e.courseInfoId;
e.courseInfoId = 0;
e.courseInfoName = e.resourcesInfoName;
e.courseInfoNo='';
courseInfoAllData.push(e);
});
});
layer.closeAll();
}else{
layer.msg(ret.msg||"加载失败!!", {
} else {
layer.msg(ret.msg || "加载失败!!", {
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
time: 1500 //2秒关闭如果不配置默认是3秒
@ -304,11 +322,16 @@
elem: '#teacherOpenCourseMergeCourseInfoTable',
height: Lib.getTableHeight(1),
cellMinWidth: 100,
/*url:"/jlw/teacherOpenCourseMergeCourseInfo/getTreeByTeacherOpenCourseId.json",
// toolbar: 'default',
height: 'full-200',
method: 'POST',
where: {teacherOpenCourseId:courseInfoParentId},*/
data: teacherOpenCourseMergeCourseInfoAllData,
treeColIndex: 0, //树形图标显示在第几列
treeSpid: courseInfoParentId, //最上级的父级id
treeIdName: 'courseInfoId', //id字段的名称
treeSpid: treeSpid, //最上级的父级id
treePidName: 'courseInfoParentId', //父级节点字段
treeIdName: 'teacherOpenCourseMergeCourseInfoId', //id字段的名称
treeDefaultClose: false, //是否默认折叠
treeLinkage: true //父级展开时是否自动展开所有子级
, limit: 1000
@ -321,13 +344,13 @@
console.log(obj.oldIndex) // 原来的数据索引
console.log(obj.newIndex) // 改动后数据索引
}
}
,totalRow: true*/
// }
//,totalRow: true*/
, cols: [[ // 表头
{
field: 'courseInfoNo',
title: '序号',
width:280,
width: 280,
align: "center",
style: "text-align: left;",
},
@ -338,7 +361,7 @@
{
field: 'resourcesInfoType',
title: '资源类型',
width:120,
width: 120,
align: "center",
templet: function (d) {
//资源类型(1视频 2PPT 3PDF 4链接 5图片)
@ -364,14 +387,21 @@
}
},
{
field: 'courseInfoId',
field: 'teacherOpenCourseMergeCourseInfoId',
title: '操作',
align: "center",
width: 380,
//width: 380,
style: "text-align: left;",
templet: function (d) {
var htm = '';
if (d.courseInfoType === 2) {
if (!$.isEmpty(d.resourcesInfoType)) {
if (d.resourcesInfoType != 4) {
htm += '<a class="layui-table-link" lay-event="look">查看</a>';
} else {
htm += '<a href="' + d.resourcesInfoContent + '" style="color: #01AAED" target="_blank">查看</a>';
}
}
/*if (d.courseInfoType === 2) {
htm += '<a class="layui-table-link" lay-event="add">添加子章节</a>';
} else if (d.courseInfoType === 3) {
htm += '<a class="layui-table-link" lay-event="updataResources">上传资源</a>';
@ -379,17 +409,17 @@
htm += '<a class="layui-table-link" lay-event="addPW">添加图文</a>';
}
if (!$.isEmpty(d.resourcesInfoType)) {
if (d.resourcesInfoType != 4){
if (d.resourcesInfoType != 4) {
htm += '<a class="layui-table-link" lay-event="look">查看</a>';
// htm += '<a href='+Common.ctxPath + '/jlw/resourcesInfo/previewData.do?resourcesInfoId='+d.resourcesInfoId+' style="color: #01AAED" target="_blank">查看</a>';
}else {
htm += '<a href="'+d.resourcesInfoContent+'" style="color: #01AAED" target="_blank">查看</a>';
} else {
htm += '<a href="' + d.resourcesInfoContent + '" style="color: #01AAED" target="_blank">查看</a>';
}
}
htm += '<a class="layui-table-link" lay-event="edit">编辑</a>';
htm += '<a class="layui-table-link" lay-event="del">删除</a>';
htm += '<a class="layui-table-link" lay-event="moveUp">上移</a>';
htm += '<a class="layui-table-link" lay-event="moveDown">下移</a>';
htm += '<a class="layui-table-link" lay-event="moveDown">下移</a>';*/
return htm;
}
}
@ -409,7 +439,7 @@
courseInfoStatus: 1
};
var title = "章节名称";
addOpen('',title,'',param)
addOpen('', title, '', param)
});
/*返回*/
$("#addButton-cancel").click(function () {
@ -428,51 +458,57 @@
/*表格操作栏*/
table.on('tool(teacherOpenCourseMergeCourseInfoTable)', function (obj) {
var data = obj.data;
var courseInfoId = data.courseInfoId;
var teacherOpenCourseMergeCourseInfoId = data.teacherOpenCourseMergeCourseInfoId;
if (obj.event === 'add') {//添加子章节
var param = {
courseInfoParentId: courseInfoId,
courseInfoParentId: teacherOpenCourseMergeCourseInfoId,
courseInfoType: 3,
courseInfoStatus: 1
};
addOpen("",'子章节名称',"",param);
}else if (obj.event === 'updataResources') {//上传资源
addOpen("", '子章节名称', "", param);
} else if (obj.event === 'updataResources') {//上传资源
updataResourcesOpen(data);
}else if (obj.event === 'addLine') {//添加链接
} else if (obj.event === 'addLine') {//添加链接
addLine(data);
} else if (obj.event === 'addPW') {//添加图文
addPW(data);
}else if (obj.event === 'look') {//查看
Lib.downloadFile(data);
}else if(obj.event === 'edit'){
var title="章节目录";
} else if (obj.event === 'look') {//查看
console.log(data)
//data.courseId = data.teacherOpenCourseMergeResourcesInfoId;
//http://localhost:8080/coursewareViewing?
// courseId=1669621371501715456&
// onId=16696360310656245771669636031160426501&
// _role_tag=1688459370184
Lib.downloadFileOpen(data);
} else if (obj.event === 'edit') {
var title = "章节目录";
var param = {};
var id = '';
if (!$.isEmpty(data.resourcesInfoId)) {
title = "资源名称";
param.resourcesInfoId= data.resourcesInfoId;
param.resourcesInfoId = data.resourcesInfoId;
id = data.resourcesInfoId;
if (data.resourcesInfoType === 5) {
addPW(data,1);
addPW(data, 1);
} else if (data.resourcesInfoType === 4) {
addLine(data,1);
addLine(data, 1);
} else {
updataResourcesOpenLocal(data,"");
updataResourcesOpenLocal(data, "");
}
}else {
id = courseInfoId;
param.courseInfoId = courseInfoId;
addOpen(id,title,data,param);
} else {
id = teacherOpenCourseMergeCourseInfoId;
param.teacherOpenCourseMergeCourseInfoId = teacherOpenCourseMergeCourseInfoId;
addOpen(id, title, data, param);
}
}else if (obj.event === 'del') {
var url = "/jlw/teacherOpenCourseMergeCourseInfo/delete.json",param = {ids:courseInfoId};
if (courseInfoId == 0){
} else if (obj.event === 'del') {
var url = "/jlw/teacherOpenCourseMergeCourseInfo/delete.json", param = {ids: teacherOpenCourseMergeCourseInfoId};
if (teacherOpenCourseMergeCourseInfoId == 0) {
url = "/jlw/resourcesInfo/delete.json"
param.ids = obj.data.resourcesInfoId;
}
layer.confirm('是否确定删除该信息?', function (index) {
layer.load();
var ret = Common.postAjax(url,param);
var ret = Common.postAjax(url, param);
layer.msg(ret.code == 0 ? "删除成功!" : ret.msg, {
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
@ -495,15 +531,15 @@
});
courseInfoTable();
}*/
}else if (obj.event === 'move') {//拖动
} else if (obj.event === 'move') {//拖动
//soulTable.suspend('myTable', 'drag', !data.elem.checked)
}else if (obj.event === 'moveUp') {//上移
} else if (obj.event === 'moveUp') {//上移
var url = "/jlw/teacherOpenCourseMergeCourseInfo/move.json";
var param = {
id: data.courseInfoId,
id: data.teacherOpenCourseMergeCourseInfoId,
moveType: 'MOVE_LEFT'
};
if(!$.isEmpty(data.resourcesInfoId)){
if (!$.isEmpty(data.resourcesInfoId)) {
param.id = data.resourcesInfoId;
url = "/jlw/resourcesInfo/move.json";
}
@ -515,19 +551,19 @@
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
time: 1500 //2秒关闭如果不配置默认是3秒
},function(){
}, function () {
if (ret.code == 0) {
Lib.tableRefresh();
layer.closeAll();
}
});
}else if (obj.event === 'moveDown') {//下移
var url = "/jlw/teacherOpenCourseMergeCourseInfo/move.json";
} else if (obj.event === 'moveDown') {//下移
var url = "/jlw/teacherOpenCourseMergeCourseInfo/move.json";
var param = {
id: data.courseInfoId,
id: data.teacherOpenCourseMergeCourseInfoId,
moveType: 'MOVE_RIGHT'
};
if(!$.isEmpty(data.resourcesInfoId)){
if (!$.isEmpty(data.resourcesInfoId)) {
param.id = data.resourcesInfoId;
url = "/jlw/resourcesInfo/move.json";
}
@ -539,7 +575,7 @@
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
time: 1500 //2秒关闭如果不配置默认是3秒
},function(){
}, function () {
if (ret.code == 0) {
Lib.tableRefresh();
layer.closeAll();
@ -549,29 +585,29 @@
});
/*添加、编辑弹窗*/
function addOpen(id,title,data,param) {
function addOpen(id, title, data, param) {
layer.open({
title: "添加/编辑"
, content: '<div class="layui-inline" id="editName">\n' +
'<label class="layui-form-label">'+title+'</label>\n' +
'<label class="layui-form-label">' + title + '</label>\n' +
'<div class="layui-input-inline">\n' +
'<input type="text" id="courseInfoName" name="courseInfoName" class="layui-input" >\n' +
'</div>\n' +
'</div>'
, btn: ['确定', '关闭']
, shadeClose:true
, success:function () {
, shadeClose: true
, success: function () {
$("#editName input[name='courseInfoName']").val(data.courseInfoName)
}
, yes: function (index, layero) {
if($.isEmpty(id)){
if ($.isEmpty(id)) {
param.courseInfoName = $("#editName input[name='courseInfoName']").val();
postCourseInfo('', param);
}else {
if(!$.isEmpty(param.resourcesInfoId)){
} else {
if (!$.isEmpty(param.resourcesInfoId)) {
param.resourcesInfoName = $("#editName input[name='courseInfoName']").val();
postResourcesInfo(param.resourcesInfoId,param,index)
}else{
postResourcesInfo(param.resourcesInfoId, param, index)
} else {
param.courseInfoName = $("#editName input[name='courseInfoName']").val();
postCourseInfo(id, param);
}
@ -595,31 +631,31 @@
, btn: ['确定', '关闭']
, success: function (layero, index) {
form.render();
},yes:function (index, layero){
}, yes: function (index, layero) {
var type = $("input[name='type']:checked").val();
if($.isEmpty(type)){
if ($.isEmpty(type)) {
Common.info("请选择上传资源类型!!");
return;
}
if(type == '1'||type == 1){
if (type == '1' || type == 1) {
if (!$.isEmpty(data.resourcesInfoType)) {
if (data.resourcesInfoType === 5) {
addPW(data,1);
addPW(data, 1);
} else if (data.resourcesInfoType === 4) {
addLine(data,1);
addLine(data, 1);
} else {
$('#resources_demo input[name="resourcesInfoId"]').val("");
updataResourcesOpenLocal({},data.courseInfoId);
updataResourcesOpenLocal({}, data.teacherOpenCourseMergeCourseInfoId);
}
} else {
$('#resources_demo input[name="resourcesInfoId"]').val("");
updataResourcesOpenLocal({},data.courseInfoId);
updataResourcesOpenLocal({}, data.teacherOpenCourseMergeCourseInfoId);
}
}else {
} else {
if (!$.isEmpty(data.resourcesInfoType)) {
updataResourcesOpenRe(data,1);
updataResourcesOpenRe(data, 1);
} else {
updataResourcesOpenRe(data,2);
updataResourcesOpenRe(data, 2);
}
}
layer.close(index);
@ -631,48 +667,48 @@
}
/*本地资源上传弹出框*/
function updataResourcesOpenLocal(data,courseInfoId) {
function updataResourcesOpenLocal(data, teacherOpenCourseMergeCourseInfoId) {
$('#resources_demo input[name="resourcesInfoName"]').val(data.resourcesInfoName || '');
$('#resources_demo input[name="resourcesInfoContent"]').val(data.resourcesInfoContent || '');
$('#resources_demo input[name="resourcesInfoId"]').val(data.resourcesInfoId || '');
$("#uploadDemoView").hide();
layer.open({
title: '本地上传'
,type:1
, type: 1
, shadeClose: true
, content: $("#resources_demo")
, area: ['650px','380px']
, area: ['650px', '380px']
, btn: ['确定', '关闭']
,yes:function (index, layero){
, yes: function (index, layero) {
var resourcesInfoName = $('#resources_demo input[name="resourcesInfoName"]').val();
var resourcesInfoContent = $('#resources_demo input[name="resourcesInfoContent"]').val();
var resourcesInfoId = $('#resources_demo input[name="resourcesInfoId"]').val();
//1 视频 2 PPT 3 PDF 4 链接 5 图文
if ($.isEmpty(resourcesInfoContent)){
if ($.isEmpty(resourcesInfoContent)) {
layer.msg("请上传资源!", {icon: 2});
return;
}
if ($.isEmpty(resourcesInfoName)){
if ($.isEmpty(resourcesInfoName)) {
layer.msg("请输入资源名称!", {icon: 2});
return;
}
var param = {
resourcesInfoType:"",
resourcesInfoName:resourcesInfoName,
resourcesInfoContent:resourcesInfoContent,
resourcesInfoId:resourcesInfoId,
courseInfoId:courseInfoId
resourcesInfoType: "",
resourcesInfoName: resourcesInfoName,
resourcesInfoContent: resourcesInfoContent,
resourcesInfoId: resourcesInfoId,
teacherOpenCourseMergeCourseInfoId: teacherOpenCourseMergeCourseInfoId
}
if(resourcesInfoContent.indexOf(".PPT") >=0 || resourcesInfoContent.indexOf(".ppt") >=0|| resourcesInfoContent.indexOf(".PPTX") >=0|| resourcesInfoContent.indexOf(".pptx") >=0){
if (resourcesInfoContent.indexOf(".PPT") >= 0 || resourcesInfoContent.indexOf(".ppt") >= 0 || resourcesInfoContent.indexOf(".PPTX") >= 0 || resourcesInfoContent.indexOf(".pptx") >= 0) {
param.resourcesInfoType = 2;
}
if(resourcesInfoContent.indexOf(".MP4") >=0 || resourcesInfoContent.indexOf(".mp4") >=0){
if (resourcesInfoContent.indexOf(".MP4") >= 0 || resourcesInfoContent.indexOf(".mp4") >= 0) {
param.resourcesInfoType = 1;
}
if(resourcesInfoContent.indexOf(".PDF") >=0 || resourcesInfoContent.indexOf(".pdf") >=0){
if (resourcesInfoContent.indexOf(".PDF") >= 0 || resourcesInfoContent.indexOf(".pdf") >= 0) {
param.resourcesInfoType = 3;
}
postResourcesInfo(resourcesInfoId, param,index)
postResourcesInfo(resourcesInfoId, param, index)
}
, btn2: function (index, layero) {
layer.close(index);
@ -681,7 +717,7 @@
}
/*资源库上传弹出框*/
function updataResourcesOpenRe(dataOld,sign) {
function updataResourcesOpenRe(dataOld, sign) {
layer.open({
type: 1,
title: "资源库上传",
@ -706,11 +742,11 @@
});
return;
}
var param={}
var param = {}
var ret;
if(sign==2){
param = {resourcesInfoIds: ids,courseId:dataOld.courseInfoId};
if (sign == 2) {
param = {resourcesInfoIds: ids, courseId: dataOld.teacherOpenCourseMergeCourseInfoId};
ret = Common.postAjax("/jlw/resourcesInfo/copy.json", param);
layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, {
offset: ['50%'],
@ -720,14 +756,15 @@
layer.close(index);
courseInfoTable();
});
}else {
param = {resourcesInfoId: dataOld.resourcesInfoId,
courseId:dataOld.courseInfoId,
resourcesInfoContent:dataNew[0].resourcesInfoContent,
resourcesInfoName:dataNew[0].resourcesInfoName,
resourcesInfoType:dataNew[0].resourcesInfoType
} else {
param = {
resourcesInfoId: dataOld.resourcesInfoId,
courseId: dataOld.teacherOpenCourseMergeCourseInfoId,
resourcesInfoContent: dataNew[0].resourcesInfoContent,
resourcesInfoName: dataNew[0].resourcesInfoName,
resourcesInfoType: dataNew[0].resourcesInfoType
};
postResourcesInfo(dataOld.resourcesInfoId,param,index);
postResourcesInfo(dataOld.resourcesInfoId, param, index);
}
}, btn2: function (index, layero) {
@ -750,7 +787,7 @@
, limit: 10,
cols: [[ // 表头
{
type: sign == 2 ?'checkbox':'radio'
type: sign == 2 ? 'checkbox' : 'radio'
},
{
field: 'resourcesInfoName', title: '资源名称', align: "center", style: "text-align: left;"
@ -799,7 +836,7 @@
}
/*添加链接*/
function addLine(data,sign) {
function addLine(data, sign) {
layer.open({
type: 1,
title: "添加链接",
@ -831,15 +868,15 @@
var param = {
'resourcesInfoName': resourcesInfoName,
'resourcesInfoContent': resourcesInfoContent,
'resourcesInfoType':4,
'courseInfoId':data.courseInfoId
'resourcesInfoType': 4,
'teacherOpenCourseMergeCourseInfoId': data.teacherOpenCourseMergeCourseInfoId
};
if(sign == 1){
param.resourcesInfoId=data.resourcesInfoId;
param.courseInfoId=data.courseInfoParentId;
postResourcesInfo(data.resourcesInfoId,param,index)
}else {
postResourcesInfo("",param,index)
if (sign == 1) {
param.resourcesInfoId = data.resourcesInfoId;
param.teacherOpenCourseMergeCourseInfoId = data.courseInfoParentId;
postResourcesInfo(data.resourcesInfoId, param, index)
} else {
postResourcesInfo("", param, index)
}
}, btn2: function (index, layero) {
layer.close(index);
@ -848,7 +885,7 @@
}
/*添加图文*/
function addPW(data,sign) {
function addPW(data, sign) {
layer.open({
type: 1,
title: "添加图文",
@ -882,15 +919,15 @@
var param = {
'resourcesInfoName': resourcesInfoName,
'resourcesInfoContent': resourcesInfoContent,
'resourcesInfoType':5,
'courseInfoId':data.courseInfoId
'resourcesInfoType': 5,
'teacherOpenCourseMergeCourseInfoId': data.teacherOpenCourseMergeCourseInfoId
};
if(sign == 1){
param.resourcesInfoId=data.resourcesInfoId;
param.courseInfoId=data.courseInfoParentId;
postResourcesInfo(data.resourcesInfoId,param,index)
}else {
postResourcesInfo("",param,index)
if (sign == 1) {
param.resourcesInfoId = data.resourcesInfoId;
param.teacherOpenCourseMergeCourseInfoId = data.courseInfoParentId;
postResourcesInfo(data.resourcesInfoId, param, index)
} else {
postResourcesInfo("", param, index)
}
}, btn2: function (index, layero) {
@ -903,15 +940,19 @@
function getLRid(id) {
var data = [], index;
courseInfoAllData.forEach((item, i) => {
if (item.resourcesInfoId == id) {
if(item.resourcesInfoId == id
)
{
index = i;
}
});
})
;
data.push(courseInfoAllData[index + 1].resourcesInfoId);
data.push(courseInfoAllData[index + 2].resourcesInfoId);
return data
}
/*课程数据提交*/
function postCourseInfo(id, param) {
layer.load();
@ -938,8 +979,8 @@
}
/*资源数据提交*/
function postResourcesInfo(id, param,index) {
layer.load(0,{
function postResourcesInfo(id, param, index) {
layer.load(0, {
shadeClose: false,
shade: [0.5]
});
@ -972,7 +1013,7 @@
* @param num
* @returns {string|string|string}
*/
function numberfilter (num) {
function numberfilter(num) {
const changeNum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'] // changeNum[0] = "零"
const unit = ['', '十', '百']
num = parseInt(num)
@ -988,13 +1029,13 @@
let noWan = num % 100
if (noWan.toString().length < 2) noWan = '0' + noWan
let strr = (overWan ? getWan(overWan) + '百' + getWan(noWan) : getWan(num))
if(strr.split('')[0] == '一'){
if($.isEmpty(strr.substring(1))){
if (strr.split('')[0] == '一') {
if ($.isEmpty(strr.substring(1))) {
return strr.split('')[0];
}else{
} else {
return strr.substring(1)
}
}else{
} else {
return overWan ? getWan(overWan) + '百' + getWan(noWan) : getWan(num)
}
}

Loading…
Cancel
Save