Merge branch 'scorm' into third

This commit is contained in:
daihh
2022-12-21 21:55:02 +08:00
12 changed files with 365 additions and 78 deletions

View File

@@ -19,7 +19,7 @@
<!--显示内容-->
<div v-else style="margin: 0px 10px;">
<!--视频-->
<div v-show="content.contentType>0 && content.contentType<41">
<div v-show="content.contentType>0 && content.contentType<51">
<div style="display: flex;justify-content:space-between">
<div>
<el-input maxlength="50" @change="updateName" v-model="content.contentName" placeholder="内容的名称(限50字以内)"></el-input>
@@ -95,6 +95,9 @@
</div>
<pdfPreview v-if="content.contentType==40 && curPdfPath!=''" :filePath="fileBaseUrl+curPdfPath"></pdfPreview>
</div>
<div v-if="content.contentType==50" style="text-align: center;">
<iframe v-if="scormUrl" :src="scormUrl" frameborder="0" border="0px" style="width:100%;height:400px;border:0px"></iframe>
</div>
</div>
</div>
<!--课件选择或上传的公用组件-->
@@ -102,7 +105,7 @@
<choose-course-file ref="coursewarePanel" :resType="content.contentType" @choose="chooseFile"></choose-course-file>
</div>
<div v-show="content.contentRefId=='' && content.contentType==50">
<choose-course-scorm ref="coursewarePanel" :resType="content.contentType" @choose="chooseFile"></choose-course-scorm>
<choose-course-file ref="coursewareScormPanel" :resType="content.contentType" @choose="chooseFile"></choose-course-file>
</div>
<!--图文-->
<div v-show="content.contentType==41">
@@ -326,7 +329,6 @@
</template>
<script>
import chooseCourseFile from '@/components/Course/chooseCourseFile.vue'
import chooseCourseScorm from '@/components/Course/chooseCourseScorm.vue'
import courseHomework from '@/components/Course/courseHomework.vue'
import courseExam from '@/components/Course/courseExam.vue'
import simplePaper from "@/components/Course/simpleTestPaper.vue";
@@ -365,14 +367,15 @@
default:1
}
},
components:{chooseCourseFile,WxEditor,courseHomework,courseExam,simplePaper,fileUpload,pdfPreview,audioPlayer,videoPlayer,chooseCourseScorm},
components:{chooseCourseFile,WxEditor,courseHomework,courseExam,simplePaper,fileUpload,pdfPreview,audioPlayer,videoPlayer},
// inject: [ "informationDetails" ],
data(){
return {
converStatus:4,
fileBaseUrl:process.env.VUE_APP_FILE_BASE_URL,
fileBaseUrl:this.$xpage.constants.fileBaseUrl,
curPdfPath:'',
curCFile:{},//当前课件的内容
scormUrl:'',//scormUrl地址
comTypes:[
//文件类型,10视频20音频30图片 40 文档41表图文50表scrom包,90表其它
//图文41连接52作业60考试61评估62
@@ -438,7 +441,13 @@
},
created() {
//console.log(this.ctype, this.course,'ctype');
//console.log(process.env, 'process.env');
},
mounted(){
//this.init();
if(process.env.NODE_ENV=='development'){
this.fileBaseUrl=process.env.VUE_APP_FILE_BASE_URL;
}
},
watch:{
reset(newVal){
@@ -452,6 +461,8 @@
this.loadPdfFile();
}else if(newVal.contentType==41){
this.htmlContent=newVal.content;
}else if(newVal.contentType==50){
this.loadScormFile();
}else if(newVal.contentType==52){
//外部连接
if(newVal.content!=''){
@@ -491,6 +502,7 @@
this.linkInfo.url='';
this.htmlContent='';
this.curPdfPath='';
this.scormUrl='';
this.curCFile={};
this.exam.contentId='';
this.exam.paperContent='';
@@ -524,6 +536,25 @@
});
}
},
loadScormFile(){
//对于scorm课件内容需要再查一下
this.scormUrl='';
apiCourseFile.detail(this.content.contentRefId).then(rs=>{
if(rs.status==200){
this.curCFile=rs.result;
//this.curPdfPath=rs.result.previewFilePath;
this.content.content='scorm';
this.scormUrl=process.env.VUE_APP_SCORM_URL+'?r=1&mode=preview&scormId='+this.curCFile.id;//播放的首页
console.log(this.scormUrl,'this.scormUrl')
}
});
// let fname=this.content.content;
// if(fname && fname.indexOf('.pdf')>-1){
// this.curPdfPath=this.content.content;
// }else{
// }
},
loadHomeworkInfo(){
apiCourse.getHomework(this.content.id).then(res=>{
if(res.status==200){
@@ -686,6 +717,7 @@
//未初始化会调用失败所以这里要等vue变化后再调用
this.$nextTick(function(){
this.$refs.coursewarePanel.findCourseFile();
this.$refs.coursewareScormPanel.findCourseFile();
})
}
@@ -697,7 +729,9 @@
// this.content.content.url=cfile.filePath;
if(this.content.contentType==10 || this.content.contentType==20){
this.curriculumData.url = cfile.filePath;
}else{
}else if(this.content.contentType==50){ //scorm课件内容
//this.chooseCourseScorm
} else{
if(cfile.previewFilePath){
this.content.content=cfile.previewFilePath;
}else{
@@ -713,7 +747,10 @@
setTimeout(function(){
$this.loadPdfFile();
},2000);
}else if(this.content.contentType==50){
setTimeout(function(){
$this.loadScormFile();
},2000);
}
}
}

View File

@@ -90,7 +90,8 @@
{id:'1',type:'video',name:'视频',img:'el-icon-video-camera',resType:10,maxSize:1024,maxSizeName:"1G",fileTypes:['mp4']},
{id:'2',type:'sound',name:'音频',img:'el-icon-service',resType:20,maxSize:1024,maxSizeName:"1G",fileTypes:['mp3']},
{id:'3',type:'image',name:'图片',img:'el-icon-picture-outline',resType:30,maxSize:10,maxSizeName:"10M",fileTypes:["png","jpg","gif","bmp"]},
{id:'4',type:'doc',name:'文档',img:'el-icon-document',resType:40,maxSize:1024,maxSizeName:"1G",fileTypes:["doc", "xls", "ppt","docx", "xlsx", "pptx","txt","pdf"]}
{id:'4',type:'doc',name:'文档',img:'el-icon-document',resType:40,maxSize:1024,maxSizeName:"1G",fileTypes:["doc", "xls", "ppt","docx", "xlsx", "pptx","txt","pdf"]},
{id:'5',type:'scorm',name:'SCORM课件',img:'el-icon-suitcase',resType:50,maxSize:1024,maxSizeName:"1G",fileTypes:["zip"]}
],
curComType:{id:'',type:'',name:'',maxSizeName:'',fileTypes:[]},
findState:1,
@@ -133,6 +134,11 @@
return false;
}
}
if(this.resType==50){
this.data.dir='scorm';
}else{
this.data.dir='course';
}
return true;
},
// 上传失败

