Merge remote-tracking branch 'origin/beetlsql3-dev' into beetlsql3-dev

beetlsql3-dev
姚丹ab 2 years ago
commit 4721d153e1

@ -1092,6 +1092,8 @@ var Lib = {
});
layui.form.render();
},downloadFile:function (data){ //下载指定文件/或者预览文件 resourcesInfoType资源类型(1视频 2课件(ppt 、pdf) 3附件)
window.location.href = Common.ctxPath + "/jlw/resourcesInfo/previewData.do?resourcesInfoId="+data.resourcesInfoId;
return;
if(data.resourcesInfoType == 3){//前端下载文件
var a = document.createElement('a');
a.setAttribute('href', Common.ctxPath + data.resourcesInfoContent); //a.href='文件链接'

@ -102,7 +102,7 @@ var saveAs = saveAs
if (target_view) {
target_view.location.href = object_url;
} else {
window.open(object_url, "_blank");
`window.open(object_url, "_blank");`
}
filesaver.readyState = filesaver.DONE;
dispatch_all();

@ -130,6 +130,7 @@ public class ResourcesInfoController{
ModelAndView view = new ModelAndView("/jlw/previewPage/previewData.html");
ResourcesInfo resourcesInfo = resourcesInfoService.getById(resourcesInfoId);
view.addObject("resourcesInfo", resourcesInfo);
view.addObject("resourcesInfoContent", resourcesInfo.getResourcesInfoContent().replaceAll("\\\\","/"));
return view;
}

@ -5,7 +5,9 @@
.layui-table a {
margin-right: 10px;
}
a{
cursor: pointer;
}
.shiping {
color: red;
border: 2px solid red;
@ -58,14 +60,16 @@
<table id="courseInfoTable" lay-filter="courseInfoTable"></table>
<!--本地上传-->
<div style="display: none;" id="resources_demo">
<div class="layui-col-xs6" style="padding: 20px;border-right:thin solid #f4f4f4;height:270px">
<div class="layui-col-xs6" style="padding: 20px;border-right:thin solid #f4f4f4;height:200px">
<div class="grid-demo">
<div class="layui-upload-drag" id="resourcesUpload">
<i class="layui-icon" style="color: #3a71a8"></i>
<p>点击上传,或将文件拖拽到此处</p>
<div class="layui-hide" id="uploadDemoView">
<div id="uploadDemoView" style="display: none;">
<hr>
<img src="" alt="上传成功后渲染" style="max-width: 196px">
<span style="color: #1E9FFF;">上传成功</span>
<input type="hidden" name="resourcesInfoContent" />
<input type="hidden" name="resourcesInfoId" />
</div>
</div>
</div>
@ -80,10 +84,15 @@
</div>-->
</div>
</div>
<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">
</div>
</div>
</div>
<!--资源库上传-->
<div id="edit_dialog" class="layui-form" style="display: none;padding: 20px 20px 20px;height: 490px;overflow: auto;">
<div id="edit_dialog" class="layui-form" style="display: none;padding: 20px 20px 0;overflow: auto;">
<div class="layui-inline">
<label class="layui-form-label" style="width: 80px">资源名称:</label>
<div class="layui-input-block" style="margin-left: 110px;">
@ -128,7 +137,7 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
</div>
<!--添加图文-->
<div id="addPW_dialog" class="layui-form" style="display: none;padding-top: 20px">
<div id="addPW_dialog" class="layui-form" style="display: none;padding: 20px 20px 0 0;width: 900px;height:370px;">
<div class="layui-row">
<div class="layui-form-item">
<label class="layui-form-label" style="width: 80px"><span style="color: red">*</span>名称:</label>
@ -140,22 +149,22 @@ type="course_info.course_info_name.course_info_status!=3,course_info_type=1,find
<div class="layui-row">
<div class="layui-form-item">
<label class="layui-form-label" style="width: 80px">内容:</label>
<div class="layui-input-inline" style="width: 60% !important;min-width: 500px;">
<div class="layui-input-block" style="margin-left: 110px">
<textarea id="resourcesInfoContent" name="resourcesInfoContent" style="display:none;"></textarea>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<label class="layui-form-label" style="width: 80px">文件:</label>
<div class="layui-input-inline" style="width: 130px!important">
<button type="button" class="layui-btn" id="picWordUp">
<i class="layui-icon">&#xe67c;</i>上传图片
</button>
</div>
<div class="layui-form-mid">支持CS格式</div>
</div>
</div>
<!-- <div class="layui-row">-->
<!-- <div class="layui-form-item">-->
<!-- <label class="layui-form-label" style="width: 80px">文件:</label>-->
<!-- <div class="layui-input-inline" style="width: 130px!important">-->
<!-- <button type="button" class="layui-btn" id="picWordUp">-->
<!-- <i class="layui-icon">&#xe67c;</i>上传图片-->
<!-- </button>-->
<!-- </div>-->
<!-- <div class="layui-form-mid">支持CS格式</div>-->
<!-- </div>-->
<!-- </div>-->
</div>
<!--# } -->
<script type="text/javascript" src="${ctxPath}/plugins/xm-select.js?v=${jsVer}"></script>
@ -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 += '<a class="layui-table-link" lay-event="addPW">添加图文</a>';
}
if (!$.isEmpty(d.resourcesInfoType)) {
htm += '<a class="layui-table-link" lay-event="look">查看</a>';
htm += '<a class="layui-table-link" lay-event="update">上传</a>';
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="http://www.baidu.com" 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>';
@ -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)
}
}
});
</script>

