mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-07 18:06:47 +08:00
提交修改
This commit is contained in:
@@ -94,9 +94,11 @@
|
|||||||
this.loadRecord();
|
this.loadRecord();
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
studyId(newVal){
|
content(newObj){
|
||||||
|
this.loadExamInfo();
|
||||||
this.loadRecord();
|
this.loadRecord();
|
||||||
}
|
},
|
||||||
|
deep:true
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadExamInfo(){
|
loadExamInfo(){
|
||||||
@@ -125,24 +127,25 @@
|
|||||||
if(this.studyId==''){
|
if(this.studyId==''){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loadExamContent();
|
this.records=[];
|
||||||
if(this.records.length==0){
|
this.loadExamContent();
|
||||||
let params={
|
//if(this.records.length==0){
|
||||||
studyId:this.studyId,
|
let params={
|
||||||
contentId:this.content.id
|
studyId:this.studyId,
|
||||||
}
|
contentId:this.content.id
|
||||||
apiStudy.myExamList2(params).then(examRs=>{
|
|
||||||
if(examRs.status==200){
|
|
||||||
this.records=examRs.result;
|
|
||||||
let len=examRs.result.length;
|
|
||||||
if(this.info.times>len){
|
|
||||||
this.allowSubmit=true;
|
|
||||||
}else{
|
|
||||||
this.allowSubmit=false;
|
|
||||||
}
|
}
|
||||||
}
|
apiStudy.myExamList2(params).then(examRs=>{
|
||||||
})
|
if(examRs.status==200){
|
||||||
}
|
this.records=examRs.result;
|
||||||
|
let len=examRs.result.length;
|
||||||
|
if(this.info.times>len){
|
||||||
|
this.allowSubmit=true;
|
||||||
|
}else{
|
||||||
|
this.allowSubmit=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//}
|
||||||
},
|
},
|
||||||
startTest(){
|
startTest(){
|
||||||
//转向详细页面
|
//转向详细页面
|
||||||
|
|||||||
@@ -92,14 +92,12 @@
|
|||||||
this.loadHomeworkInfo();
|
this.loadHomeworkInfo();
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
studyId(newVal){
|
|
||||||
this.loadHomeworkInfo();
|
|
||||||
},
|
|
||||||
content(newVal,oldVal){
|
content(newVal,oldVal){
|
||||||
if(newVal.id!=oldVal.id){
|
if(newVal.id!=oldVal.id){
|
||||||
this.loadHomeworkInfo();
|
this.loadHomeworkInfo();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
deep:true
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadHomeworkInfo(){
|
loadHomeworkInfo(){
|
||||||
|
|||||||
@@ -83,7 +83,8 @@
|
|||||||
<view v-if="articleMore" @click="showMore" style="text-align: center;color: #387DF7;"><text>查看更多∨</text> </view>
|
<view v-if="articleMore" @click="showMore" style="text-align: center;color: #387DF7;"><text>查看更多∨</text> </view>
|
||||||
</view>
|
</view>
|
||||||
<div v-if="curContent.contentType == 50" style="min-height: 500px;">
|
<div v-if="curContent.contentType == 50" style="min-height: 500px;">
|
||||||
<web-view v-if="scormUrl" :src="scormUrl" frameborder="0" scrolling="no" border="0px" style="width:100%;height:100%;border:0px;"></web-view>
|
<!--因为web-view 动态切换地址不好用,所以这里先使用iframe-->
|
||||||
|
<iframe v-if="scormUrl" :src="scormUrl" frameborder="0" scrolling="no" border="0px" style="width:100%;height:500px;border:0px;"></iframe>
|
||||||
</div>
|
</div>
|
||||||
<view v-if="curContent.contentType==52">
|
<view v-if="curContent.contentType==52">
|
||||||
<!--外连接-->
|
<!--外连接-->
|
||||||
@@ -709,7 +710,20 @@
|
|||||||
this.playContent(this.curContent,0);
|
this.playContent(this.curContent,0);
|
||||||
//this.curSection=this.sectionList[0];
|
//this.curSection=this.sectionList[0];
|
||||||
}else{
|
}else{
|
||||||
this.curContent=this.contentList[0];
|
let treelist=this.catalogTree;
|
||||||
|
this.curSection=treelist[0].sec;
|
||||||
|
this.curContent=treelist[0].children[0];
|
||||||
|
// this.curContent=this.contentList[0];
|
||||||
|
// this.curSection=this.sectionList[0];
|
||||||
|
//要不要在这里处理?
|
||||||
|
// if(this.curContent.contentType==10 || this.curContent.contentType==20){
|
||||||
|
// if(this.contentList[0].content.startsWith('\{')){
|
||||||
|
// this.curriculumData=JSON.parse(this.contentList[0].content);
|
||||||
|
// }else{
|
||||||
|
// this.curriculumData.url=this.contentList[0].content;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//this.curContent=this.contentList[0];
|
||||||
this.playContent(this.curContent,0);
|
this.playContent(this.curContent,0);
|
||||||
}
|
}
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
@@ -821,6 +835,7 @@
|
|||||||
this.scormUrl='';//清空地址
|
this.scormUrl='';//清空地址
|
||||||
this.articleMore=true;
|
this.articleMore=true;
|
||||||
this.clearTimeHandle();
|
this.clearTimeHandle();
|
||||||
|
//this.curContent=0;
|
||||||
// console.log(con,'con');
|
// console.log(con,'con');
|
||||||
this.playerBoxShow=false;
|
this.playerBoxShow=false;
|
||||||
if(con.contentType==40){
|
if(con.contentType==40){
|
||||||
@@ -851,11 +866,13 @@
|
|||||||
pars+='&studentName='+encodeURIComponent(this.userInfo.name);
|
pars+='&studentName='+encodeURIComponent(this.userInfo.name);
|
||||||
pars+='&lmsId='+this.studyId;
|
pars+='&lmsId='+this.studyId;
|
||||||
pars+='&scoId=';//不指定,scorm模块自动根据学习记录定位
|
pars+='&scoId=';//不指定,scorm模块自动根据学习记录定位
|
||||||
|
pars+='&r='+Math.random();//加一个随机数,以便重新加载
|
||||||
let urlPre=window.location.protocol;
|
let urlPre=window.location.protocol;
|
||||||
let configUrl=config.scormPlayer;
|
let configUrl=config.scormPlayer;
|
||||||
configUrl=urlPre+configUrl.substring(configUrl.indexOf(':')+1);
|
configUrl=urlPre+configUrl.substring(configUrl.indexOf(':')+1);
|
||||||
|
|
||||||
this.scormUrl=configUrl+pars;//播放的首页
|
this.scormUrl=configUrl+pars;//播放的首页
|
||||||
|
console.log(this.scormUrl,'this.scormUrl')
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -877,6 +894,7 @@
|
|||||||
this.blobUrl=this.fileBaseUrl+this.curriculumData.url;
|
this.blobUrl=this.fileBaseUrl+this.curriculumData.url;
|
||||||
//console.log(this.blobUrl,'this.blobUrl');
|
//console.log(this.blobUrl,'this.blobUrl');
|
||||||
}
|
}
|
||||||
|
//console.log(con.contentType,'con.contentType');
|
||||||
this.curContent=con;
|
this.curContent=con;
|
||||||
this.catalogShow=false;
|
this.catalogShow=false;
|
||||||
this.scoreInfo.itemId=con.id;
|
this.scoreInfo.itemId=con.id;
|
||||||
|
|||||||
@@ -12,13 +12,19 @@
|
|||||||
</view>
|
</view>
|
||||||
<!--试题内容-->
|
<!--试题内容-->
|
||||||
<view class="qitem">
|
<view class="qitem">
|
||||||
<view class="qitem-info">[{{getTypeName(curItem.type)}}]{{curItem.content}}</view>
|
<view class="qitem-info">
|
||||||
|
<view> [{{getTypeName(curItem.type)}}]{{curItem.content}}</view>
|
||||||
|
<view class="qimg" v-if="curItem.images"><img class="qimg-fit" :src="imageBaseUrl+curItem.images"/></view>
|
||||||
|
</view>
|
||||||
<view v-for="(opt,optIdx) in curItem.options" :key="optIdx">
|
<view v-for="(opt,optIdx) in curItem.options" :key="optIdx">
|
||||||
<view class="qitem-opts">
|
<view class="qitem-opts">
|
||||||
<view class="qitem-opt" :class="{check:opt.checked}" @click="chooseOption(opt)">
|
<view class="qitem-opt" :class="{check:opt.checked}" @click="chooseOption(opt)">
|
||||||
{{toLetter(optIdx+1)}}.{{opt.content}}
|
{{toLetter(optIdx+1)}}.{{opt.content}}
|
||||||
<u-icon v-if="opt.checked" name="checkbox-mark" color="#00aa00"></u-icon>
|
<u-icon v-if="opt.checked" name="checkbox-mark" color="#00aa00"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-if="opt.images" class="qimg">
|
||||||
|
<img class="qimg-fit" :src="imageBaseUrl+opt.images"/>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -51,8 +57,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import config from '@/config/index.js'
|
||||||
import apiCourseStudy from '@/api/modules/courseStudy.js'
|
import apiCourseStudy from '@/api/modules/courseStudy.js'
|
||||||
import apiCourse from '@/api/modules/course.js';
|
import apiCourse from '@/api/modules/course.js';
|
||||||
|
import apiExamPaper from '@/api/modules/paper.js';
|
||||||
import {formatDate,getQuestionType,correctJudgment,numberToLetter} from '@/utils/tools.js';
|
import {formatDate,getQuestionType,correctJudgment,numberToLetter} from '@/utils/tools.js';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -63,6 +71,7 @@
|
|||||||
startTime:null,
|
startTime:null,
|
||||||
toLetter:numberToLetter,
|
toLetter:numberToLetter,
|
||||||
getTypeName:getQuestionType,
|
getTypeName:getQuestionType,
|
||||||
|
imageBaseUrl:config.fileUrl,
|
||||||
info:{},
|
info:{},
|
||||||
stop:false,
|
stop:false,
|
||||||
paper:[],
|
paper:[],
|
||||||
@@ -100,28 +109,48 @@
|
|||||||
apiCourse.getExam(this.examId).then(res=>{
|
apiCourse.getExam(this.examId).then(res=>{
|
||||||
if(res.status==200){
|
if(res.status==200){
|
||||||
this.info=res.result;
|
this.info=res.result;
|
||||||
let paper= JSON.parse(this.info.paperContent);
|
|
||||||
paper.items.forEach(item=>{
|
|
||||||
//console.log(item);
|
|
||||||
if(item.type==101){
|
|
||||||
item.userAnswer='';
|
|
||||||
}else if(item.type==102){
|
|
||||||
item.userAnswer=[];
|
|
||||||
}else{
|
|
||||||
item.userAnswer=''
|
|
||||||
}
|
|
||||||
item.options.forEach(opt=>{
|
|
||||||
opt.checked=false;
|
|
||||||
})
|
|
||||||
})
|
|
||||||
this.total=paper.items.length;
|
|
||||||
this.paper =paper;
|
|
||||||
//console.log(this.paper);
|
|
||||||
this.curItem=paper.items[this.curIndex];
|
|
||||||
this.startTime=new Date();//记录开始时间
|
|
||||||
this.timerValue=res.result.testDuration;
|
|
||||||
this.timer=setInterval(this.changeTimer,60000);
|
|
||||||
this.loadStudyItemId();
|
this.loadStudyItemId();
|
||||||
|
if(this.info.paperType==2){
|
||||||
|
apiExamPaper.getPaperContent(this.info.paperId).then(rs=>{
|
||||||
|
if(rs.status==200){
|
||||||
|
//console.log(rs.result)
|
||||||
|
let paperItems=JSON.parse(rs.result);
|
||||||
|
//console.log(this.examPaper.json,'this.examPaper.json');
|
||||||
|
let qitems=this.convertToItems(paperItems);
|
||||||
|
this.paper ={items:qitems};
|
||||||
|
this.total=qitems.length;
|
||||||
|
this.curItem=qitems[this.curIndex];
|
||||||
|
this.startTime=new Date();//记录开始时间
|
||||||
|
this.timerValue=this.info.testDuration;
|
||||||
|
this.timer=setInterval(this.changeTimer,60000);
|
||||||
|
}else{
|
||||||
|
this.$message.error('加载试卷内容失败,请与管理员联系,试卷是否已删除');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
let paper= JSON.parse(this.info.paperContent);
|
||||||
|
paper.items.forEach(item=>{
|
||||||
|
//console.log(item);
|
||||||
|
if(item.type==101){
|
||||||
|
item.userAnswer='';
|
||||||
|
}else if(item.type==102){
|
||||||
|
item.userAnswer=[];
|
||||||
|
}else{
|
||||||
|
item.userAnswer=''
|
||||||
|
}
|
||||||
|
item.options.forEach(opt=>{
|
||||||
|
opt.checked=false;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.total=paper.items.length;
|
||||||
|
this.paper =paper;
|
||||||
|
//console.log(this.paper);
|
||||||
|
this.curItem=paper.items[this.curIndex];
|
||||||
|
this.startTime=new Date();//记录开始时间
|
||||||
|
this.timerValue=res.result.testDuration;
|
||||||
|
this.timer=setInterval(this.changeTimer,60000);
|
||||||
|
|
||||||
|
}
|
||||||
}else if(res.status==404){
|
}else if(res.status==404){
|
||||||
//没有找到考试信息
|
//没有找到考试信息
|
||||||
}else{
|
}else{
|
||||||
@@ -129,6 +158,56 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
//独立考试的试题转化为课内考试的试题
|
||||||
|
convertToItems(questions){
|
||||||
|
let qitems=[];
|
||||||
|
questions.forEach(item=>{
|
||||||
|
let q={
|
||||||
|
id:item.id,
|
||||||
|
type:item.type==1? 101:item.type==2? 102:103,
|
||||||
|
score:item.defaultScore,
|
||||||
|
checked:false,
|
||||||
|
userAnswer:'',
|
||||||
|
optShow:true,
|
||||||
|
content:item.title,
|
||||||
|
images:item.images,
|
||||||
|
options:[]
|
||||||
|
}
|
||||||
|
if(item.type==3){
|
||||||
|
q.options.push({
|
||||||
|
id:item.id+'1',
|
||||||
|
images:'',
|
||||||
|
content:"正确",
|
||||||
|
answer:item.answer=='true'? true:false,
|
||||||
|
checked:false
|
||||||
|
});
|
||||||
|
q.options.push({
|
||||||
|
id:item.id+'2',
|
||||||
|
images:'',
|
||||||
|
content:"错误",
|
||||||
|
answer:item.answer=='true'? false:true,
|
||||||
|
checked:false
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
item.optionList.forEach(opt=>{
|
||||||
|
q.options.push({
|
||||||
|
id:opt.id,
|
||||||
|
images:opt.images,
|
||||||
|
content:opt.content,
|
||||||
|
answer:opt.isAnswer,
|
||||||
|
checked:false
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(q.type==102){
|
||||||
|
q.userAnswer=[];
|
||||||
|
}
|
||||||
|
qitems.push(q);
|
||||||
|
});
|
||||||
|
console.log(qitems,'qitems')
|
||||||
|
return qitems;
|
||||||
|
},
|
||||||
loadStudyItemId(){
|
loadStudyItemId(){
|
||||||
//获取studyItemId;
|
//获取studyItemId;
|
||||||
apiCourseStudy.getStudyContentItem(this.studyId,this.info.contentId).then(rs=>{
|
apiCourseStudy.getStudyContentItem(this.studyId,this.info.contentId).then(rs=>{
|
||||||
@@ -363,5 +442,14 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
}
|
}
|
||||||
|
.qimg{
|
||||||
|
//padding-left: 30px;
|
||||||
|
width:100%;
|
||||||
|
text-align: left;
|
||||||
|
.qimg-fit{
|
||||||
|
width:100%;
|
||||||
|
|
||||||
|
object-fit:scale-down
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!--考试试卷详细信息,考试过的试卷内容-->
|
<!--考试试卷详细信息,考试过的试卷内容-->
|
||||||
<view>
|
<view style="padding-bottom: 60px;">
|
||||||
<u-toast ref="messager"></u-toast>
|
<u-toast ref="messager"></u-toast>
|
||||||
<page-title :showBack="true">查看我的答卷</page-title>
|
<page-title :showBack="true">查看我的答卷</page-title>
|
||||||
<view style="background-color: #FFFFFF;">
|
<view style="background-color: #FFFFFF;">
|
||||||
@@ -14,10 +14,16 @@
|
|||||||
<view style="padding-top: 10upx;color: #757575; ">第{{curIndex+1}}题 / 共{{total}}题</view>
|
<view style="padding-top: 10upx;color: #757575; ">第{{curIndex+1}}题 / 共{{total}}题</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="qitem">
|
<view class="qitem">
|
||||||
<view class="qitem-content">[{{getTypeName(curItem.type)}}]{{curItem.content}}</view>
|
<view class="qitem-content">
|
||||||
|
<view>[{{getTypeName(curItem.type)}}]{{curItem.content}}</view>
|
||||||
|
<view class="qimg" v-if="curItem.images"><img class="qimg-fit" :src="imageBaseUrl+curItem.images"/></view>
|
||||||
|
</view>
|
||||||
<view v-for="(opt,optIdx) in curItem.options" :key="optIdx" class="qitem-opt" :class="{'qitem-opt-user':userOptIdxs.indexOf(optIdx)>-1}">
|
<view v-for="(opt,optIdx) in curItem.options" :key="optIdx" class="qitem-opt" :class="{'qitem-opt-user':userOptIdxs.indexOf(optIdx)>-1}">
|
||||||
<view>
|
<view>
|
||||||
<view>{{toLetter(optIdx+1)}}, {{opt.content}}</view>
|
<view>{{toLetter(optIdx+1)}}, {{opt.content}}</view>
|
||||||
|
<view v-if="opt.images" class="qimg">
|
||||||
|
<img class="qimg-fit" :src="imageBaseUrl+opt.images"/>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<text v-if="userOptIdxs.indexOf(optIdx)>-1 && correctOptIdxs.indexOf(optIdx)>-1" style="color: #00aa00; ">√</text>
|
<text v-if="userOptIdxs.indexOf(optIdx)>-1 && correctOptIdxs.indexOf(optIdx)>-1" style="color: #00aa00; ">√</text>
|
||||||
@@ -56,6 +62,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import config from '@/config/index.js'
|
||||||
import apiCourseStudy from '@/api/modules/courseStudy.js'
|
import apiCourseStudy from '@/api/modules/courseStudy.js'
|
||||||
import {formatDate,getQuestionType,correctJudgment,numberToLetter} from '@/utils/tools.js';
|
import {formatDate,getQuestionType,correctJudgment,numberToLetter} from '@/utils/tools.js';
|
||||||
export default {
|
export default {
|
||||||
@@ -64,6 +71,7 @@
|
|||||||
recordId:'',//保存的考试记录的id
|
recordId:'',//保存的考试记录的id
|
||||||
toLetter:numberToLetter,
|
toLetter:numberToLetter,
|
||||||
getTypeName:getQuestionType,
|
getTypeName:getQuestionType,
|
||||||
|
imageBaseUrl:config.fileUrl,
|
||||||
paper:{
|
paper:{
|
||||||
items:[]
|
items:[]
|
||||||
},
|
},
|
||||||
@@ -392,4 +400,14 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 52px;
|
line-height: 52px;
|
||||||
}
|
}
|
||||||
|
.qimg{
|
||||||
|
//padding-left: 30px;
|
||||||
|
width:100%;
|
||||||
|
text-align: left;
|
||||||
|
.qimg-fit{
|
||||||
|
width:100%;
|
||||||
|
|
||||||
|
object-fit:scale-down
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user