Commit cd791c84 authored by zhengke's avatar zhengke

修改

parent b5077e12
...@@ -2,75 +2,42 @@ ...@@ -2,75 +2,42 @@
<!-- 阅读理解 --> <!-- 阅读理解 -->
<view> <view>
<view class="item"> <view class="item">
<view class="name"> <van-nav-bar fixed>
<view> <template #left>
{{ changeNumToHan(sortIndex) }}、阅读理解 <van-icon name="cross" size="32rpx" @click="goBack()" />
<text class="Exam_Score">(共{{ data.length }}道)</text> </template>
</view> <template #title>
<view class="ExamIndex_Box"> <text class="Exam_Current">{{current+1}}</text><text class="Exam_Count">/{{Count}}</text>
<text class="Single_Before">{{ ExamIndex }}</text>/<text class="Exam_Total">{{ data.length }}</text> </template>
</view> </van-nav-bar>
</view> <swiper class="swiper-box" :style="{height: `calc(100vh - 280rpx)`}" :current="current" @change="onchange">
<swiper class="swiper-box" :style="{ <swiper-item v-for="(item1, index1) in dataList" :key="index1">
height: `calc(100vh - 350rpx)`, <view class="item1">
}" :autoplay="autoplay" :current="current" @change="onchange"> <view class="flex" style="max-height:520rpx;overflow:auto;">
<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">
<view class="num readTitle" v-html="item1.Title"></view> <view class="num readTitle" v-html="item1.Title"></view>
</view> </view>
<view :style="{maxHeight: `calc(100vh - 450rpx - ${statusBarHeight}px)`}" <view :style="{maxHeight: `calc(100vh - 800rpx)`}"
style="overflow-y: auto;"> style="overflow-y: auto;">
<view style="margin:30rpx;" class="Exam_Score">本阅读理解共{{item1.QuestionContentObj.length}}小题 <view style="margin:30rpx;" class="Exam_Score">本阅读理解共{{item1.QuestionContentObj.length}}小题
</view> </view>
<template v-if="isOperate"> <template v-if="item1.StundetAnswer.length<item1.QuestionContentObj.length">
<view class="questionView"> <view class="questionView">
<view v-for="(item2, index2) in item1.QuestionContentObj" :key="index2" <view v-for="(item2, index2) in item1.QuestionContentObj" :key="index2"
class="item2"> class="item2">
<view class="flex questionTitle"> <view class="flex questionTitle">
<view style="white-space: nowrap">{{ index2 + 1 }}、({{ <view style="white-space: nowrap">{{ index2 + 1 }}、({{item2.QuestionName.slice(0, 2)}})</view>
item2.QuestionName.slice(0, 2) <view v-html="item2.SubTitle"></view>
}})</view>
<view v-html="item2.SubTitle"></view><text
class="Exam_Score">{{item2.SubScore}}</text>
</view> </view>
<view v-for="(item3, index3) in item2.SubAnwser" :key="index3"> <view v-for="(item3, index3) in item2.SubAnwser" :key="index3">
<!-- 单选 、判断--> <!-- 单选 -->
<view class="flex flex_start_center item3" v-if=" <view class="flex flex_start_center item3"
item2.QuestionKey === 'single' || v-if="item2.QuestionKey === 'single' || item2.QuestionKey === 'single-number'">
item2.QuestionKey === 'judge'||item2.QuestionKey === 'single-number' <view class="chooseNum" :class="{ myAnswer: item1.StundetAnswer[index2]==item3.Name }"
"> @click="singerChange(item1,index2,item3)">{{ item3.Name }}
<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> </view>
<view class="chooseName" @click="multipleChange(item2, item3)" <view class="chooseName" @click="singerChange(item1,index2,item3)"
v-html="item3.Content"></view> v-html="item3.Content"></view>
</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> </view>
</view> </view>
...@@ -83,72 +50,45 @@ ...@@ -83,72 +50,45 @@
<view style="white-space: nowrap"> <view style="white-space: nowrap">
{{ index2 + 1 }}、({{item2.QuestionName.slice(0, 2)}}) {{ index2 + 1 }}、({{item2.QuestionName.slice(0, 2)}})
</view> </view>
<view v-html="item2.SubTitle"></view><text <view v-html="item2.SubTitle"></view>
class="Exam_Score">{{item2.SubScore}}</text>
</view> </view>
<view v-for="(item3, index3) in item2.SubAnwser" :key="index3"> <view v-for="(item3, index3) in item2.SubAnwser" :key="index3">
<!-- 单选 、判断--> <!-- 单选-->
<view class="flex item3" <view class="flex item3"
v-if="item2.QuestionKey === 'single' || item2.QuestionKey === 'judge'||item2.QuestionKey === 'single-number'"> v-if="item2.QuestionKey === 'single' || item2.QuestionKey === 'single-number'">
<view class="chooseNum" :class="{ isTrueAnswer: item3.IsAnswer }"> <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 === 'multiple'">
<view class="chooseNum" :class="{ isTrueAnswer: item3.IsAnswer }">
{{ item3.Name }} {{ item3.Name }}
</view> </view>
<view class="chooseName" :class="{ isTrueAnswer: item3.IsAnswer }" <view class="chooseName" :class="{ isTrueAnswer: item3.IsAnswer }"
v-html="item3.Content"></view> v-html="item3.Content"></view>
</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>
<view class="AnswerContent"> <view class="AnswerContent">
<view> <view>
<text style="color: #8c8a94">正确答案:</text> <text style="color: #8c8a94">正确答案:</text>
<text <text
class="isTrueAnswer">{{item1.QuestionAnswerList[index2].SubAnswer}}</text> class="isTrueAnswer">{{item1.QuestionAnswerList[index2]}}</text>
<text>您的答案: <text>您的答案:
<template v-if="item1.AnswerList[index2].SubAnswer!=''"> <template v-if="item1.StundetAnswer.length>0">
<text <text
v-if="item1.QuestionAnswerList[index2].SubAnswer == item1.AnswerList[index2].SubAnswer" v-if="item1.QuestionAnswerList[index2] == item1.StundetAnswer[index2]"
class="isTrueAnswer"> class="isTrueAnswer">
{{ item1.AnswerList[index2].SubAnswer }} {{ item1.StundetAnswer[index2] }},回答正确
</text> </text>
<text v-else <text v-else
class="isNotAnswer">{{item1.AnswerList[index2].SubAnswer}},回答错误</text> class="isNotAnswer">{{item1.StundetAnswer[index2]}},回答错误</text>
</template> </template>
<template v-else> <template v-else>
<text class="isNotAnswer">未作答</text> <text class="isNotAnswer">未作答</text>
</template> </template>
</text> </text>
</view> </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> </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"> 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 style="color: #000" v-html="item1.AnswerParse"></view>
</view> </view>
</view> </view>
...@@ -157,13 +97,12 @@ ...@@ -157,13 +97,12 @@
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="AnswerBtn clear"> </view>
<view class="AnswerBtnFirst" @click="getBeforeExam()" v-if="ExamIndex!=1||sortIndex!=1">上一题 <view class="AnswerBtn clear">
</view> <view class="AnswerBtnFirst" @click="getBeforeExam()" v-if="current>1">上一题
<view class="AnswerBtnSecond" v-if="ExamIndex != data.length" @click="getNextExam()">下一题</view>
</view> </view>
<view class="AnswerBtnSecond" :class="{'isCanNext':!isCanNext}" v-if="current!=dataList.length" @click="getNextExam()">下一题</view>
</view> </view>
<van-toast id="van-toast" />
</view> </view>
</template> </template>
...@@ -179,138 +118,111 @@ ...@@ -179,138 +118,111 @@
onMounted, onMounted,
} from "vue"; } from "vue";
import { import {
changeNumToHan SetStudentPractice
} from "../../utils/index"; } from "../../api/exam";
export default { export default {
props: { props: {
paperData: Array, paperData: Array,
sort: Number, Count: Number
isLast: Boolean,
startIndex: Number,
isOperate: Boolean,
ExamStatus: Number
}, },
setup(props, context) { setup(props, context) {
let { let {
ctx ctx
} = getCurrentInstance(); } = getCurrentInstance();
let data = reactive({ let data = reactive({
autoplay: false, dataList: props.paperData,
sortIndex: props.sort+1, current: 0, //默认从第几个开始-用于从快捷菜单点入
data: props.paperData,
Score: 0, //总分
current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题
questionH: 500, //问题区域高度
timer: null,
timeOutEvent: false,
statusBarHeight: 0, statusBarHeight: 0,
isOperate: props.isOperate, isCanNext:false //判断是否能点击下一题
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);
}
}); });
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 = { let methods = {
changeNumToHan,
jumpPage() { jumpPage() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/exam/examPaper", url: "/pages/exam/examPaper",
}); });
}, },
back() { goBack() {
uni.navigateBack(); uni.navigateBack();
}, },
getErrorAnswer(item1,index,name){
if (item1.StundetAnswer[index] ==name) {
return true
}else{
return false
}
},
//----------------------------------------选题---------------------------------- //----------------------------------------选题----------------------------------
// 单选or判断 // 单选or判断
singerChange(item2, item3) { singerChange(item1,index,item3) {
item2.SubAnwser.map((e) => { item1.StundetAnswer[index] = item3.Name;
if (e.Name == item3.Name) { //判断题数已经全做
e.IsAnswer = true; if(item1.StundetAnswer.length==item1.QuestionContentObj.length){
item2.IsRes = true; //答题标记 data.isCanNext=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;
} }
}, },
AnswerChange(item) { onchange(e) {
item.IsRes = item.SubAnwser.some((e) => { data.current = e.detail.current;
console.log(217, e.Content && e.Content != ""); if(data.current+1==data.dataList.length){
return e.Content && e.Content != ""; this.$emit('getAfter');
});
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;
} }
}, },
touchend() {
data.timeOutEvent = false;
clearTimeout(data.timer);
},
//点击上一题 //点击上一题
getBeforeExam() { getBeforeExam() {
data.current = data.current - 1; data.current = data.current - 1;
}, },
//点击下一题 //点击下一题
getNextExam() { 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(() => { onMounted(() => {
console.log(361, data.data); data.dataList.forEach(x => {
data.data.forEach(x => {
x.Title = x.Title.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ') 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; data.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
}); });
let that = methods; let that = methods;
...@@ -489,6 +401,7 @@ ...@@ -489,6 +401,7 @@
font-family: PingFang SC; font-family: PingFang SC;
font-weight: bold; font-weight: bold;
color: #111111; color: #111111;
flex-shrink: 0;
} }
.chooseName { .chooseName {
...@@ -523,4 +436,17 @@ ...@@ -523,4 +436,17 @@
color: #999999; color: #999999;
font-size: 28rpx; font-size: 28rpx;
} }
.Exam_Current {
font-size: 35rpx;
color: red;
}
.Exam_Count {
color: gray;
font-size: 26rpx;
}
.isCanNext{
background-color: gray!important;
}
</style> </style>
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
</view> </view>
</view> </view>
<view class="Ques_CirContent"> <view class="Ques_CirContent" v-if="TypeObj.wordsFinishCount">
<view class="Ques_Circle" @click="goExam(1)"> <view class="Ques_Circle" @click="goExam(1)">
<view class="Ques_Top">单词</view> <view class="Ques_Top">单词</view>
<view class="Ques_Num" v-if="TypeObj">{{TypeObj.wordsFinishCount}}/{{TypeObj.wordsTotalCount}}</view> <view class="Ques_Num" v-if="TypeObj">{{TypeObj.wordsFinishCount}}/{{TypeObj.wordsTotalCount}}</view>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<!-- 单词 --> <!-- 单词 -->
<word :paperData="dataList" v-if="Type==1" :Count="Count" @getAfter="getAfter()" /> <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> </view>
<van-toast id="van-toast" /> <van-toast id="van-toast" />
</view> </view>
...@@ -85,16 +85,20 @@ export default { ...@@ -85,16 +85,20 @@ export default {
if (res.Code == 1) { if (res.Code == 1) {
console.log(res,'数据'); console.log(res,'数据');
this.dataList = res.Data.PageData; this.dataList = res.Data.PageData;
this.Count = res.Data.Count;
} }
} }
}); });
}, },
//往后追加题 //往后追加题
getAfter(){ getAfter(){
data.examMsg.PageIndex++;
if(data.Type==1){ if(data.Type==1){
data.examMsg.PageIndex++;
this.GetWords(); this.GetWords();
} }
if(data.Type==4){
this.GetMyQuestionReading();
}
}, },
//获取答案改变后的数据 //获取答案改变后的数据
getAnswerChange(val, index) { 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