Commit 97a4fe5b authored by zhengke's avatar zhengke

修改

parent 8e314107
<template> <template>
<!-- 单选题 --> <!-- 单选题 -->
<view> <view>
<view class="item" style="padding: 0 20px"> <view class="item" style="padding: 0 20px">
<view class="name"> <view class="name">
<view class="grow"> <view class="grow">
{{ changeNumToHan(sortIndex) }}{{ data.GroupName }} {{ changeNumToHan(sortIndex) }}{{ data.GroupName }}
<text style="color: #999999" <text style="color: #999999">(共{{ data.DetailsList.length }}道,{{ data.GScore }}分)</text>
>(共{{ data.DetailsList.length }}道,{{ data.GScore }}分)</text </view>
> <view class="ExamIndex_Box">
</view> <text class="Single_Before">{{ ExamIndex }}</text>/<text
<view class="ExamIndex_Box"> class="Exam_Total">{{ data.DetailsList.length }}</text>
<text class="Single_Before">{{ ExamIndex }}</text </view>
>/<text class="Exam_Total">{{ data.DetailsList.length }}</text> <!-- <i
</view>
<!-- <i
class="iconfont icon-caidanzu answerSheet" class="iconfont icon-caidanzu answerSheet"
@click="jumpAnswerSheet" @click="jumpAnswerSheet"
></i> --> ></i> -->
</view> </view>
<swiper <swiper class="swiper-box" :autoplay="autoplay" :current="current" @change="onchange"
class="swiper-box" :skip-hidden-item-layout="true">
:autoplay="autoplay" <swiper-item>
:current="current" <!-- 第一页 -->
@change="onchange" </swiper-item>
:skip-hidden-item-layout="true" <swiper-item v-for="(item1, index1) in data.DetailsList" :key="index1">
> <view class="item1">
<swiper-item> <view class="flex flex_start_center">
<!-- 第一页 --> <view class="num" v-html="item1.Title"></view>
</swiper-item> </view>
<swiper-item v-for="(item1, index1) in data.DetailsList" :key="index1">
<view class="item1">
<view class="flex flex_start_center">
<view class="num" v-html="item1.Title"></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="isOperate">
class="flex item2 flex_start_center" <view class="chooseNum" :class="{ myAnswer: item2.IsAnswer }"
> @click="change(item1, item2)">{{ item2.ShowName }}
<view </view>
class="chooseNum" <view class="chooseName" @click="change(item1, item2)" v-html="item2.Content"></view>
:class="{ myAnswer: item2.IsAnswer }" </template>
@click="change(item1, item2)" <template v-else>
>{{ item2.ShowName }} <view class="chooseNum" :class="{isTrueAnswer:item2.IsAnswer}">{{ item2.Name }}</view>
</view> <view class="chooseName" :class="{isTrueAnswer:item2.IsAnswer}" v-html="item2.Content">
<view </view>
class="chooseName" </template>
@click="change(item1, item2)" </view>
v-html="item2.Content" </view>
></view> <view class="AnswerContent" v-if="!isOperate">
</view> <view>
</view> <text style="color:#8c8a94">正确答案:</text>
</swiper-item> <text style="color:green;">{{getTrueAnswer(item1.QuestionContentObj)}}</text>
<swiper-item v-if="sortIndex != sortTotal"> <text>您的答案:{{item1.StundetAnswer==''?'未作答':item1.StundetAnswer}}</text>
<!-- 最后一页 --> </view>
</swiper-item> <view style="margin-top:20rpx;word-wrap:break-word;">
</swiper> <text style="color:#8c8a94">解析:</text>
</view> <text>{{item1.AnswerParse}}</text>
<van-toast id="van-toast" /> </view>
</view> </view>
</swiper-item>
<swiper-item v-if="sortIndex != sortTotal">
<!-- 最后一页 -->
</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";
import { changeNumToHan } from "../../utils/index"; import {
export default { changeNumToHan
props: { } from "../../utils/index";
paperData: Object, export default {
sort: Number, props: {
sortTotal: Number, paperData: Object,
isLast: Boolean, sort: Number,
startIndex: Number, sortTotal: Number,
}, isLast: Boolean,
setup(props, context) { startIndex: Number,
let { ctx } = getCurrentInstance(); isOperate: Boolean
let data = reactive({ },
autoplay: false, setup(props, context) {
sortIndex: props.sort + 1, //大题序号 let {
sortTotal: props.sortTotal, //总共多少道大题 ctx
data: props.paperData, } = getCurrentInstance();
current: 1, //默认从第几个开始-用于从快捷菜单点入 let data = reactive({
ExamIndex: 1, //第几题 autoplay: false,
}); sortIndex: props.sort + 1, //大题序号
if (props.startIndex) { sortTotal: props.sortTotal, //总共多少道大题
data.current = props.startIndex; data: props.paperData,
data.ExamIndex = props.startIndex; current: 1, //默认从第几个开始-用于从快捷菜单点入
} ExamIndex: 1, //第几题
let methods = { isOperate: props.isOperate,
changeNumToHan, TrueAnswer:''
jumpPage() { });
uni.navigateTo({ if (props.startIndex) {
url: "/pages/exam/examPaper", data.current = props.startIndex;
}); data.ExamIndex = props.startIndex;
}, }
back() { let methods = {
uni.navigateBack(); changeNumToHan,
}, jumpPage() {
//选题 uni.navigateTo({
change(item1, item2) { url: "/pages/exam/examPaper",
context.emit("answerChange", data.data); });
item1.QuestionContentObj.map((e) => { },
if (e.Name == item2.Name) { back() {
e.IsAnswer = true; uni.navigateBack();
} else { },
e.IsAnswer = false; //选题
} change(item1, item2) {
if (e.IsAnswer) { context.emit("answerChange", data.data);
//标记已回答 item1.QuestionContentObj.map((e) => {
item1.IsRes = true; if (e.Name == item2.Name) {
} e.IsAnswer = true;
}); } else {
}, e.IsAnswer = false;
onchange(e) { }
// if (data.sortIndex == 1) { if (e.IsAnswer) {
data.ExamIndex = e.detail.current; //标记已回答
//} item1.IsRes = true;
if (data.ExamIndex === data.data.DetailsList.length + 1) { }
console.log("单选", e.detail); });
this.$emit("getAfterTopic"); },
} onchange(e) {
if (e.detail.current == 0 && data.sortIndex != 1) { // if (data.sortIndex == 1) {
this.$emit("getBeforeTopic"); data.ExamIndex = e.detail.current;
} //}
}, if (data.ExamIndex === data.data.DetailsList.length + 1) {
jumpAnswerSheet() { console.log("单选", e.detail);
uni.navigateTo({ this.$emit("getAfterTopic");
url: "/pages/exam/answerSheet", }
}); if (e.detail.current == 0 && data.sortIndex != 1) {
}, this.$emit("getBeforeTopic");
}; }
onMounted(() => { },
console.log("单选", data.data); jumpAnswerSheet() {
if (props.isLast) { uni.navigateTo({
data.current = props.paperData.DetailsList.length; url: "/pages/exam/answerSheet",
} });
}); },
let that = methods; //获取正确答案
return { getTrueAnswer(item){
...toRefs(data), let AnSwer='';
...methods, if(item&&item.length>0){
}; item.forEach(x=>{
}, if(x.IsAnswer){
}; AnSwer=x.Name;
}
})
}
return AnSwer;
}
};
onMounted(() => {
console.log("单选", data.data);
if (props.isLast) {
data.current = props.paperData.DetailsList.length;
}
});
let that = methods;
return {
...toRefs(data),
...methods,
};
},
};
</script> </script>
<style scoped> <style scoped>
.name { .name {
height: 90rpx; height: 90rpx;
font-size: 28rpx; font-size: 28rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 800; font-weight: 800;
color: #111111; color: #111111;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.Single_Before { .isTrueAnswer {
font-size: 28rpx; color: green !important;
font-weight: bold; }
color: #da7878;
}
.ExamIndex_Box {
margin-right: 20px;
}
.Exam_Total {
font-size: 25rpx;
color: gray;
}
.answerSheet { .isNotAnswer {
font-size: 30rpx; color: green !important;
margin-left: 20rpx; }
color: #000; .AnswerContent{
} font-size:30rpx;
padding:25rpx;
background-color: #F4F4F4;
border-radius: 5px;
}
.Single_Before {
font-size: 28rpx;
font-weight: bold;
color: #da7878;
}
.swiper-box { .ExamIndex_Box {
height: calc(100vh - 270rpx); margin-right: 20px;
box-sizing: border-box; }
}
.num { .Exam_Total {
font-size: 26rpx; font-size: 25rpx;
font-family: PingFang SC; color: gray;
font-weight: bold; }
color: #111111;
}
.item { .answerSheet {
/* margin-bottom: 40rpx; */ font-size: 30rpx;
position: relative; margin-left: 20rpx;
} color: #000;
}
.item1 { .swiper-box {
/* margin: 25rpx 0; */ height: calc(100vh - 270rpx);
align-items: center; box-sizing: border-box;
} }
.item2 { .num {
padding-left: 25rpx; font-size: 26rpx;
margin: 30rpx 0; font-family: PingFang SC;
} font-weight: bold;
color: #111111;
}
.myAnswer { .item {
background-color: #00acf9 !important; /* margin-bottom: 40rpx; */
color: #ffffff !important; position: relative;
} }
.chooseNum { .item1 {
width: 40rpx; /* margin: 25rpx 0; */
height: 40rpx; align-items: center;
text-align: center; }
line-height: 40rpx;
border-radius: 50%;
border: 1px solid #e2e2e2;
margin-right: 30rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: bold;
color: #111111;
}
.chooseName { .item2 {
font-size: 24rpx; padding-left: 25rpx;
font-family: PingFang SC; margin: 30rpx 0;
font-weight: 500; }
color: #111111;
} .myAnswer {
background-color: #00acf9 !important;
color: #ffffff !important;
}
.chooseNum {
width: 40rpx;
height: 40rpx;
text-align: center;
line-height: 40rpx;
border-radius: 50%;
border: 1px solid #e2e2e2;
margin-right: 30rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: bold;
color: #111111;
}
.chooseName {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 500;
color: #111111;
}
</style> </style>
...@@ -47,10 +47,7 @@ ...@@ -47,10 +47,7 @@
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length" :sortTotal="peaperDetail.Paper.GroupList.length"
:isLast="isLast" :isLast="isLast"
:ExamStatus="ExamStatus" v-if="item.QuestionTypeKey === 'single-number' && index === changeIndex"
v-if="
item.QuestionTypeKey === 'single-number' && index === changeIndex
"
/> />
<!-- 多选题 --> <!-- 多选题 -->
<MultipleChoice <MultipleChoice
...@@ -71,6 +68,7 @@ ...@@ -71,6 +68,7 @@
:isLast="isLast" :isLast="isLast"
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length" :sortTotal="peaperDetail.Paper.GroupList.length"
:isOperate="isOperate"
@getBeforeTopic="getBeforeTopic()" @getBeforeTopic="getBeforeTopic()"
@getAfterTopic="getAfterTopic()" @getAfterTopic="getAfterTopic()"
@answerChange="getAnswerChange($event, index)" @answerChange="getAnswerChange($event, index)"
...@@ -364,8 +362,8 @@ export default { ...@@ -364,8 +362,8 @@ export default {
let data = reactive({ let data = reactive({
time: 999, time: 999,
statusBarHeight: 0, statusBarHeight: 0,
msg: { GuestId: 0, PaperId: 0, PublishId: 0}, // msg: { GuestId: 0, PaperId: 0, PublishId: 0},
// msg: { GuestId: 20, PaperId: 9, PublishId: 1,isShowAnswer:true}, msg: { GuestId: 20, PaperId: 9, PublishId: 1 ,isShowAnswer: true},
peaperDetail: {}, peaperDetail: {},
changeIndex: 0, //大题序号 changeIndex: 0, //大题序号
...@@ -373,7 +371,7 @@ export default { ...@@ -373,7 +371,7 @@ export default {
isShowAnswer: false, //是否显示答题卡 isShowAnswer: false, //是否显示答题卡
Exam_Student_Id: 0, Exam_Student_Id: 0,
autoTimeStart: false, autoTimeStart: false,
ExamStatus:-1, //考试状态 判断是考试还是查看答案 isOperate:true, //考试状态 判断是考试还是查看答案
}); });
let methods = { let methods = {
changeNumToHan, changeNumToHan,
...@@ -446,20 +444,21 @@ export default { ...@@ -446,20 +444,21 @@ export default {
}, },
onLoad(options) { onLoad(options) {
console.log(options, "options"); console.log(options, "options");
if(options.GuestId){ // if(options.GuestId){
this.msg.GuestId = options.GuestId; // this.msg.GuestId = options.GuestId;
} // }
if (options.PaperId) { // if (options.PaperId) {
this.msg.PaperId = options.PaperId; // this.msg.PaperId = options.PaperId;
} // }
if (options.Id) { // if (options.Id) {
this.msg.PublishId = options.Id; // this.msg.PublishId = options.Id;
} // }
if (options.Exam_Student_Id) { if (options.Exam_Student_Id) {
this.Exam_Student_Id = options.Exam_Student_Id; this.Exam_Student_Id = options.Exam_Student_Id;
} }
if (options.ExamStatus){ if (options.ExamStatus&&options.ExamStatus==1){
this.ExamStatus = options.ExamStatus; this.isOperate = false;
this.msg.isShowAnswer=true;
} }
this.getPaperDetail(); this.getPaperDetail();
}, },
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
:style="{ 'background-image': `url(${item.PicList[0]})` }" :style="{ 'background-image': `url(${item.PicList[0]})` }"
@click=" @click="
jumpPage( jumpPage(
`/pages/exam/examPaper?GuestId=${indexData.GuestId}&&PaperId=${item.PaperId}&&Id=${item.Id}&&Exam_Student_Id=${item.Exam_Student_Id}&&ExamStatus=${item.ExamStatus}` `/pages/exam/examPaper?GuestId=${item.GuestId}&&PaperId=${item.PaperId}&&Id=${item.Id}&&Exam_Student_Id=${item.Exam_Student_Id}&&ExamStatus=${item.ExamStatus}`
) )
" "
> >
......
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