mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-06 09:26:45 +08:00
提交修改
This commit is contained in:
@@ -94,9 +94,11 @@
|
||||
this.loadRecord();
|
||||
},
|
||||
watch:{
|
||||
studyId(newVal){
|
||||
content(newObj){
|
||||
this.loadExamInfo();
|
||||
this.loadRecord();
|
||||
}
|
||||
},
|
||||
deep:true
|
||||
},
|
||||
methods: {
|
||||
loadExamInfo(){
|
||||
@@ -125,24 +127,25 @@
|
||||
if(this.studyId==''){
|
||||
return;
|
||||
}
|
||||
this.loadExamContent();
|
||||
if(this.records.length==0){
|
||||
let params={
|
||||
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;
|
||||
this.records=[];
|
||||
this.loadExamContent();
|
||||
//if(this.records.length==0){
|
||||
let params={
|
||||
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;
|
||||
}
|
||||
}
|
||||
})
|
||||
//}
|
||||
},
|
||||
startTest(){
|
||||
//转向详细页面
|
||||
|
||||
@@ -92,14 +92,12 @@
|
||||
this.loadHomeworkInfo();
|
||||
},
|
||||
watch:{
|
||||
studyId(newVal){
|
||||
this.loadHomeworkInfo();
|
||||
},
|
||||
content(newVal,oldVal){
|
||||
if(newVal.id!=oldVal.id){
|
||||
this.loadHomeworkInfo();
|
||||
}
|
||||
}
|
||||
},
|
||||
deep:true
|
||||
},
|
||||
methods: {
|
||||
loadHomeworkInfo(){
|
||||
|
||||
@@ -83,7 +83,8 @@
|
||||
<view v-if="articleMore" @click="showMore" style="text-align: center;color: #387DF7;"><text>查看更多∨</text> </view>
|
||||
</view>
|
||||
<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>
|
||||
<view v-if="curContent.contentType==52">
|
||||
<!--外连接-->
|
||||
@@ -709,7 +710,20 @@
|
||||
this.playContent(this.curContent,0);
|
||||
//this.curSection=this.sectionList[0];
|
||||
}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);
|
||||
}
|
||||
uni.hideLoading();
|
||||
@@ -821,6 +835,7 @@
|
||||
this.scormUrl='';//清空地址
|
||||
this.articleMore=true;
|
||||
this.clearTimeHandle();
|
||||
//this.curContent=0;
|
||||
// console.log(con,'con');
|
||||
this.playerBoxShow=false;
|
||||
if(con.contentType==40){
|
||||
@@ -851,11 +866,13 @@
|
||||
pars+='&studentName='+encodeURIComponent(this.userInfo.name);
|
||||
pars+='&lmsId='+this.studyId;
|
||||
pars+='&scoId=';//不指定,scorm模块自动根据学习记录定位
|
||||
pars+='&r='+Math.random();//加一个随机数,以便重新加载
|
||||
let urlPre=window.location.protocol;
|
||||
let configUrl=config.scormPlayer;
|
||||
configUrl=urlPre+configUrl.substring(configUrl.indexOf(':')+1);
|
||||
|
||||
this.scormUrl=configUrl+pars;//播放的首页
|
||||
console.log(this.scormUrl,'this.scormUrl')
|
||||
|
||||
}
|
||||
});
|
||||
@@ -877,6 +894,7 @@
|
||||
this.blobUrl=this.fileBaseUrl+this.curriculumData.url;
|
||||
//console.log(this.blobUrl,'this.blobUrl');
|
||||
}
|
||||
//console.log(con.contentType,'con.contentType');
|
||||
this.curContent=con;
|
||||
this.catalogShow=false;
|
||||
this.scoreInfo.itemId=con.id;
|
||||
|
||||
@@ -12,13 +12,19 @@
|
||||
</view>
|
||||
<!--试题内容-->
|
||||
<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 class="qitem-opts">
|
||||
<view class="qitem-opt" :class="{check:opt.checked}" @click="chooseOption(opt)">
|
||||
{{toLetter(optIdx+1)}}.{{opt.content}}
|
||||
<u-icon v-if="opt.checked" name="checkbox-mark" color="#00aa00"></u-icon>
|
||||
</view>
|
||||
<view v-if="opt.images" class="qimg">
|
||||
<img class="qimg-fit" :src="imageBaseUrl+opt.images"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -51,8 +57,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from '@/config/index.js'
|
||||
import apiCourseStudy from '@/api/modules/courseStudy.js'
|
||||
import apiCourse from '@/api/modules/course.js';
|
||||
import apiExamPaper from '@/api/modules/paper.js';
|
||||
import {formatDate,getQuestionType,correctJudgment,numberToLetter} from '@/utils/tools.js';
|
||||
export default {
|
||||
data() {
|
||||
@@ -63,6 +71,7 @@
|
||||
startTime:null,
|
||||
toLetter:numberToLetter,
|
||||
getTypeName:getQuestionType,
|
||||
imageBaseUrl:config.fileUrl,
|
||||
info:{},
|
||||
stop:false,
|
||||
paper:[],
|
||||
@@ -100,28 +109,48 @@
|
||||
apiCourse.getExam(this.examId).then(res=>{
|
||||
if(res.status==200){
|
||||
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();
|
||||
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{
|
||||
@@ -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(){
|
||||
//获取studyItemId;
|
||||
apiCourseStudy.getStudyContentItem(this.studyId,this.info.contentId).then(rs=>{
|
||||
@@ -363,5 +442,14 @@
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
.qimg{
|
||||
//padding-left: 30px;
|
||||
width:100%;
|
||||
text-align: left;
|
||||
.qimg-fit{
|
||||
width:100%;
|
||||
|
||||
object-fit:scale-down
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<!--考试试卷详细信息,考试过的试卷内容-->
|
||||
<view>
|
||||
<view style="padding-bottom: 60px;">
|
||||
<u-toast ref="messager"></u-toast>
|
||||
<page-title :showBack="true">查看我的答卷</page-title>
|
||||
<view style="background-color: #FFFFFF;">
|
||||
@@ -14,10 +14,16 @@
|
||||
<view style="padding-top: 10upx;color: #757575; ">第{{curIndex+1}}题 / 共{{total}}题</view>
|
||||
</view>
|
||||
<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>
|
||||
<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>
|
||||
<text v-if="userOptIdxs.indexOf(optIdx)>-1 && correctOptIdxs.indexOf(optIdx)>-1" style="color: #00aa00; ">√</text>
|
||||
@@ -56,6 +62,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from '@/config/index.js'
|
||||
import apiCourseStudy from '@/api/modules/courseStudy.js'
|
||||
import {formatDate,getQuestionType,correctJudgment,numberToLetter} from '@/utils/tools.js';
|
||||
export default {
|
||||
@@ -64,6 +71,7 @@
|
||||
recordId:'',//保存的考试记录的id
|
||||
toLetter:numberToLetter,
|
||||
getTypeName:getQuestionType,
|
||||
imageBaseUrl:config.fileUrl,
|
||||
paper:{
|
||||
items:[]
|
||||
},
|
||||
@@ -392,4 +400,14 @@
|
||||
text-align: center;
|
||||
line-height: 52px;
|
||||
}
|
||||
.qimg{
|
||||
//padding-left: 30px;
|
||||
width:100%;
|
||||
text-align: left;
|
||||
.qimg-fit{
|
||||
width:100%;
|
||||
|
||||
object-fit:scale-down
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user