@ -27,16 +27,30 @@
.pdfobject{
height: 100% !important;
}
#twxs img{
max-width: 100%;
}
</style>
<div style="margin: 20px;">
<input type="hidden" name="resourcesInfoType" value="${resourcesInfo.resourcesInfoType}" />
<input type="hidden" name="resourcesInfoContent" value="${resourcesInfo.resourcesInfoContent}" />
<!-- resourcesInfoType:资源类型(1视频 2课件ppt\pdf\word 3附件) -->
<div style="width: 100%;margin-top: 20px;height:calc(100vh - 40px);">
<div class="wordHeader" style="position: absolute;width: calc(100% - 56px);height: 88px;background-color: #f3f2f1;margin: 2px;">
<div style="background-color: #185abd;width: 100%;height: 50px;line-height: 50px;font-size: 20px;color: white;margin-top:-20px;">
<p style="padding-left: 20px;float: left;position:absolute;font-size: 15px;margin-top:0;">在线课件预览</p>
<p style="padding-left: 20px;float: left;position:absolute;font-size: 15px;margin-top:0;">在线预览</p>
<p style="text-align: center;">${resourcesInfo.courseInfoName}</p>
<a class="layui-btn layui-btn-primary addButton-cancel_" style="float: right;margin-right:20px;cursor: pointer;">返回</a>
</div>
</div>
<div id="twxs" style="width: 100%;height: 100%;">
<div style="background-color: #185abd;width: 100%;height: 50px;line-height: 50px;font-size: 20px;color: white;margin-top:-20px;">
<p style="padding-left: 20px;float: left;position:absolute;font-size: 15px;margin-top:0;">在线预览</p>
<p style="text-align: center;">${resourcesInfo.courseInfoName}</p>
<a class="layui-btn layui-btn-primary addButton-cancel_" style="float: right;margin-right:20px;cursor: pointer;">返回</a>
</div>
<div name="nrInfo" style="border: 1px solid #185abd;border-top: none;padding: 20px;min-height: 400px;">
</div>
</div>
<iframe id="InformationURL" src=''
@ -54,23 +68,25 @@
</body>
<script>
var resourcesInfoType = $("input[name='resourcesInfoType']").val();
var resourcesInfoContent = $("input[name='resourcesInfoContent']").val();
var resourcesInfoContent = '${resourcesInfoContent}';
//resourcesInfoContent = 'http://www.905.cn/server/filesystem/temp/banner/465wgghpca5.pdf';
if(resourcesInfoType == 2 && fileType(resourcesInfoContent) == 'pdf'){
if(resourcesInfoType == 3 && (fileType(resourcesInfoContent) == 'pdf' || fileType(resourcesInfoContent) == 'PDF')){
$(".wordHeader").show();//显示
addPDF(resourcesInfoContent);
$(".wordHeader").height(50).width('calc(100% - 77px)').find("div").css("background-color","#000000");
$(".wordHeader").height(50).width('calc(100% - 77px)').find("div").css("background-color","#185abd");
}else if(resourcesInfoType == 2){
$(".wordHeader").show();//显示
$(".wordHeader").height(88).width('calc(100% - 56px)').find("div").css("background-color","#185abd");
$("#pdfInfo").hide();
$("#InformationURL").show();
$("#twxs").hide();
$("#player-con").hide();
$('#InformationURL').attr('src', 'https://view.officeapps.live.com/op/view.aspx?src='+Common.isHttp(resourcesInfoContent));
}else if(resourcesInfoType == 1){
$(".wordHeader").hide();//隐藏
$("#pdfInfo").hide();
$("#InformationURL").hide();
$("#twxs").hide();
$("#player-con").show();
//$("#roomVideo source").attr("src",Common.isHttp(resourcesInfoContent));
@ -114,11 +130,23 @@
// }, function (player) {
// console.log("The player is created");
// });
}else if(resourcesInfoType == 5){ //图文
$(".wordHeader").hide();//显示
$(".wordHeader").height(88).width('calc(100% - 56px)').find("div").css("background-color","#185abd");
$("#pdfInfo").hide();
$("#InformationURL").hide();
$("#player-con").hide();
$("#twxs").show();
$("#twxs div[name='nrInfo']").html(resourcesInfoContent);
}
$(".addButton-cancel_").click(function () {
history.go(-1);
});
function addPDF(url){
$("#pdfInfo").show();
$("#InformationURL").hide();
$("#twxs").hide();
$("#player-con").hide();
var options = {
height: "550px",

Loading…
Cancel
Save