@@ -140,22 +149,22 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
@@ -204,9 +213,20 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
elem: '#resourcesUpload'
,url: Common.ctxPath + '/jlw/file/update.do'
, accept: 'file'
+ ,exts:"ppt|pptx|pdf|mp4|doc|docx"
,done: function(res){
- layer.msg('上传成功');
- layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', Common.ctxPath + res.data.src);
+ if(res.code == 0){
+ $("#uploadDemoView").show();
+ layer.msg('上传成功');
+ $('#resources_demo input[name="resourcesInfoName"]').val(res.data.name);
+ if (!$.isEmpty(res.data.cvPDFUrl)){
+ $('#resources_demo input[name="resourcesInfoContent"]').val(res.data.cvPDFUrl);
+ }else {
+ $('#resources_demo input[name="resourcesInfoContent"]').val(res.data.src);
+ }
+ }else {
+ layer.msg(res.msg);
+ }
}
});
var uploadInst = upload.render({
@@ -237,7 +257,7 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
courseInfoAllData.forEach((item,index) => {
/*根据课程类型值判断章节*/
if(item.courseInfoType == 2){
- item.courseInfoNo = index_parent;
+ item.courseInfoNo = numberfilter(index_parent);
index_parent++;
courseInfoParentIdOld = item.courseInfoParentId;
courseInfoIdOld = item.courseInfoId;
@@ -247,12 +267,13 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
courseInfoAllData.forEach((em,i) => {
if(item.courseInfoType == 2 && (item.courseInfoId == em.courseInfoParentId)){
- em.courseInfoNo = index_parent-1 + "." + index_child;
+ em.courseInfoNo = index_child;
index_child ++;
}
if(item.courseInfoType == 3 && (item.courseInfoId == em.courseInfoParentId)){
em.courseInfoNo = item.courseInfoNo+"."+index_child_child;
- index_child_child++
+ index_child_child++;
+
}
});
@@ -353,8 +374,12 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
htm += '
添加图文';
}
if (!$.isEmpty(d.resourcesInfoType)) {
- htm += '
查看';
- htm += '
上传';
+ if (d.resourcesInfoType != 4){
+ htm += '
查看';
+ // htm += '
查看';
+ }else {
+ htm += '
查看';
+ }
}
htm += '
编辑';
htm += '
删除';
@@ -424,11 +449,18 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
title = "资源名称";
param.resourcesInfoId= data.resourcesInfoId;
id = data.resourcesInfoId;
+ if (data.resourcesInfoType === 5) {
+ addPW(data,1);
+ } else if (data.resourcesInfoType === 4) {
+ addLine(data,1);
+ } else {
+ updataResourcesOpenLocal(data,"");
+ }
}else {
id = courseInfoId;
param.courseInfoId = courseInfoId;
+ addOpen(id,title,data,param);
}
- addOpen(id,title,data,param);
}else if (obj.event === 'del') {
layer.confirm('是否确定删除该信息?', function (index) {
layer.load();
@@ -568,10 +600,12 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
} else if (data.resourcesInfoType === 4) {
addLine(data,1);
} else {
- updataResourcesOpenLocal();
+ $('#resources_demo input[name="resourcesInfoId"]').val("");
+ updataResourcesOpenLocal({},data.courseInfoId);
}
} else {
- updataResourcesOpenLocal();
+ $('#resources_demo input[name="resourcesInfoId"]').val("");
+ updataResourcesOpenLocal({},data.courseInfoId);
}
}else {
if (!$.isEmpty(data.resourcesInfoType)) {
@@ -589,7 +623,11 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
}
/*本地资源上传弹出框*/
- function updataResourcesOpenLocal() {
+ function updataResourcesOpenLocal(data,courseInfoId) {
+ $('#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
@@ -598,7 +636,35 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
, area: ['650px','380px']
, btn: ['确定', '关闭']
,yes:function (index, layero){
- layer.close(index);
+ 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)){
+ layer.msg("请上传资源!", {icon: 2});
+ return;
+ }
+ if ($.isEmpty(resourcesInfoName)){
+ layer.msg("请输入资源名称!", {icon: 2});
+ return;
+ }
+ var param = {
+ resourcesInfoType:"",
+ resourcesInfoName:resourcesInfoName,
+ resourcesInfoContent:resourcesInfoContent,
+ resourcesInfoId:resourcesInfoId,
+ courseInfoId:courseInfoId
+ }
+ 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){
+ param.resourcesInfoType = 1;
+ }
+ if(resourcesInfoContent.indexOf(".PDF") >=0 || resourcesInfoContent.indexOf(".pdf") >=0){
+ param.resourcesInfoType = 3;
+ }
+ postResourcesInfo(resourcesInfoId, param,index)
}
, btn2: function (index, layero) {
layer.close(index);
@@ -614,7 +680,7 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
shadeClose: true,
btn: ['保存', '关闭'],
btnAlign: 'c',
- area: ['820px', '580px'],
+ area: ['820px', '600px'],
content: $("#edit_dialog"),
success: function (layero, index) {
loadResourcesInfo(sign);
@@ -889,5 +955,37 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
});
}, 50);
}
+
+ /**
+ * 阿拉伯转中文
+ * @param num
+ * @returns {string|string|string}
+ */
+ function numberfilter (num) {
+ const changeNum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'] // changeNum[0] = "零"
+ const unit = ['', '十', '百']
+ num = parseInt(num)
+ const getWan = (temp) => {
+ const strArr = temp.toString().split('').reverse()
+ let newNum = ''
+ for (var i = 0; i < strArr.length; i++) {
+ newNum = (i == 0 && strArr[i] == 0 ? '' : (i > 0 && strArr[i] == 0 && strArr[i - 1] == 0 ? '' : changeNum[strArr[i]] + (strArr[i] == 0 ? unit[0] : unit[i]))) + newNum
+ }
+ return newNum
+ }
+ const overWan = Math.floor(num / 100)
+ 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))){
+ return strr.split('')[0];
+ }else{
+ return strr.substring(1)
+ }
+ }else{
+ return overWan ? getWan(overWan) + '百' + getWan(noWan) : getWan(num)
+ }
+ }
});
\ No newline at end of file
diff --git a/web/src/main/resources/templates/jlw/previewPage/previewData.html b/web/src/main/resources/templates/jlw/previewPage/previewData.html
index a9b78bbe..ae23b3d3 100644
--- a/web/src/main/resources/templates/jlw/previewPage/previewData.html
+++ b/web/src/main/resources/templates/jlw/previewPage/previewData.html
@@ -27,16 +27,30 @@
.pdfobject{
height: 100% !important;
}
+ #twxs img{
+ max-width: 100%;
+ }
-
+
+
+
+
在线预览
${resourcesInfo.courseInfoName}
+
返回
+
+
+