Commit cd791c84 authored by zhengke's avatar zhengke

修改

parent b5077e12
......@@ -2,75 +2,42 @@
<!-- 阅读理解 -->
<view>
<view class="item">
<view class="name">
<view>
{{ changeNumToHan(sortIndex) }}、阅读理解
<text class="Exam_Score">(共{{ data.length }}道)</text>
</view>
<view class="ExamIndex_Box">
<text class="Single_Before">{{ ExamIndex }}</text>/<text class="Exam_Total">{{ data.length }}</text>
</view>
</view>
<swiper class="swiper-box" :style="{
height: `calc(100vh - 350rpx)`,
}" :autoplay="autoplay" :current="current" @change="onchange">
<swiper-item v-if="sortIndex != 1"></swiper-item>
<swiper-item v-for="(item1, index1) in data" :key="index1">
<view class="item1" :style="{height: `calc(100vh - 390rpx - ${statusBarHeight}px)`}">
<view class="flex">
<van-nav-bar fixed>
<template #left>
<van-icon name="cross" size="32rpx" @click="goBack()" />
</template>
<template #title>
<text class="Exam_Current">{{current+1}}</text><text class="Exam_Count">/{{Count}}</text>
</template>
</van-nav-bar>
<swiper class="swiper-box" :style="{height: `calc(100vh - 280rpx)`}" :current="current" @change="onchange">
<swiper-item v-for="(item1, index1) in dataList" :key="index1">
<view class="item1">
<view class="flex" style="max-height:520rpx;overflow:auto;">
<view class="num readTitle" v-html="item1.Title"></view>
</view>
<view :style="{maxHeight: `calc(100vh - 450rpx - ${statusBarHeight}px)`}"
<view :style="{maxHeight: `calc(100vh - 800rpx)`}"
style="overflow-y: auto;">
<view style="margin:30rpx;" class="Exam_Score">本阅读理解共{{item1.QuestionContentObj.length}}小题
</view>
<template v-if="isOperate">
<template v-if="item1.StundetAnswer.length<item1.QuestionContentObj.length">
<view class="questionView">
<view v-for="(item2, index2) in item1.QuestionContentObj" :key="index2"
class="item2">
<view class="flex questionTitle">
<view style="white-space: nowrap">{{ index2 + 1 }}、({{
item2.QuestionName.slice(0, 2)
}})</view>
<view v-html="item2.SubTitle"></view><text
class="Exam_Score">{{item2.SubScore}}</text>
<view style="white-space: nowrap">{{ index2 + 1 }}、({{item2.QuestionName.slice(0, 2)}})</view>
<view v-html="item2.SubTitle"></view>
</view>
<view v-for="(item3, index3) in item2.SubAnwser" :key="index3">
<!-- 单选 、判断-->
<view class="flex flex_start_center item3" v-if="
item2.QuestionKey === 'single' ||
item2.QuestionKey === 'judge'||item2.QuestionKey === 'single-number'
">
<view class="chooseNum" :class="{ myAnswer: item3.IsAnswer }"
@click="singerChange(item2, item3)">{{ item3.Name }}
</view>
<view class="chooseName" @click="singerChange(item2, item3)"
v-html="item3.Content"></view>
</view>
<!-- 多选 -->
<view class="flex flex_start_center item3"
v-if="item2.QuestionKey === 'multiple'">
<view class="chooseNum" :class="{ myAnswer: item3.IsAnswer }"
@click="multipleChange(item2, item3)">{{ item3.Name }}
<!-- 单选 -->
<view class="flex flex_start_center item3"
v-if="item2.QuestionKey === 'single' || item2.QuestionKey === 'single-number'">
<view class="chooseNum" :class="{ myAnswer: item1.StundetAnswer[index2]==item3.Name }"
@click="singerChange(item1,index2,item3)">{{ item3.Name }}
</view>
<view class="chooseName" @click="multipleChange(item2, item3)"
<view class="chooseName" @click="singerChange(item1,index2,item3)"
v-html="item3.Content"></view>
</view>
<!-- 填空 -->
<view class="flex flex_start_center item3"
v-if="item2.QuestionKey === 'fill-in'">
<view style="margin-right:15rpx;">{{ index3 + 1 }} </view>
<input type="text" style="height:70rpx;" v-model="item3.Content"
class="chooseName chooseName2" placeholder="请填写答案"
@input="AnswerChange(item2)" />
</view>
<!-- 简答 -->
<view class="flex flex_start_center item3"
v-if="item2.QuestionKey === 'short-answer'">
<textarea type="text" v-model="item3.Content"
class="chooseName chooseName2" placeholder="请填写答案"
@input="AnswerChange(item2)" />
</view>
</view>
</view>
</view>
......@@ -83,72 +50,45 @@
<view style="white-space: nowrap">
{{ index2 + 1 }}、({{item2.QuestionName.slice(0, 2)}})
</view>
<view v-html="item2.SubTitle"></view><text
class="Exam_Score">{{item2.SubScore}}</text>
<view v-html="item2.SubTitle"></view>
</view>
<view v-for="(item3, index3) in item2.SubAnwser" :key="index3">
<!-- 单选 、判断-->
<!-- 单选-->
<view class="flex item3"
v-if="item2.QuestionKey === 'single' || item2.QuestionKey === 'judge'||item2.QuestionKey === 'single-number'">
<view class="chooseNum" :class="{ isTrueAnswer: item3.IsAnswer }">
{{ item3.Name }}
</view>
<view class="chooseName" :class="{ isTrueAnswer: item3.IsAnswer }"
v-html="item3.Content"></view>
</view>
<!-- 多选 -->
<view class="flex item3" v-if="item2.QuestionKey === 'multiple'">
<view class="chooseNum" :class="{ isTrueAnswer: item3.IsAnswer }">
v-if="item2.QuestionKey === 'single' || item2.QuestionKey === 'single-number'">
<view class="chooseNum" :class="{ 'isTrueAnswer': item3.IsAnswer,'isNotAnswer':getErrorAnswer(item1,index2,item3.Name)}">
{{ item3.Name }}
</view>
<view class="chooseName" :class="{ isTrueAnswer: item3.IsAnswer }"
v-html="item3.Content"></view>
</view>
<!-- 填空 -->
<view class="flex item3" v-if="item2.QuestionKey === 'fill-in'">
<view class="chooseNum">{{ index3 + 1 }} </view>
<view v-html="item3.Content" class="chooseName"></view>
</view>
<!-- 简答 -->
<view class="flex item3" v-if="item2.QuestionKey === 'short-answer'">
<view v-html="item3.Content" class="chooseName"></view>
</view>
</view>
<view class="AnswerContent">
<view>
<text style="color: #8c8a94">正确答案:</text>
<text
class="isTrueAnswer">{{item1.QuestionAnswerList[index2].SubAnswer}}</text>
class="isTrueAnswer">{{item1.QuestionAnswerList[index2]}}</text>
<text>您的答案:
<template v-if="item1.AnswerList[index2].SubAnswer!=''">
<template v-if="item1.StundetAnswer.length>0">
<text
v-if="item1.QuestionAnswerList[index2].SubAnswer == item1.AnswerList[index2].SubAnswer"
v-if="item1.QuestionAnswerList[index2] == item1.StundetAnswer[index2]"
class="isTrueAnswer">
{{ item1.AnswerList[index2].SubAnswer }}
{{ item1.StundetAnswer[index2] }},回答正确
</text>
<text v-else
class="isNotAnswer">{{item1.AnswerList[index2].SubAnswer}},回答错误</text>
class="isNotAnswer">{{item1.StundetAnswer[index2]}},回答错误</text>
</template>
<template v-else>
<text class="isNotAnswer">未作答</text>
</template>
</text>
</view>
<view style="margin-top:20rpx;"
v-if="item1.AnswerList[index2].StudentScore!=''||item1.AnswerList[index2].StudentScore===0">
<text style="color:#8c8a94">您的得分:</text>
<text class="isTrueAnswer"
v-if="item1.AnswerList[index2].StudentScore>0">{{item1.AnswerList[index2].StudentScore}}</text>
<text class="isNotAnswer"
v-else>{{item1.AnswerList[index2].StudentScore}}</text>
</view>
</view>
</view>
<view
style="word-wrap: break-word; margin: 0 30rpx 30rpx 30rpx;display: flex;align-items: center;"
style="word-wrap: break-word; margin: 0 30rpx 30rpx 30rpx;display: flex;"
class="AnswerContent" v-if="item1.AnswerParse">
<text style="color: #8c8a94">解析:</text>
<text style="color: #8c8a94;flex-shrink: 0;">解析:</text>
<view style="color: #000" v-html="item1.AnswerParse"></view>
</view>
</view>
......@@ -157,13 +97,12 @@
</view>
</swiper-item>
</swiper>
<view class="AnswerBtn clear">
<view class="AnswerBtnFirst" @click="getBeforeExam()" v-if="ExamIndex!=1||sortIndex!=1">上一题
</view>
<view class="AnswerBtnSecond" v-if="ExamIndex != data.length" @click="getNextExam()">下一题</view>
</view>
<view class="AnswerBtn clear">
<view class="AnswerBtnFirst" @click="getBeforeExam()" v-if="current>1">上一题
</view>
<view class="AnswerBtnSecond" :class="{'isCanNext':!isCanNext}" v-if="current!=dataList.length" @click="getNextExam()">下一题</view>
</view>
<van-toast id="van-toast" />
</view>
</template>
......@@ -179,138 +118,111 @@
onMounted,
} from "vue";
import {
changeNumToHan
} from "../../utils/index";
SetStudentPractice
} from "../../api/exam";
export default {
props: {
paperData: Array,
sort: Number,
isLast: Boolean,
startIndex: Number,
isOperate: Boolean,
ExamStatus: Number
Count: Number
},
setup(props, context) {
let {
ctx
} = getCurrentInstance();
let data = reactive({
autoplay: false,
sortIndex: props.sort+1,
data: props.paperData,
Score: 0, //总分
current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题
questionH: 500, //问题区域高度
timer: null,
timeOutEvent: false,
dataList: props.paperData,
current: 0, //默认从第几个开始-用于从快捷菜单点入
statusBarHeight: 0,
isOperate: props.isOperate,
ExamStatus: props.ExamStatus
});
//判断是否是第一大题
if (data.sortIndex === 1) {
data.current = 0;
//从答题卡进入
if (props.startIndex) {
data.current = props.startIndex - 1;
data.ExamIndex = props.startIndex;
}
} else {
if (props.startIndex) {
data.current = props.startIndex;
data.ExamIndex = props.startIndex;
}
}
watch(data.data, (newVal, oldVal) => {
if (newVal) {
context.emit("answerChange", newVal);
}
isCanNext:false //判断是否能点击下一题
});
let UserInfo = uni.getStorageSync('userInfo');
watch(() => [...props.paperData], (val) => {
val.forEach(x => {
x.Title = x.Title.replace(/\<img/gi, '<img style="max-width:100%;height:520rpx" ')
})
data.dataList = [...data.dataList, ...val];
})
let methods = {
changeNumToHan,
jumpPage() {
uni.navigateTo({
url: "/pages/exam/examPaper",
});
},
back() {
goBack() {
uni.navigateBack();
},
getErrorAnswer(item1,index,name){
if (item1.StundetAnswer[index] ==name) {
return true
}else{
return false
}
},
//----------------------------------------选题----------------------------------
// 单选or判断
singerChange(item2, item3) {
item2.SubAnwser.map((e) => {
if (e.Name == item3.Name) {
e.IsAnswer = true;
item2.IsRes = true; //答题标记
} else {
e.IsAnswer = false;
}
});
},
// 多选
multipleChange(item2, item3) {
item3.IsAnswer = !item3.IsAnswer;
//标记已回答
item2.IsRes = item2.SubAnwser.some((e) => {
return e.IsAnswer;
});
},
onchange(e) {
data.ExamIndex = e.detail.current;
if (data.sortIndex == 1) {
data.ExamIndex = e.detail.current + 1;
singerChange(item1,index,item3) {
item1.StundetAnswer[index] = item3.Name;
//判断题数已经全做
if(item1.StundetAnswer.length==item1.QuestionContentObj.length){
data.isCanNext=true;
}
},
AnswerChange(item) {
item.IsRes = item.SubAnwser.some((e) => {
console.log(217, e.Content && e.Content != "");
return e.Content && e.Content != "";
});
console.log(218, item.IsRes);
},
//触摸事件
touchstart(e) {
clearTimeout(data.timer);
data.timer = setTimeout(() => {
data.timeOutEvent = true;
}, 100);
},
touchmove(e) {
if (data.timeOutEvent) {
let touches = e.touches[0];
let startTy = touches.clientY;
let screenHeight = uni.getSystemInfoSync().screenHeight;
data.questionH = (screenHeight - startTy) * 2;
onchange(e) {
data.current = e.detail.current;
if(data.current+1==data.dataList.length){
this.$emit('getAfter');
}
},
touchend() {
data.timeOutEvent = false;
clearTimeout(data.timer);
},
//点击上一题
getBeforeExam() {
data.current = data.current - 1;
},
//点击下一题
getNextExam() {
data.current = data.current + 1;
if(data.isCanNext){
let msg = {
Id: 0,
StudentId: UserInfo.AccountId,
Category: data.dataList[data.current].Category,
QuestionId: data.dataList[data.current].QuestionId,
Title: data.dataList[data.current].Title,
QuestionContent: data.dataList[data.current].QuestionContentObj,
QuestionTypeId: data.dataList[data.current].QuestionTypeId,
QuestionTypeKey: data.dataList[data.current].QuestionTypeKey,
StudentAnswer: data.dataList[data.current].StundetAnswer,
AnswerParse: data.dataList[data.current].AnswerParse,
LevelType:data.dataList[data.current].LevelType,
Answer:data.dataList[data.current].Answer,
IsAnswer: 0,
IsWrong: 0
}
if(data.dataList[data.current].StundetAnswer.length>0){
msg.IsAnswer=1;
}else{
msg.IsAnswer=0;
}
if(data.dataList[data.current].StundetAnswer.length==data.dataList[data.current].QuestionAnswerList.length){
if(data.dataList[data.current].StundetAnswer.toString()==data.dataList[data.current].QuestionAnswerList.toString()){
msg.IsWrong = 0
}else{
msg.IsWrong = 1
}
}
let res = SetStudentPractice(msg).then(res => {
if (res) {
if (res.Code == 1) {
}
}
});
data.current = data.current + 1;
}
}
};
onMounted(() => {
console.log(361, data.data);
data.data.forEach(x => {
data.dataList.forEach(x => {
x.Title = x.Title.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ')
})
if (props.isLast) {
if (data.sortIndex === 1) {
data.current = props.paperData.DetailsList.length - 1;
} else {
data.current = props.paperData.DetailsList.length;
}
}
data.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
});
let that = methods;
......@@ -489,6 +401,7 @@
font-family: PingFang SC;
font-weight: bold;
color: #111111;
flex-shrink: 0;
}
.chooseName {
......@@ -523,4 +436,17 @@
color: #999999;
font-size: 28rpx;
}
.Exam_Current {
font-size: 35rpx;
color: red;
}
.Exam_Count {
color: gray;
font-size: 26rpx;
}
.isCanNext{
background-color: gray!important;
}
</style>
......@@ -200,7 +200,7 @@
</view>
</view>
<view class="Ques_CirContent">
<view class="Ques_CirContent" v-if="TypeObj.wordsFinishCount">
<view class="Ques_Circle" @click="goExam(1)">
<view class="Ques_Top">单词</view>
<view class="Ques_Num" v-if="TypeObj">{{TypeObj.wordsFinishCount}}/{{TypeObj.wordsTotalCount}}</view>
......
......@@ -12,7 +12,7 @@
<!-- 单词 -->
<word :paperData="dataList" v-if="Type==1" :Count="Count" @getAfter="getAfter()" />
<!-- 阅读理解 -->
<readingCompre :paperData="dataList" v-if="Type==4"/>
<readingCompre :paperData="dataList" v-if="Type==4" :Count="Count" @getAfter="getAfter()" />
</view>
<van-toast id="van-toast" />
</view>
......@@ -85,16 +85,20 @@ export default {
if (res.Code == 1) {
console.log(res,'数据');
this.dataList = res.Data.PageData;
this.Count = res.Data.Count;
}
}
});
},
//往后追加题
getAfter(){
data.examMsg.PageIndex++;
if(data.Type==1){
data.examMsg.PageIndex++;
this.GetWords();
}
if(data.Type==4){
this.GetMyQuestionReading();
}
},
//获取答案改变后的数据
getAnswerChange(val, index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment