Commit 0c7fc8ef authored by zhengke's avatar zhengke

修改

parent 856df887
...@@ -107,4 +107,16 @@ export function GetQuestionWords(data) { ...@@ -107,4 +107,16 @@ export function GetQuestionWords(data) {
method: 'post', method: 'post',
data data
}) })
}
/**
* 点击答案提交答题
* @param {JSON参数} data
*/
export function SetStudentPractice(data) {
return request({
url: '/Exam/SetStudentPractice',
method: 'post',
data
})
} }
\ No newline at end of file
<template> <template>
<!-- 单选题 --> <!-- 单选题 -->
<view> <view>
<view class="item" style="padding: 0 20px"> <view class="item" style="padding: 0 20px">
<van-nav-bar fixed> <van-nav-bar fixed>
<template #left> <template #left>
<van-icon name="cross" size="32rpx" @click="goBack()" /> <van-icon name="cross" size="32rpx" @click="goBack()" />
</template> </template>
<template #title> <template #title>
{{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" <swiper-item v-for="(item1, index1) in dataList" :key="index1">
@change="onchange" <view class="item1" :style="{height: `calc(100vh - 390rpx - ${statusBarHeight}px)`}">
:skip-hidden-item-layout="true" <view class="flex flex_start_center">
:disable-programmatic-animation="true" <view class="num" v-html="item1.Title"></view>
> </view>
<swiper-item v-for="(item1, index1) in dataList" :key="index1"> <view v-for="(item2, index2) in item1.QuestionContentObj" :key="index2"
<view class="item1" :style="{height: `calc(100vh - 390rpx - ${statusBarHeight}px)`}"> class="flex item2 flex_start_center">
<view class="flex flex_start_center"> <template v-if="item1.StundetAnswer==''">
<view class="num" v-html="item1.Title"></view> <view class="chooseNum" @click="change(item1, item2)">{{ item2.ShowName }}
</view> </view>
<view <view class="chooseName" @click="change(item1, item2)" v-html="item2.Content"></view>
v-for="(item2, index2) in item1.QuestionContentObj" </template>
:key="index2" <template v-else>
class="flex item2 flex_start_center" <view class="chooseNum"
> :class="{ 'isTrueAnswer': item2.IsAnswer,'isNotAnswer':getErrorAnswer(item1,item2.Name) }">
<template v-if="isOperate"> {{ item2.Name }}
<view </view>
class="chooseNum" <view class="chooseName"
:class="{ myAnswer: item2.IsAnswer }" :class="{ 'isTrueAnswer': item2.IsAnswer,'isNotAnswer':getErrorAnswer(item1,item2.Name) }"
@click="change(item1, item2)" v-html="item2.Content">
>{{ item2.ShowName }} </view>
</view> </template>
<view </view>
class="chooseName" <view class="AnswerContent" v-if="item1.StundetAnswer!=''">
@click="change(item1, item2)" <view>
v-html="item2.Content" <text style="color: #8c8a94">正确答案:</text>
></view> <text class="isTrueAnswer">{{ item1.QuestionAnswerList[0] }}</text>
</template> <text>您的答案是:
<template v-else> <template v-if="item1.StundetAnswer != ''">
<view <text v-if="item1.StundetAnswer == item1.QuestionAnswerList[0]"
class="chooseNum" class="isTrueAnswer">
:class="{ isTrueAnswer: item2.IsAnswer }" {{ item1.StundetAnswer }},回答正确
>{{ item2.Name }} </text>
</view> <text v-else class="isNotAnswer">{{ item1.StundetAnswer }},回答错误</text>
<view </template>
class="chooseName" <template v-else>
:class="{ isTrueAnswer: item2.IsAnswer }" <text>未作答</text>
v-html="item2.Content" </template>
> </text>
</view> </view>
</template> <view style="margin-top: 20rpx; word-wrap: break-word" v-if="item1.AnswerParse"
</view> class="flex">
<view class="AnswerContent" v-if="!isOperate"> <text style="color: #8c8a94;flex-shrink: 0;">解析:</text>
<view> <view style="color: #000" v-html="item1.AnswerParse"></view>
<text style="color: #8c8a94">正确答案:</text> </view>
<text class="isTrueAnswer">{{ item1.Answer }}</text </view>
> </view>
<text </swiper-item>
>您的答案是: </swiper>
<template v-if="item1.StundetAnswer != ''"> </view>
<text <van-toast id="van-toast" />
v-if="item1.Answer == item1.StundetAnswer" </view>
class="isTrueAnswer"
>
{{ item1.StundetAnswer }},回答正确
</text>
<text v-else class="isNotAnswer"
>{{ item1.StundetAnswer }},回答错误</text
>
</template>
<template v-else>
<text>未作答</text>
</template>
</text>
</view>
<view
style="margin-top: 20rpx; word-wrap: break-word"
v-if="item1.AnswerParse" class="flex"
>
<text style="color: #8c8a94;flex-shrink: 0;">解析:</text>
<view style="color: #000" v-html="item1.AnswerParse"></view>
</view>
</view>
</view>
</swiper-item>
</swiper>
</view>
<van-toast id="van-toast" />
</view>
</template> </template>
<script> <script>
import { import {
ref, ref,
reactive, reactive,
toRefs, toRefs,
toRef, toRef,
getCurrentInstance, getCurrentInstance,
watch, watch,
computed, computed,
onMounted, onMounted,
} from "vue"; } from "vue";
export default { import {
props: { SetStudentPractice
paperData: Array } from "../../api/exam";
}, export default {
setup(props, context) { props: {
let { ctx } = getCurrentInstance(); paperData: Array
let data = reactive({ },
autoplay: false, setup(props, context) {
dataList: [], let {
current: 0, //默认从第几个开始-用于从快捷菜单点入 ctx
isOperate: true, } = getCurrentInstance();
statusBarHeight: 0 let data = reactive({
}); autoplay: false,
dataList: [],
watch(()=>[...props.paperData],(val)=>{ current: 0, //默认从第几个开始-用于从快捷菜单点入
data.dataList=val isOperate: false,
}) statusBarHeight: 0
console.log(data,'dataList'); });
let methods = { let UserInfo = uni.getStorageSync('userInfo');
goBack() {
uni.navigateBack(); watch(() => [...props.paperData], (val) => {
}, val.forEach(x => {
onchange(e) { x.StundetAnswer = '';
data.current = e.detail.current; })
}, data.dataList = [...data.dataList, ...val];
jumpAnswerSheet() { console.log(data.dataList, 'datalist');
uni.navigateTo({ })
url: "/pages/exam/answerSheet", let methods = {
}); goBack() {
}, uni.navigateBack();
// //点击上一题 },
// getBeforeExam(){ onchange(e) {
// data.current = data.current-1; data.current = e.detail.current;
// }, },
// //点击下一题 //点击选择答案
// getNextExam(){ change(item1, item2) {
// data.current = data.current+1; item1.StundetAnswer = item2.Name;
// } if (item1.QuestionAnswerList && item1.QuestionAnswerList.length > 0) {
}; if (item1.StundetAnswer == item1.QuestionAnswerList[0]) {
onMounted(() => { data.current += 1;
data.statusBarHeight = uni.getSystemInfoSync().statusBarHeight; }
}); }
let that = methods; let msg = {
return { Id: 0,
...toRefs(data), StudentId: UserInfo.AccountId,
...methods, Category: item1.Category,
}; QuestionId: item1.QuestionId,
}, Title: item1.Title,
async onLoad(options) { 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) {
}
}
});
},
//判断是否为正确答案
getErrorAnswer(item1, Number) {
if (item1.StundetAnswer != item1.QuestionAnswerList[0]) {
if (item1.StundetAnswer == Number) {
return true
}
}
}
};
onMounted(() => {
data.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
});
let that = methods;
return {
...toRefs(data),
...methods,
};
},
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; }
text-align: center;
line-height: 60rpx; .AnswerBtnFirst {
border-radius: 10rpx; width: 250rpx;
border:1px solid #00ACF9; height: 60rpx;
color:#00ACF9; text-align: center;
float:left; line-height: 60rpx;
} border-radius: 10rpx;
.AnswerBtnSecond{ border: 1px solid #00ACF9;
width:250rpx; color: #00ACF9;
height:60rpx; float: left;
text-align: center; }
line-height: 60rpx;
border-radius: 10rpx; .AnswerBtnSecond {
background-color: #00ACF9; width: 250rpx;
color:#fff; height: 60rpx;
float:right; text-align: center;
} line-height: 60rpx;
.name { border-radius: 10rpx;
height: 90rpx; background-color: #00ACF9;
font-size: 30rpx; color: #fff;
font-family: PingFang SC; float: right;
font-weight: 800; }
color: #111111;
display: flex;
align-items: center;
justify-content: space-between;
}
.isTrueAnswer { .name {
color: green !important; height: 90rpx;
} font-size: 30rpx;
font-family: PingFang SC;
font-weight: 800;
color: #111111;
display: flex;
align-items: center;
justify-content: space-between;
}
.isNotAnswer { .isTrueAnswer {
color: red !important; color: green !important;
} }
.AnswerContent { .isNotAnswer {
font-size: 28rpx; color: red !important;
padding: 25rpx; }
background-color: #f4f4f4;
border-radius: 5px;
}
.Single_Before { .AnswerContent {
font-size: 30rpx; font-size: 28rpx;
font-weight: bold; padding: 25rpx;
color: #da7878; background-color: #f4f4f4;
} border-radius: 5px;
}
.ExamIndex_Box { .Single_Before {
margin-right: 40rpx; font-size: 30rpx;
} font-weight: bold;
color: #da7878;
}
.Exam_Total { .ExamIndex_Box {
font-size: 25rpx; margin-right: 40rpx;
color: gray; }
}
.answerSheet { .Exam_Total {
font-size: 30rpx; font-size: 25rpx;
margin-left: 20rpx; color: gray;
color: #000; }
}
.swiper-box { .answerSheet {
box-sizing: border-box; font-size: 30rpx;
} margin-left: 20rpx;
color: #000;
}
.num { .swiper-box {
font-size: 30rpx; box-sizing: border-box;
font-family: PingFang SC; }
color: #111111;
}
.item { .num {
/* margin-bottom: 40rpx; */ font-size: 30rpx;
position: relative; font-family: PingFang SC;
} color: #111111;
}
.item1 { .item {
/* margin: 25rpx 0; */ /* margin-bottom: 40rpx; */
align-items: center; position: relative;
} }
.item2 { .item1 {
padding-left: 25rpx; /* margin: 25rpx 0; */
margin: 30rpx 0; align-items: center;
} }
.myAnswer { .item2 {
background-color: #00acf9 !important; padding-left: 25rpx;
color: #ffffff !important; margin: 30rpx 0;
} }
.chooseNum { .myAnswer {
width: 50rpx; background-color: #00acf9 !important;
height: 50rpx; color: #ffffff !important;
text-align: center; }
line-height: 50rpx;
border-radius: 50%;
border: 1px solid #e2e2e2;
margin-right: 30rpx;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: bold;
color: #111111;
}
.chooseName { .chooseNum {
font-size: 30rpx; width: 50rpx;
font-family: PingFang SC; height: 50rpx;
font-weight: 500; text-align: center;
color: #111111; line-height: 50rpx;
} border-radius: 50%;
border: 1px solid #e2e2e2;
margin-right: 30rpx;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: bold;
color: #111111;
}
.chooseName {
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
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, //考试状态 判断是考试还是查看答案
...@@ -86,20 +72,20 @@ export default { ...@@ -86,20 +72,20 @@ export default {
if (res) { if (res) {
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