Merge remote-tracking branch 'yx/20250821-hz' into 104-master-0626

This commit is contained in:
joshen
2025-09-11 11:01:27 +08:00
5 changed files with 463 additions and 402 deletions

View File

@@ -661,6 +661,7 @@ export default {
// 没有写播放时间 // 没有写播放时间
onPlayerPlay() { onPlayerPlay() {
console.log(`start play`)
this.playerBoxShow = false; this.playerBoxShow = false;
this.isAppendTime = true; this.isAppendTime = true;
this.appendStudyTime();//启动追加学习时长 this.appendStudyTime();//启动追加学习时长
@@ -849,7 +850,6 @@ export default {
$this.curContent = c; $this.curContent = c;
} }
}) })
} }
this.contentList = rs.result.contents;//内容列表 this.contentList = rs.result.contents;//内容列表
this.totalContent = rs.result.contents.length;//一共有向个可以播放的内容 this.totalContent = rs.result.contents.length;//一共有向个可以播放的内容
@@ -1540,16 +1540,20 @@ export default {
this.appendStartTime = new Date(); this.appendStartTime = new Date();
//console.log('开始追加学习时长',this.isAppendTime); //console.log('开始追加学习时长',this.isAppendTime);
if (this.studyId == '') { if (this.studyId == '') {
console.warn(`this.studyId == ''`, this.studyId)
return; return;
} }
if (!this.curContent.id) { if (!this.curContent.id) {
console.warn(`this.curContent.id`, this.studyId)
return; return;
} }
//清除之前的 //清除之前的
if (this.appendHandle != null) { if (this.appendHandle != null) {
console.warn(`timer clear`)
window.clearTimeout(this.appendHandle); window.clearTimeout(this.appendHandle);
} }
if (!this.isAppendTime) { if (!this.isAppendTime) {
console.warn(`this.isAppendTime` , false)
return; return;
} }
//启动下次追加学习时长 //启动下次追加学习时长

View File

@@ -5,29 +5,32 @@
<page-title :showBack="true">查看我的答卷</page-title> <page-title :showBack="true">查看我的答卷</page-title>
<view style="background-color: #FFFFFF;"> <view style="background-color: #FFFFFF;">
<u-cell-group> <u-cell-group>
<u-cell title="答卷时间" :value="lastTime"></u-cell> <u-cell title="答卷时间" :value="answerSurveyTime"></u-cell>
<u-cell title="答卷用时" :value="testDuration+'秒'"></u-cell> <u-cell title="答卷用时" :value="testDuration+'秒'"></u-cell>
<u-cell title="本次得分" :value="score"></u-cell> <u-cell title="本次得分" :value="score"></u-cell>
</u-cell-group> </u-cell-group>
</view> </view>
<view style="padding: 20upx;"> <view style="padding: 20upx;">
<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"> <view class="qitem-content">
<view>[{{getTypeName(curItem.type)}}]{{curItem.content}}</view> <view>[{{ getTypeName(curItem.type) }}]{{ curItem.content }}</view>
<view class="qimg" v-if="curItem.images"><img class="qimg-fit" :src="imageBaseUrl+curItem.images"/></view> <view class="qimg" v-if="curItem.images"><img class="qimg-fit" :src="imageBaseUrl+curItem.images"/></view>
</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"> <view v-if="opt.images" class="qimg">
<img class="qimg-fit" :src="imageBaseUrl+opt.images"/> <img class="qimg-fit" :src="imageBaseUrl+opt.images"/>
</view> </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 v-if="userOptIdxs.indexOf(optIdx)>-1 && correctOptIdxs.indexOf(optIdx)==-1" style="color: #ff0000; ">×</text> </text>
<text v-if="userOptIdxs.indexOf(optIdx)>-1 && correctOptIdxs.indexOf(optIdx)==-1" style="color: #ff0000; ">×
</text>
</view> </view>
</view> </view>
</view> </view>
@@ -41,13 +44,13 @@
<view class="correct-response"> <view class="correct-response">
<view class="response-tit">正确答案</view> <view class="response-tit">正确答案</view>
<view class="response-sels"> <view class="response-sels">
<text v-for="op in correctOptIdxs" :key="op">{{toLetter(op+1)}}</text> <text v-for="op in correctOptIdxs" :key="op">{{ toLetter(op + 1) }}</text>
</view> </view>
</view> </view>
<view class="wrong-response"> <view class="wrong-response">
<view class="wrong-tit">我的答案</view> <view class="wrong-tit">我的答案</view>
<view class="wrong-sels"> <view class="wrong-sels">
<text v-for="op in userOptIdxs" :key="op">{{toLetter(op+1)}}</text> <text v-for="op in userOptIdxs" :key="op">{{ toLetter(op + 1) }}</text>
</view> </view>
</view> </view>
</view> </view>
@@ -56,135 +59,148 @@
<view class="analysis-con">联言判断就是断定集中事物情况同时存在的判断,因此该判断属于联言判断,答案为A</view> --> <view class="analysis-con">联言判断就是断定集中事物情况同时存在的判断,因此该判断属于联言判断,答案为A</view> -->
<view class="bottom-btns"> <view class="bottom-btns">
<u-button type="info" text="上一题" @click="prevSub" class="next" :disabled="this.curIndex<1"></u-button> <u-button type="info" text="上一题" @click="prevSub" class="next" :disabled="this.curIndex<1"></u-button>
<u-button type="info" text="下一题" @click="nextSub" class="next" :disabled="this.curIndex>=(this.total-1)"></u-button> <u-button type="info" text="下一题" @click="nextSub" class="next"
:disabled="this.curIndex>=(this.total-1)"></u-button>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import config from '@/config/index.js' 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 {
data() { data() {
return { return {
recordId:'',//保存的考试记录的id recordId: '',//保存的考试记录的id
toLetter:numberToLetter, toLetter: numberToLetter,
getTypeName:getQuestionType, getTypeName: getQuestionType,
imageBaseUrl:config.fileUrl, imageBaseUrl: config.fileUrl,
paper:{ paper: {
items:[] items: []
}, },
total:0, total: 0,
curIndex:0,//当前试题索引 curIndex: 0,//当前试题索引
curItem:{},//当前试题 curItem: {},//当前试题
curResult:false,//答案正确 curResult: false,//答案正确
score:0,//本次试卷的得分 score: 0,//本次试卷的得分
testName:'', testName: '',
contentId:'', contentId: '',
courseId:'', courseId: '',
passLine:60, passLine: 60,
testDuration:0, testDuration: 0,
lastTime:'', lastTime: '',
correctOptIdxs:[],//正确的答案 correctOptIdxs: [],//正确的答案
userOptIdxs:[],//用户的答案 userOptIdxs: [],//用户的答案
} }
}, },
onLoad(options){ computed: {
answerSurveyTime() {
console.log(`answer time: ` , this.lastTime)
if (!this.lastTime.length) return "Error Date"
const [y, m, d, h, min, s] = this.lastTime
return `${y}${m}${d}${h}:${min}:${s}`
}
},
onLoad(options) {
//如果id不存在应该返回错误页面 //如果id不存在应该返回错误页面
this.recordId=options.id;//当前考试记录的id this.recordId = options.id;//当前考试记录的id
if(this.recordId){ if (this.recordId) {
this.loadAnswerPaper(); this.loadAnswerPaper();
} }
}, },
methods:{ methods: {
loadAnswerPaper(){ loadAnswerPaper() {
apiCourseStudy.myExamPaper(this.recordId).then(res=>{ apiCourseStudy.myExamPaper(this.recordId).then(res => {
if(res.status==200){ if (res.status == 200) {
this.lastTime=res.result.lastTime; this.lastTime = res.result.lastTime;
this.score=res.result.score; this.score = res.result.score;
this.contentId=res.result.contentId; this.contentId = res.result.contentId;
this.courseId=res.result.courseId; this.courseId = res.result.courseId;
this.passLine=res.result.passLine; this.passLine = res.result.passLine;
this.testDuration=res.result.testDuration; this.testDuration = res.result.testDuration;
if(res.result.paper==''){ if (res.result.paper == '') {
this.$refs.messager.show({message:res.message,type:'error'}); this.$refs.messager.show({message: res.message, type: 'error'});
}else{ } else {
this.paper=JSON.parse(res.result.paper); this.paper = JSON.parse(res.result.paper);
this.total=this.paper.items.length; this.total = this.paper.items.length;
this.curItem=this.paper.items[this.curIndex]; this.curItem = this.paper.items[this.curIndex];
this.judgeAnswer(); this.judgeAnswer();
} }
}else{ } else {
this.$refs.messager.show({message:res.message,type:'error'}); this.$refs.messager.show({message: res.message, type: 'error'});
} }
}) })
}, },
judgeAnswer(){ judgeAnswer() {
//正确答案和错误答案 //正确答案和错误答案
this.correctOptIdxs=[];//正确答案 this.correctOptIdxs = [];//正确答案
this.userOptIdxs=[];//用户的答案 this.userOptIdxs = [];//用户的答案
let $this=this; let $this = this;
let item=this.curItem; let item = this.curItem;
item.options.forEach((opt,idx)=>{ item.options.forEach((opt, idx) => {
//填充正确答案 //填充正确答案
if(opt.answer){ if (opt.answer) {
$this.correctOptIdxs.push(idx); $this.correctOptIdxs.push(idx);
} }
if(item.type!=102){ //单选或判断 if (item.type != 102) { //单选或判断
if(opt.id==item.userAnswer){ if (opt.id == item.userAnswer) {
$this.userOptIdxs.push(idx); $this.userOptIdxs.push(idx);
} }
}else{ //多选 } else { //多选
if(item.userAnswer.indexOf(opt.id)>-1){ if (item.userAnswer.indexOf(opt.id) > -1) {
$this.userOptIdxs.push(idx); $this.userOptIdxs.push(idx);
} }
} }
}); });
//判断答案是否正确 //判断答案是否正确
if(this.correctOptIdxs.toString()==this.userOptIdxs.toString()){ if (this.correctOptIdxs.toString() == this.userOptIdxs.toString()) {
this.curResult=true; this.curResult = true;
}else{ } else {
this.curResult=false; this.curResult = false;
} }
}, },
prevSub(){ prevSub() {
if(this.curIndex==0){ if (this.curIndex == 0) {
return; return;
} }
this.curIndex--; this.curIndex--;
if(this.curIndex>-1){ if (this.curIndex > -1) {
this.curItem=this.paper.items[this.curIndex]; this.curItem = this.paper.items[this.curIndex];
this.judgeAnswer(); this.judgeAnswer();
} }
}, },
nextSub() { nextSub() {
this.curIndex++; this.curIndex++;
if(this.curIndex<this.total){ if (this.curIndex < this.total) {
this.curItem=this.paper.items[this.curIndex]; this.curItem = this.paper.items[this.curIndex];
this.judgeAnswer(); this.judgeAnswer();
} }
}, },
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.bottom-btns{ .bottom-btns {
padding: 10px; padding: 10px;
position: fixed; position: fixed;
width: 100%; width: 100%;
bottom: 0px; bottom: 0px;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
} }
.qitem{
.qitem {
padding: 20upx 40upx; padding: 20upx 40upx;
.qitem-content{
.qitem-content {
padding: 20upx 0upx; padding: 20upx 0upx;
} }
.qitem-opt{
.qitem-opt {
margin-bottom: 20upx; margin-bottom: 20upx;
min-height: 50upx; min-height: 50upx;
border-radius: 4px; border-radius: 4px;
@@ -193,40 +209,48 @@
justify-content: space-between; justify-content: space-between;
padding: 30upx 20upx; padding: 30upx 20upx;
} }
.qitem-opt-user{
.qitem-opt-user {
background-color: #fff3e5; background-color: #fff3e5;
} }
.qitem-opt-correct{
.qitem-opt-correct {
background-color: #5BA2FC; background-color: #5BA2FC;
color:#FFFFFF; color: #FFFFFF;
} }
.qitem-opt-wrong{
.qitem-opt-wrong {
background-color: #EF826B; background-color: #EF826B;
color:#FFFFFF; color: #FFFFFF;
} }
} }
.ed-top{
.ed-top {
display: flex; display: flex;
.preface{
.preface {
color: #D5D5D5; color: #D5D5D5;
margin-left: 16px; margin-left: 16px;
margin-top: 19px; margin-top: 19px;
} }
.mold{
.mold {
font-size: 12px; font-size: 12px;
color: #C1C1C1; color: #C1C1C1;
margin-top: 22px; margin-top: 22px;
margin-left: 5px; margin-left: 5px;
} }
} }
.ed-center{
.topic{ .ed-center {
.topic {
color: #2E2E2E; color: #2E2E2E;
margin-left: 16px; margin-left: 16px;
margin-top: 10px; margin-top: 10px;
} }
.topic-center{
&-1{ .topic-center {
&-1 {
width: 344px; width: 344px;
height: 64px; height: 64px;
border-radius: 4px; border-radius: 4px;
@@ -235,23 +259,27 @@
margin-top: 10px; margin-top: 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.topic_left{
.topic_left {
line-height: 64px; line-height: 64px;
margin-left: 16px; margin-left: 16px;
color: #FFFFFF; color: #FFFFFF;
display: flex; display: flex;
.liany{
.liany {
font-size: 12px; font-size: 12px;
margin-left: 5px; margin-left: 5px;
} }
} }
.topic_right{
.topic_right {
color: #FFFFFF; color: #FFFFFF;
line-height: 64px; line-height: 64px;
margin-right: 13px; margin-right: 13px;
} }
} }
&-2{
&-2 {
width: 344px; width: 344px;
height: 64px; height: 64px;
border-radius: 4px; border-radius: 4px;
@@ -260,23 +288,27 @@
margin-top: 10px; margin-top: 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.topic_left{
.topic_left {
line-height: 64px; line-height: 64px;
margin-left: 16px; margin-left: 16px;
color: #FFFFFF; color: #FFFFFF;
display: flex; display: flex;
.liany{
.liany {
font-size: 12px; font-size: 12px;
margin-left: 5px; margin-left: 5px;
} }
} }
.topic_right{
.topic_right {
color: #FFFFFF; color: #FFFFFF;
line-height: 64px; line-height: 64px;
margin-right: 13px; margin-right: 13px;
} }
} }
&-3{
&-3 {
width: 344px; width: 344px;
height: 64px; height: 64px;
border-radius: 4px; border-radius: 4px;
@@ -285,23 +317,27 @@
margin-top: 10px; margin-top: 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.topic_left{
.topic_left {
line-height: 64px; line-height: 64px;
margin-left: 16px; margin-left: 16px;
color: #000000; color: #000000;
display: flex; display: flex;
.liany{
.liany {
font-size: 12px; font-size: 12px;
margin-left: 5px; margin-left: 5px;
} }
} }
.topic_right{
.topic_right {
color: #000000; color: #000000;
line-height: 64px; line-height: 64px;
margin-right: 13px; margin-right: 13px;
} }
} }
&-4{
&-4 {
width: 344px; width: 344px;
height: 64px; height: 64px;
border-radius: 4px; border-radius: 4px;
@@ -310,17 +346,20 @@
margin-top: 10px; margin-top: 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.topic_left{
.topic_left {
line-height: 64px; line-height: 64px;
margin-left: 16px; margin-left: 16px;
color: #000000; color: #000000;
display: flex; display: flex;
.liany{
.liany {
font-size: 12px; font-size: 12px;
margin-left: 5px; margin-left: 5px;
} }
} }
.topic_right{
.topic_right {
color: #000000; color: #000000;
line-height: 64px; line-height: 64px;
margin-right: 13px; margin-right: 13px;
@@ -328,86 +367,101 @@
} }
} }
} }
.tit{
.tit {
color: #333333; color: #333333;
margin-left: 14px; margin-left: 14px;
margin-top: 38px; margin-top: 38px;
} }
.answer{
.answer {
width: 346px; width: 346px;
height: 112px; height: 112px;
background: #FFFFFF; background: #FFFFFF;
margin-left: 14px; margin-left: 14px;
margin-top: 18px; margin-top: 18px;
.result{
.result {
font-size: 12px; font-size: 12px;
color: #EF826B; color: #EF826B;
padding-left: 20px; padding-left: 20px;
padding-top: 10px; padding-top: 10px;
} }
.wrought{
.wrought {
display: flex; display: flex;
.correct-response{
.correct-response {
width: 87px; width: 87px;
height: 70px; height: 70px;
.response-tit{
.response-tit {
font-size: 14px; font-size: 14px;
color: #B3B3B3; color: #B3B3B3;
text-align: center; text-align: center;
padding-top: 10px; padding-top: 10px;
} }
.response-sels{
.response-sels {
color: #5B5B5B; color: #5B5B5B;
text-align: center; text-align: center;
padding-top: 8px; padding-top: 8px;
} }
} }
.wrong-response{
.wrong-response {
width: 87px; width: 87px;
height: 70px; height: 70px;
.wrong-tit{
.wrong-tit {
font-size: 14px; font-size: 14px;
color: #B3B3B3; color: #B3B3B3;
text-align: center; text-align: center;
padding-top: 10px; padding-top: 10px;
} }
.wrong-sels{
.wrong-sels {
color: #5B5B5B; color: #5B5B5B;
text-align: center; text-align: center;
padding-top: 8px; padding-top: 8px;
} }
} }
} }
} }
.analysis{
.analysis {
font-size: 14px; font-size: 14px;
color: #D3D3D3; color: #D3D3D3;
margin-left: 14px; margin-left: 14px;
margin-top: 20px; margin-top: 20px;
} }
.analysis-con{
.analysis-con {
font-size: 12px; font-size: 12px;
color: #000000; color: #000000;
margin-left: 14px; margin-left: 14px;
margin-top: 10px; margin-top: 10px;
} }
.question{
.question {
height: 52px; height: 52px;
background: #EF826B; background: #EF826B;
margin-top: 93px; margin-top: 93px;
color: #FFFFFF; color: #FFFFFF;
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 .qimg {
} //padding-left: 30px;
width: 100%;
text-align: left;
.qimg-fit {
width: 100%;
object-fit: scale-down
} }
}
</style> </style>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long