Commit c1317f2b authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/xiangwei/educationstu into master

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