Commit 0c7fc8ef authored by zhengke's avatar zhengke

修改

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