Commit 0c7fc8ef authored by zhengke's avatar zhengke

修改

parent 856df887
...@@ -108,3 +108,15 @@ export function GetQuestionWords(data) { ...@@ -108,3 +108,15 @@ export function GetQuestionWords(data) {
data data
}) })
} }
/**
* 点击答案提交答题
* @param {JSON参数} data
*/
export function SetStudentPractice(data) {
return request({
url: '/Exam/SetStudentPractice',
method: 'post',
data
})
}
\ No newline at end of file
...@@ -10,81 +10,52 @@ ...@@ -10,81 +10,52 @@
{{current+1}}/{{dataList.length}} {{current+1}}/{{dataList.length}}
</template> </template>
</van-nav-bar> </van-nav-bar>
<swiper <swiper class="swiper-box" :style="{
class="swiper-box"
:style="{
height: `calc(100vh - 300rpx - ${statusBarHeight}px)`, height: `calc(100vh - 300rpx - ${statusBarHeight}px)`,
}" }" :autoplay="autoplay" :current="current" @change="onchange" :skip-hidden-item-layout="true"
:autoplay="autoplay" :disable-programmatic-animation="true">
:current="current"
@change="onchange"
:skip-hidden-item-layout="true"
:disable-programmatic-animation="true"
>
<swiper-item v-for="(item1, index1) in dataList" :key="index1"> <swiper-item v-for="(item1, index1) in dataList" :key="index1">
<view class="item1" :style="{height: `calc(100vh - 390rpx - ${statusBarHeight}px)`}"> <view class="item1" :style="{height: `calc(100vh - 390rpx - ${statusBarHeight}px)`}">
<view class="flex flex_start_center"> <view class="flex flex_start_center">
<view class="num" v-html="item1.Title"></view> <view class="num" v-html="item1.Title"></view>
</view> </view>
<view <view v-for="(item2, index2) in item1.QuestionContentObj" :key="index2"
v-for="(item2, index2) in item1.QuestionContentObj" class="flex item2 flex_start_center">
:key="index2" <template v-if="item1.StundetAnswer==''">
class="flex item2 flex_start_center" <view class="chooseNum" @click="change(item1, item2)">{{ item2.ShowName }}
>
<template v-if="isOperate">
<view
class="chooseNum"
:class="{ myAnswer: item2.IsAnswer }"
@click="change(item1, item2)"
>{{ item2.ShowName }}
</view> </view>
<view <view class="chooseName" @click="change(item1, item2)" v-html="item2.Content"></view>
class="chooseName"
@click="change(item1, item2)"
v-html="item2.Content"
></view>
</template> </template>
<template v-else> <template v-else>
<view <view class="chooseNum"
class="chooseNum" :class="{ 'isTrueAnswer': item2.IsAnswer,'isNotAnswer':getErrorAnswer(item1,item2.Name) }">
:class="{ isTrueAnswer: item2.IsAnswer }" {{ item2.Name }}
>{{ item2.Name }}
</view> </view>
<view <view class="chooseName"
class="chooseName" :class="{ 'isTrueAnswer': item2.IsAnswer,'isNotAnswer':getErrorAnswer(item1,item2.Name) }"
:class="{ isTrueAnswer: item2.IsAnswer }" v-html="item2.Content">
v-html="item2.Content"
>
</view> </view>
</template> </template>
</view> </view>
<view class="AnswerContent" v-if="!isOperate"> <view class="AnswerContent" v-if="item1.StundetAnswer!=''">
<view> <view>
<text style="color: #8c8a94">正确答案:</text> <text style="color: #8c8a94">正确答案:</text>
<text class="isTrueAnswer">{{ item1.Answer }}</text <text class="isTrueAnswer">{{ item1.QuestionAnswerList[0] }}</text>
> <text>您的答案是:
<text
>您的答案是:
<template v-if="item1.StundetAnswer != ''"> <template v-if="item1.StundetAnswer != ''">
<text <text v-if="item1.StundetAnswer == item1.QuestionAnswerList[0]"
v-if="item1.Answer == item1.StundetAnswer" class="isTrueAnswer">
class="isTrueAnswer"
>
{{ item1.StundetAnswer }},回答正确 {{ item1.StundetAnswer }},回答正确
</text> </text>
<text v-else class="isNotAnswer" <text v-else class="isNotAnswer">{{ item1.StundetAnswer }},回答错误</text>
>{{ item1.StundetAnswer }},回答错误</text
>
</template> </template>
<template v-else> <template v-else>
<text>未作答</text> <text>未作答</text>
</template> </template>
</text> </text>
</view> </view>
<view <view style="margin-top: 20rpx; word-wrap: break-word" v-if="item1.AnswerParse"
style="margin-top: 20rpx; word-wrap: break-word" class="flex">
v-if="item1.AnswerParse" class="flex"
>
<text style="color: #8c8a94;flex-shrink: 0;">解析:</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>
...@@ -98,7 +69,7 @@ ...@@ -98,7 +69,7 @@
</template> </template>
<script> <script>
import { import {
ref, ref,
reactive, reactive,
toRefs, toRefs,
...@@ -107,25 +78,34 @@ import { ...@@ -107,25 +78,34 @@ import {
watch, watch,
computed, computed,
onMounted, onMounted,
} from "vue"; } from "vue";
export default { import {
SetStudentPractice
} from "../../api/exam";
export default {
props: { props: {
paperData: Array paperData: Array
}, },
setup(props, context) { setup(props, context) {
let { ctx } = getCurrentInstance(); let {
ctx
} = getCurrentInstance();
let data = reactive({ let data = reactive({
autoplay: false, autoplay: false,
dataList: [], dataList: [],
current: 0, //默认从第几个开始-用于从快捷菜单点入 current: 0, //默认从第几个开始-用于从快捷菜单点入
isOperate: true, isOperate: false,
statusBarHeight: 0 statusBarHeight: 0
}); });
let UserInfo = uni.getStorageSync('userInfo');
watch(()=>[...props.paperData],(val)=>{ watch(() => [...props.paperData], (val) => {
data.dataList=val val.forEach(x => {
x.StundetAnswer = '';
})
data.dataList = [...data.dataList, ...val];
console.log(data.dataList, 'datalist');
}) })
console.log(data,'dataList');
let methods = { let methods = {
goBack() { goBack() {
uni.navigateBack(); uni.navigateBack();
...@@ -133,19 +113,54 @@ export default { ...@@ -133,19 +113,54 @@ export default {
onchange(e) { onchange(e) {
data.current = e.detail.current; data.current = e.detail.current;
}, },
jumpAnswerSheet() { //点击选择答案
uni.navigateTo({ change(item1, item2) {
url: "/pages/exam/answerSheet", item1.StundetAnswer = item2.Name;
if (item1.QuestionAnswerList && item1.QuestionAnswerList.length > 0) {
if (item1.StundetAnswer == item1.QuestionAnswerList[0]) {
data.current += 1;
}
}
let msg = {
Id: 0,
StudentId: UserInfo.AccountId,
Category: item1.Category,
QuestionId: item1.QuestionId,
Title: item1.Title,
QuestionContent: item1.QuestionContentObj,
QuestionTypeId: item1.QuestionTypeId,
QuestionTypeKey: item1.QuestionTypeKey,
Answer: item1.StundetAnswer,
AnswerParse: item1.AnswerParse,
IsAnswer: 0,
IsWrong: 0
}
if(item1.StundetAnswer){
msg.IsAnswer=1;
}else{
msg.IsAnswer=0;
}
if(item1.StundetAnswer==item1.QuestionAnswerList[0]){
msg.IsWrong=0;
}else{
msg.IsWrong=1;
}
let res = SetStudentPractice(msg).then(res => {
if (res) {
if (res.Code == 1) {
}
}
}); });
}, },
// //点击上一题 //判断是否为正确答案
// getBeforeExam(){ getErrorAnswer(item1, Number) {
// data.current = data.current-1; if (item1.StundetAnswer != item1.QuestionAnswerList[0]) {
// }, if (item1.StundetAnswer == Number) {
// //点击下一题 return true
// getNextExam(){ }
// data.current = data.current+1; }
// } }
}; };
onMounted(() => { onMounted(() => {
data.statusBarHeight = uni.getSystemInfoSync().statusBarHeight; data.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
...@@ -156,37 +171,42 @@ export default { ...@@ -156,37 +171,42 @@ export default {
...methods, ...methods,
}; };
}, },
async onLoad(options) { async onLoad(options) {}
} };
};
</script> </script>
<style scoped> <style scoped>
.AnswerBtn{ .AnswerBtn {
margin-top: 20rpx; margin-top: 20rpx;
padding:0 20px; padding: 0 20px;
} }
.clear{ clear:both}
.AnswerBtnFirst{ .clear {
width:250rpx; clear: both
height:60rpx; }
.AnswerBtnFirst {
width: 250rpx;
height: 60rpx;
text-align: center; text-align: center;
line-height: 60rpx; line-height: 60rpx;
border-radius: 10rpx; border-radius: 10rpx;
border:1px solid #00ACF9; border: 1px solid #00ACF9;
color:#00ACF9; color: #00ACF9;
float:left; float: left;
} }
.AnswerBtnSecond{
width:250rpx; .AnswerBtnSecond {
height:60rpx; width: 250rpx;
height: 60rpx;
text-align: center; text-align: center;
line-height: 60rpx; line-height: 60rpx;
border-radius: 10rpx; border-radius: 10rpx;
background-color: #00ACF9; background-color: #00ACF9;
color:#fff; color: #fff;
float:right; float: right;
} }
.name {
.name {
height: 90rpx; height: 90rpx;
font-size: 30rpx; font-size: 30rpx;
font-family: PingFang SC; font-family: PingFang SC;
...@@ -195,75 +215,75 @@ export default { ...@@ -195,75 +215,75 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.isTrueAnswer { .isTrueAnswer {
color: green !important; color: green !important;
} }
.isNotAnswer { .isNotAnswer {
color: red !important; color: red !important;
} }
.AnswerContent { .AnswerContent {
font-size: 28rpx; font-size: 28rpx;
padding: 25rpx; padding: 25rpx;
background-color: #f4f4f4; background-color: #f4f4f4;
border-radius: 5px; border-radius: 5px;
} }
.Single_Before { .Single_Before {
font-size: 30rpx; font-size: 30rpx;
font-weight: bold; font-weight: bold;
color: #da7878; color: #da7878;
} }
.ExamIndex_Box { .ExamIndex_Box {
margin-right: 40rpx; margin-right: 40rpx;
} }
.Exam_Total { .Exam_Total {
font-size: 25rpx; font-size: 25rpx;
color: gray; color: gray;
} }
.answerSheet { .answerSheet {
font-size: 30rpx; font-size: 30rpx;
margin-left: 20rpx; margin-left: 20rpx;
color: #000; color: #000;
} }
.swiper-box { .swiper-box {
box-sizing: border-box; box-sizing: border-box;
} }
.num { .num {
font-size: 30rpx; font-size: 30rpx;
font-family: PingFang SC; font-family: PingFang SC;
color: #111111; color: #111111;
} }
.item { .item {
/* margin-bottom: 40rpx; */ /* margin-bottom: 40rpx; */
position: relative; position: relative;
} }
.item1 { .item1 {
/* margin: 25rpx 0; */ /* margin: 25rpx 0; */
align-items: center; align-items: center;
} }
.item2 { .item2 {
padding-left: 25rpx; padding-left: 25rpx;
margin: 30rpx 0; margin: 30rpx 0;
} }
.myAnswer { .myAnswer {
background-color: #00acf9 !important; background-color: #00acf9 !important;
color: #ffffff !important; color: #ffffff !important;
} }
.chooseNum { .chooseNum {
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
text-align: center; text-align: center;
...@@ -275,13 +295,12 @@ export default { ...@@ -275,13 +295,12 @@ export default {
font-family: PingFang SC; font-family: PingFang SC;
font-weight: bold; font-weight: bold;
color: #111111; color: #111111;
} }
.chooseName { .chooseName {
font-size: 30rpx; font-size: 30rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #111111; color: #111111;
} }
</style> </style>
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
<view class="Ques_Num">{{TypeObj.listeningFinishCount}}/{{TypeObj.listeningTotalCount}}</view> <view class="Ques_Num">{{TypeObj.listeningFinishCount}}/{{TypeObj.listeningTotalCount}}</view>
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/word3.png" alt="" /> <img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/word3.png" alt="" />
</view> </view>
<view class="Ques_Circle" style="margin-right:0;" @click="goExam()"> <view class="Ques_Circle" style="margin-right:0;" @click="goExam(4)">
<view class="Ques_Top">阅读</view> <view class="Ques_Top">阅读</view>
<view class="Ques_Num">{{TypeObj.readingFinishCount}}/{{TypeObj.readingTotalCount}}</view> <view class="Ques_Num">{{TypeObj.readingFinishCount}}/{{TypeObj.readingTotalCount}}</view>
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/word4.png" alt="" /> <img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/word4.png" alt="" />
......
...@@ -9,19 +9,10 @@ ...@@ -9,19 +9,10 @@
</template> </template>
</van-nav-bar> </van-nav-bar>
<view class="exam-con"> <view class="exam-con">
<!-- <view v-for="(item, index) in dataList" :key="index">
<readingCompre
:startIndex="item.startIndex"
:paperData="dataList"
:sort="index"
:isOperate="isOperate"
:ExamStatus="ExamStatus"
@answerChange="getAnswerChange($event, index)"
v-if="item.QuestionTypeKey === 'reading-comprehensio' && index === changeIndex"
/>
</view> -->
<!-- 单词 --> <!-- 单词 -->
<word v-if="Type==1" :paperData="dataList" /> <word :paperData="dataList" v-if="Type==1" />
<!-- 阅读理解 -->
<readingCompre :paperData="dataList" v-if="Type==4"/>
</view> </view>
<van-toast id="van-toast" /> <van-toast id="van-toast" />
</view> </view>
...@@ -54,11 +45,6 @@ export default { ...@@ -54,11 +45,6 @@ export default {
console.log(refs); console.log(refs);
let data = reactive({ let data = reactive({
statusBarHeight: 0, statusBarHeight: 0,
msg: {
pageIndex: 1,
pageSize: 10 
},
dataList: [], dataList: [],
changeIndex: 0, //大题序号 changeIndex: 0, //大题序号
isOperate: true, //考试状态 判断是考试还是查看答案 isOperate: true, //考试状态 判断是考试还是查看答案
...@@ -87,19 +73,19 @@ export default { ...@@ -87,19 +73,19 @@ export default {
if (res.Code == 1) { if (res.Code == 1) {
this.dataList = res.Data.PageData; this.dataList = res.Data.PageData;
console.log(data.dataList,'数据'); console.log(data.dataList,'数据');
} }
} }
}); });
}, },
async GetMyQuestionReading() { GetMyQuestionReading() {
let res = await GetQuestionReading(data.msg); let res = GetQuestionReading(data.examMsg).then(res=>{
if (res) { if (res) {
if (res.Code == 1) { if (res.Code == 1) {
console.log(res,'数据'); console.log(res,'数据');
this.dataList = res.Data.PageData; this.dataList = res.Data.PageData;
} }
} }
});
}, },
//获取答案改变后的数据 //获取答案改变后的数据
getAnswerChange(val, index) { getAnswerChange(val, index) {
...@@ -130,7 +116,9 @@ export default { ...@@ -130,7 +116,9 @@ export default {
if(this.Type==1){ if(this.Type==1){
this.GetWords(); this.GetWords();
} }
// await this.GetMyQuestionReading(); if(this.Type==4){
this.GetMyQuestionReading();
}
}, },
}; };
</script> </script>
......
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