View File

@@ -24,15 +24,26 @@
</div>
<!--内容区-->
<div style="margin-top: 10px;">
<div v-if="cware.content.contentType<41 && !cware.findShow">
<div v-if="cware.content.contentType<51 && !cware.findShow">
<div v-if="cware.content.contentRefId==''">
<div style="display: flex;justify-content: center;padding-top: 50px;">
<div>
<file-upload :fileType="getFileTypes(cware.content.contentType)" dir="course" :isShowTip="false" :showList="true" size="small" :text="'上传新'+getType(cware.content.contentType)" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></file-upload>
</div>
<div style="padding-top: 0px;">
<!-- <div> -->
<choose-course-file ref="coursewarePanel" :resType="cware.content.contentType" @choose="chooseFile"></choose-course-file>
<!-- <file-upload
:fileType="getFileTypes(cware.content.contentType)"
dir="course"
:isShowTip="false"
:showList="true"
size="small"
:text="'上传新'+getType(cware.content.contentType)"
@success="handleUploadSuccess"
@remove="handleRemoveSuccess">
</file-upload> -->
<!-- </div>
<div style="margin-left: 10px;">
<el-button type="primary" size="small" @click="toFindCWare()" >选择已有{{getType(cware.content.contentType)}}</el-button>
</div>
</div> -->
</div>
</div>
<div v-else>
@@ -116,6 +127,9 @@
<pdfPreview v-if="cware.content.contentType == 40 && cware.content.pdfPath!=''" :filePath="fileBaseUrl+cware.content.pdfPath"></pdfPreview>
</div>
</div>
<div v-if="cware.content.contentType==50" style="text-align: center;">
<iframe v-if="scormUrl" :src="scormUrl" frameborder="0" border="0px" style="width:100%;height:400px;border:0px"></iframe>
</div>
</div>
</div>
@@ -263,8 +277,8 @@
<el-tab-pane label="考试" name="exam">
<div v-if="exam.show==1">
<div style="padding: 10px; text-align: center;">
<el-button @click="changeExamShow(3)" type="primary" >自定义考试</el-button>
<!-- <el-button @click="changeExamShow(2)" type="primary" size="small">选择已有考试</el-button> -->
<el-button @click="openCusExam()" type="primary" >自定义考试</el-button>
<el-button @click="openChoosePaper()" type="primary">选择已有考试</el-button>
</div>
</div>
<div v-if="exam.show==2">
@@ -275,37 +289,39 @@
</el-select>
</div>
-->
<div><el-input maxlength="50" placeholder="名称"></el-input></div>
<div><el-input maxlength="50" placeholder="创建人"></el-input></div>
<div style="padding-left: 10px;"><el-button type="primary" >搜索已有考试</el-button></div>
<div><el-input v-model="usePaper.keyword" maxlength="50" placeholder="名称"></el-input></div>
<div style="padding-left: 10px;"><el-button @click="findExamPapers()" type="primary" >查询</el-button></div>
<div style="padding-left: 10px;"><el-button @click="changeExamShow(1)" type="danger" >返回</el-button></div>
</div>
<div>
<div style="text-align: center;padding-top: 10px;">
<el-table style="100%" :data="hasCWare.list" border stripe>
<el-table-column label="考试名称" prop="author"><template>考试名称</template></el-table-column>
<el-table-column label="创建时间" prop="author">
<div style="text-align: center;padding-top: 10px; overflow-y: auto;">
<el-table style="100%" height="480" :data="usePaper.list" border stripe>
<el-table-column prop="testName" label="考试名称"></el-table-column>
<el-table-column prop="sysCreateTime" label="创建时间"></el-table-column>
<el-table-column prop="sysCreateBy" label="创建人" width="80px" ></el-table-column>
<el-table-column label="选择" width="60px">
<template slot-scope="scope">
2022-02-03
</template>
</el-table-column>
<el-table-column label="创建人" prop="content">
<template>
XXX
</template>
</el-table-column>
<el-table-column label="选择" width="80px">
<template slot-scope="scope">
<el-button @click="changeExamShow(9)" type="primary" >选择</el-button>
<el-button size="mini" @click="chooseExamPaper(scope.row)" type="primary" >选择</el-button>
</template>
</el-table-column>
</el-table>
<!--分页功能-->
<div v-if="usePaper.total >10" style="text-align: center; margin-top:10px">
<el-pagination background
@current-change="changePaperPage"
:current-page="usePaper.pageIndex"
:page-sizes="[10, 20, 30, 40]"
:page-size="usePaper.pageSize"
layout="total,pager"
:total="usePaper.total"
></el-pagination>
</div>
</div>
</div>
</div>
<div v-if="exam.show==3">
<div style="display: flex;justify-content: space-between;padding:5px 10px;line-height: 30px; border-bottom: 1px solid #e7e7e7;">
<div>自定义考试</div>
<div>{{exam.paperType==1? '自定义考试':'使用独立考试试卷'}} </div>
<div>
<el-checkbox v-model="exam.onlyQuestion">只显示试题</el-checkbox>
<el-button :loading="loading" style="margin-left: 10px;" @click="saveContent(3)" type="primary" > </el-button>
@@ -387,9 +403,12 @@
</el-form-item>
</el-form>
</div>
<div>
<div v-if="exam.info.paperType==1">
<simplePaper :data="exam.paperJson"></simplePaper>
</div>
<div v-if="exam.info.paperType==2">
<div style="font-size: 20px;padding: 10px;" >试卷 {{usePaper.paperName}}</div>
</div>
</div>
</div>
<div v-if="exam.show==9">
@@ -520,17 +539,19 @@
</div>
</template>
<script>
import chooseCourseFile from '@/components/Course/chooseCourseFile.vue'
import WxEditor from "@/components/Editor/indexCourse.vue";
import simplePaper from "@/components/Course/simpleTestPaper.vue";
import FileUpload from '@/components/FileUpload/index.vue';
import pdfPreview from "@/components/PdfPreview/index.vue";
import apiCourse from '../../api/modules/course.js';
import apiCourseFile from '../../api/modules/courseFile.js';
import apiExamPaper from '../../api/modules/paper.js';
import audioPlayer from '@/components/AudioPlayer/index.vue';
import {getType} from '../../utils/tools.js';
import { deepClone } from "../../utils";
export default{
components:{WxEditor,simplePaper,FileUpload,pdfPreview,audioPlayer},
components:{WxEditor,simplePaper,FileUpload,pdfPreview,audioPlayer,chooseCourseFile},
props: {
contents:{
type:Array,
@@ -565,6 +586,7 @@
curCFile:{},//当前课件的内容
fileBaseUrl:this.$xpage.constants.fileBaseUrl,
imageShowUrl: '',
scormUrl:'',//scorm课件对应的url地址
activeName: 'courseware',
getType: getType,
cwareTypes:[
@@ -669,6 +691,16 @@
}
},
usePaper:{ //使用考试试卷
pageIndex:1,
pageSize:10,
total:0,
list:[],
keyword:'',
paperId:'',//选择的试卷的id
paperName:'',//选择的试卷的名称
paperJson:{items:[]},
},
exam:{
show:1,
content:{id:'',contentType:61,sortIndex:3},
@@ -695,7 +727,6 @@
paperId:'',//试卷的id,只有paperType为2的时间才会有值
info:'',//考试说明
paperContent:'',//试题的json字符串
}
},
assess:{
@@ -717,6 +748,9 @@
},
mounted(){
//this.init();
if(process.env.NODE_ENV=='development'){
this.fileBaseUrl=process.env.VUE_APP_FILE_BASE_URL;
}
},
watch:{
reset(newVal){
@@ -730,6 +764,7 @@
methods:{
init(){
this.activeName='courseware';
this.scormUrl='';//scorm的路径
this.curCFile={},//当前课件的内容
this.cware.content={id:'',contentType:0,sortIndex:1,contentRefId:'',pdfPath:''};
this.cware.show=1;
@@ -758,6 +793,12 @@
if(con.contentType==40){
//console.log('加载pdf文件内容');
$this.loadPdfFile();
}else if(con.contentType==50){
//console.log('加载pdf文件内容');
if(!this.scormUrl){
$this.loadScormFile();
}
}
if(con.contentType==52){
if(con.content.startsWith('\{')){
@@ -814,6 +855,22 @@
});
}
},
loadScormFile(){
//对于scorm课件内容需要再查一下
//this.scormUrl='';
if(this.scormUrl){
return;
}
apiCourseFile.detail(this.cware.content.contentRefId).then(rs=>{
if(rs.status==200){
this.curCFile=rs.result;
//this.curPdfPath=rs.result.previewFilePath;
this.cware.content.content='scorm';
this.scormUrl=process.env.VUE_APP_SCORM_URL+'?r=1&mode=preview&scormId='+this.curCFile.id;//播放的首页
//console.log(this.scormUrl,'this.scormUrl')
}
});
},
loadHomeworkInfo(){
apiCourse.getHomework(this.homework.content.id).then(res=>{
if(res.status==200){
@@ -919,6 +976,7 @@
resetContent(index){
if(index==1){
this.cware.content.id='';
this.scormUrl='';
this.cware.content.contentRefId='';
this.cware.content.contentName='';
this.cware.content.content='';
@@ -997,6 +1055,7 @@
});
if(!pass){
this.$message.error("试卷试题请填写完整,每个试题必须要有答案");
this.loading=false;
return;
}
this.exam.info.paperContent=JSON.stringify(this.exam.paperJson);
@@ -1083,6 +1142,36 @@
}
})
},
chooseFile(cfile){
this.cware.content.contentRefId=cfile.id;
//如果是非pdf文档 这里需要使用cfile.id再去获取
this.cware.content.contentName=cfile.name;
if(this.cware.content.resType === 10 || this.cware.content.resType ==20) {
this.cware.curriculumData.url = cfile.filePath;
}else if(this.cware.content.resType === 50){
}else{
if(cfile.previewFilePath){
this.cware.curriculumData.url = cfile.previewFilePath;
}else{
this.cware.curriculumData.url = cfile.filePath;
}
}
this.cware.content.duration=cfile.duration;//时长
this.saveContent(1);
let $this=this;
if(this.cware.content.contentType==40){
setTimeout(function(){
$this.loadPdfFile();
},1000);
}else if(this.cware.content.contentType==50){
setTimeout(function(){
$this.loadScormFile();
},500);
}
},
getCoursewareList() {
// name:查询的名称的关键字
// self:true/false,默认是true,是否只查询自己上传的课件
@@ -1168,15 +1257,74 @@
changeHomeworkShow(idx){
this.homework.show=idx;
},
changeExamShow(idx){
this.exam.show=idx;
},
assessmentHandle(){
this.assess.show=2;
},
changeExamShow(idx){
this.exam.show=idx;
},
openCusExam(){ //自定义考试
this.exam.show=3;
this.exam.paperType=1;
this.exam.paperId='';
this.usePaper.pageIndex=1;
this.usePaper.keyword="";
},
openChoosePaper(){
this.exam.show=2;
this.exam.paperType=3;
this.exam.paperId='';
},
findExamPapers(){ //查询已有的考试试卷
this.usePaper.pageIndex=1;
this.loadExamPapers();
},
loadExamPapers(){
let pars={
pageIndex:this.usePaper.pageIndex,
pageSize:this.usePaper.pageSize,
keyword:this.usePaper.keyword
}
apiExamPaper.querylist(pars).then(rs=>{
if(rs.status==200){
this.usePaper.list=rs.result.list;
this.usePaper.total=rs.result.count;
}else{
this.$message.error('查询可用试卷失败');
}
})
},
changePaperPage(pindex){
this.usePaper.pageIndex=pindex;
this.loadExamPapers();
},
chooseExamPaper(epaper){ //选择试卷后
if(epaper.counts==0){
this.$message.error('此试卷无试题内容,请重新选择');
return;
}
this.exam.info.paperType=2;// 选择已有试卷
this.exam.info.paperId=epaper.id;// 选择已有试卷
this.usePaper.paperId=epaper.id;
this.usePaper.paperName=epaper.testName;
//this.usePaper.paperJson= epaper.paperContent;
this.loadExamPaper();
this.changeExamShow(3);
},
loadExamPaper(){
if(this.exam.info.paperType!=2){
return;
}
apiExamPaper.detail(this.exam.info.paperId).then(rs=>{
if(rs.status==200){
this.usePaper.paperId=rs.result.id;
this.usePaper.paperName=rs.result.testName;
//this.usePaper.paperJson= rs.result.paperContent;
}
})
}
}
}
</script>
<style lang="scss" scoped>

View File

@@ -79,6 +79,10 @@ export default {
type: Number,
default: 1024,
},
scorm:{
type:String,
default:''
},
// 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: {
type: Array,
@@ -156,6 +160,13 @@ export default {
//this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
return false;
}
//console.log(this.scorm,fileExtension,'upload');
if(this.scorm && this.scorm==fileExtension){
this.data.dir="scorm";
}
//console.log(this.data,'this.data');
}
// 校检文件大小
if (this.fileSize) {
@@ -166,6 +177,7 @@ export default {
return false;
}
}
if(this.loading) {
this.isLoading = true;
}