From 992575edeca2d2dc0d5b9af30a39f358b6c5713b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A7=9A=E4=B8=B9ab?= <1421553879@qq.com>
Date: Thu, 5 Jan 2023 02:33:45 +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
---
.../jlw/courseInfo/courseConfigureNew.html | 180 ++++++++++--------
1 file changed, 102 insertions(+), 78 deletions(-)
diff --git a/web/src/main/resources/templates/jlw/courseInfo/courseConfigureNew.html b/web/src/main/resources/templates/jlw/courseInfo/courseConfigureNew.html
index d106cf4c..70747db9 100644
--- a/web/src/main/resources/templates/jlw/courseInfo/courseConfigureNew.html
+++ b/web/src/main/resources/templates/jlw/courseInfo/courseConfigureNew.html
@@ -71,7 +71,12 @@
-
@@ -170,6 +175,7 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
upload = layui.upload,
treetable = layui.treetable,
layedit = layui.layedit,
+ editIndex,
laytpl = layui.laytpl,
transfer = layui.transfer,
tree = layui.tree,
@@ -177,19 +183,28 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
var courseInfoParentId = $("input[name='courseInfoId']").val();
var resourcesTable = [];
- //拖拽上传
+ layedit.set({ //富文本上传图片
+ uploadImage: {
+ url: Common.ctxPath + "/jlw/file/update.do",
+ imgUrl:Common.ctxPath
+ }
+ });
+ var courseInfoContent_;
+
upload.render({
elem: '#resourcesUpload'
,url: Common.ctxPath + '/jlw/file/update.do'
+ , accept: 'file'
,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: '#picWordUp' //上传图文
, url: Common.ctxPath + '/jlw/file/update.do'
- ,accept:'file'
+ , accept: 'file'
+ , exts: 'jpg|png|gif|bmp|jpeg|csv'
, done: function (res) {
//上传完毕回调
layer.msg('上传成功');
@@ -343,16 +358,15 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
};
addOpen("",'子章节名称',"",param);
}else if (obj.event === 'updataResources') {//上传资源
- updataResourcesOpen(courseInfoId);
+ updataResourcesOpen(data);
}else if (obj.event === 'addLine') {//添加链接
- addLine(data.courseInfoId);
+ addLine(data);
} else if (obj.event === 'addPW') {//添加图文
- addPW(data.courseInfoId);
+ addPW(data);
}else if (obj.event === 'look') {//查看
Lib.downloadFile(data);
}else if (obj.event === 'update') {//上传
- return;
- updataResourcesOpen();
+ updataResourcesOpen(data);
}else if(obj.event === 'edit'){
var title="章节目录";
var param = {};
@@ -423,13 +437,12 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
}else {
if(!$.isEmpty(param.resourcesInfoId)){
param.resourcesInfoName = $("#editName input[name='courseInfoName']").val();
- postResourcesInfo(param.resourcesInfoId,param)
+ postResourcesInfo(param.resourcesInfoId,param,index)
}else{
param.courseInfoName = $("#editName input[name='courseInfoName']").val();
postCourseInfo(id, param);
}
}
- layer.close(index);
},
btn2: function (index, layero) {
layer.close(index);
@@ -438,7 +451,7 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
}
/*资源类型弹出框*/
- function updataResourcesOpen(courseInfoId) {
+ function updataResourcesOpen(data) {
layer.open({
title: '上传资源类型'
, shadeClose: true
@@ -456,9 +469,23 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
return;
}
if(type == '1'||type == 1){
- updataResourcesOpenLocal();
+ if (!$.isEmpty(data.resourcesInfoType)) {
+ if (data.resourcesInfoType === 5) {
+ addPW(data,1);
+ } else if (data.resourcesInfoType === 4) {
+ addLine(data,1);
+ } else {
+ updataResourcesOpenLocal();
+ }
+ } else {
+ updataResourcesOpenLocal();
+ }
}else {
- updataResourcesOpenRe(courseInfoId);
+ if (!$.isEmpty(data.resourcesInfoType)) {
+ updataResourcesOpenRe(data,1);
+ } else {
+ updataResourcesOpenRe(data,2);
+ }
}
layer.close(index);
}
@@ -487,22 +514,22 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
}
/*资源库上传弹出框*/
- function updataResourcesOpenRe(courseInfoId) {
+ function updataResourcesOpenRe(dataOld,sign) {
layer.open({
type: 1,
title: "资源库上传",
shadeClose: true,
btn: ['保存', '关闭'],
btnAlign: 'c',
- area: ['900px', '580px'],
+ area: ['820px', '580px'],
content: $("#edit_dialog"),
success: function (layero, index) {
- loadResourcesInfo(3);
+ loadResourcesInfo(sign);
$(".search").unbind();
$(".search").click(searchList); //搜索
}, yes: function (index) {
var checkStatus = table.checkStatus("resourcesInfoTable"); //获取选中行状态
- var data = checkStatus.data, ids = Common.concatBatchId(data, "resourcesInfoId"); //获取选中行数据
+ var dataNew = checkStatus.data, ids = Common.concatBatchId(dataNew, "resourcesInfoId"); //获取选中行数据
if ($.isEmpty(ids)) {
layer.msg("请选择需要上传的资源!", {
@@ -512,15 +539,27 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
});
return;
}
- var param = {resourcesInfoIds: ids,courseId:courseInfoId};
- var ret = Common.postAjax("/jlw/resourcesInfo/copy.json", param);
- layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, {
- offset: ['50%'],
- icon: ret.code == 0 ? 1 : 2,
- time: 1500 //2秒关闭(如果不配置,默认是3秒)
- }, function () {
- layer.close(index);
- });
+ var param={}
+ var ret;
+ if(sign==2){
+ param = {resourcesInfoIds: ids,courseId:dataOld.courseInfoId};
+ ret = Common.postAjax("/jlw/resourcesInfo/copy.json", param);
+ layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, {
+ offset: ['50%'],
+ icon: ret.code == 0 ? 1 : 2,
+ time: 1500 //2秒关闭(如果不配置,默认是3秒)
+ }, function () {
+ layer.close(index);
+ });
+ }else {
+ param = {resourcesInfoId: dataOld.resourcesInfoId,
+ courseId:dataOld.courseInfoId,
+ resourcesInfoContent:dataNew[0].resourcesInfoContent,
+ resourcesInfoName:dataNew[0].resourcesInfoName,
+ resourcesInfoType:dataNew[0].resourcesInfoType
+ };
+ postResourcesInfo(dataOld.resourcesInfoId,param,index);
+ }
}, btn2: function (index, layero) {
layer.close(index);
}
@@ -528,7 +567,7 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
}
//资源库表格
- function loadResourcesInfo(resourcesInfoType, ids) {
+ function loadResourcesInfo(sign) {
$("#edit_dialog input[name='resourcesInfoName']").val("");
resourcesTable = table.render({
elem: '#resourcesInfoTable',
@@ -541,13 +580,13 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
, limit: 10,
cols: [[ // 表头
{
- type: 'checkbox'
+ type: sign == 2 ?'checkbox':'radio'
},
{
field: 'resourcesInfoName', title: '资源名称', align: "center", style: "text-align: left;"
},
{
- field: 'courseInfoParentParentName', title: '归属课程', align: "center"
+ field: 'courseInfoParentParentName', title: '归属课程', align: "center", width: 150
},
{
field: 'resourcesInfoType', width: 150, title: '资源类型', align: "center", templet: function (d) {//(1视频 2PPT 3PDF)
@@ -558,7 +597,7 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
{
field: 'userId',
title: '操作',
- width: resourcesInfoType == 7 || resourcesInfoType == 8 || resourcesInfoType == 9 ? 150 : 100,
+ width: 80,
align: "center",
templet: function (d) {
var htm = '
查看';
@@ -590,7 +629,7 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
}
/*添加链接*/
- function addLine(courseInfoId) {
+ function addLine(data,sign) {
layer.open({
type: 1,
title: "添加链接",
@@ -598,6 +637,8 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
btn: ['保存', '关闭'],
content: $("#addLine_dialog"),
success: function (layero, index) {
+ $("#addLine_dialog input[name='resourcesInfoName']").val(data.resourcesInfoName);
+ $("#addLine_dialog input[name='resourcesInfoContent']").val(data.resourcesInfoContent);
}, yes: function (index) {
var resourcesInfoName = $("#addLine_dialog input[name='resourcesInfoName']").val();
var resourcesInfoContent = $("#addLine_dialog input[name='resourcesInfoContent']").val();
@@ -621,37 +662,23 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
'resourcesInfoName': resourcesInfoName,
'resourcesInfoContent': resourcesInfoContent,
'resourcesInfoType':4,
- 'courseInfoId':courseInfoId
+ 'courseInfoId':data.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);
-
+ if(sign == 1){
+ param.resourcesInfoId=data.resourcesInfoId;
+ param.courseInfoId=data.courseInfoParentId;
+ postResourcesInfo(data.resourcesInfoId,param,index)
+ }else {
+ postResourcesInfo("",param,index)
+ }
}, btn2: function (index, layero) {
layer.close(index);
}
});
}
- var courseInfoContent_ = layedit.build('resourcesInfoContent', {height: 200}); //题干
/*添加图文*/
- function addPW(courseInfoId) {
+ function addPW(data,sign) {
layer.open({
type: 1,
title: "添加图文",
@@ -659,7 +686,10 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
btn: ['保存', '关闭'],
content: $("#addPW_dialog"),
success: function (layero, index) {
-
+ $("#addPW_dialog input[name='resourcesInfoName']").val(data.resourcesInfoName);
+ $("#addPW_dialog textarea[name='resourcesInfoContent']").val(data.resourcesInfoContent);
+ //建立编辑器
+ courseInfoContent_ = layedit.build('resourcesInfoContent', {height: 200}); //题干
}, yes: function (index) {
var resourcesInfoName = $("#addPW_dialog input[name='resourcesInfoName']").val();
var resourcesInfoContent = layedit.getContent(courseInfoContent_);
@@ -683,26 +713,15 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
'resourcesInfoName': resourcesInfoName,
'resourcesInfoContent': resourcesInfoContent,
'resourcesInfoType':5,
- 'courseInfoId':courseInfoId
+ 'courseInfoId':data.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);
+ if(sign == 1){
+ param.resourcesInfoId=data.resourcesInfoId;
+ param.courseInfoId=data.courseInfoParentId;
+ postResourcesInfo(data.resourcesInfoId,param,index)
+ }else {
+ postResourcesInfo("",param,index)
+ }
}, btn2: function (index, layero) {
layer.close(index);
@@ -735,8 +754,11 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
}
/*资源数据提交*/
- function postResourcesInfo(id, param) {
- layer.load();
+ function postResourcesInfo(id, param,index) {
+ layer.load(0,{
+ shadeClose: false,
+ shade: [0.5]
+ });
setTimeout(function () {
var url = "/jlw/resourcesInfo/add.json";
if (!$.isEmpty(id)) {
@@ -744,6 +766,7 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
}
var ret = Common.postAjax(url, param);
if (ret.code == 0) {
+ layer.close(index);
courseInfoTable();
}
layer.msg(ret.code == 0 ? "操作成功!" : ret.msg, {
@@ -751,6 +774,7 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
icon: ret.code == 0 ? 1 : 2,
time: 1500 //2秒关闭(如果不配置,默认是3秒)
}, function () {
+
layer.closeAll();
if (ret.code == 0) {
Lib.tableRefresh();