Commit 30a32cb2 authored by zhengke's avatar zhengke

修改

parent e86dddd6
<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> <view>
{{ 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>/
<view class="ExamIndex_Box"> <text class="Exam_Total">{{ data.DetailsList.length }}</text>
<text class="Single_Before">{{ ExamIndex }}</text </view>
>/ </view>
<text class="Exam_Total">{{ data.DetailsList.length }}</text> <swiper class="swiper-box" :autoplay="autoplay" :current="current" @change="onchange">
</view> <swiper-item></swiper-item>
</view> <swiper-item v-for="(item1, index1) in data.DetailsList" :key="index1">
<swiper <view class="item1">
class="swiper-box" <view class="flex flex_start_center">
:autoplay="autoplay" <view>{{ index1 + 1 }}</view>
:current="current" <view class="num" v-html="item1.Title"></view>
@change="onchange" </view>
> <view v-for="(item2, index2) in item1.QuestionContentObj" :key="index2"
<swiper-item></swiper-item> style="border-bottom: 1px solid #d1d1d1">
<swiper-item v-for="(item1, index1) in data.DetailsList" :key="index1"> <view v-for="(item3, index3) in item2.OptionList" :key="index3"
<view class="item1"> class="flex item2 flex_start_center" @click="getAnswer(item2.OptionList, item3, item1)">
<view class="flex flex_start_center"> <view class="chooseNum" :class="{ myAnswer: item3.IsAnswer }">{{ item3.Name }}
<view>{{ index1 + 1 }}</view> </view>
<view class="num" v-html="item1.Title"></view> <view class="chooseName" v-html="item3.Content"></view>
</view> </view>
<view </view>
v-for="(item2, index2) in item1.QuestionContentObj" </view>
:key="index2" </swiper-item>
style="border-bottom: 1px solid #d1d1d1" <swiper-item v-if="sortIndex != sortTotal"></swiper-item>
> </swiper>
<view </view>
v-for="(item3, index3) in item2.OptionList" <van-toast id="van-toast" />
:key="index3" </view>
class="flex item2 flex_start_center"
@click="getAnswer(item2.OptionList, item3, item1)"
>
<view class="chooseNum" :class="{ myAnswer: item3.IsAnswer }"
>{{ item3.Name }}
</view>
<view class="chooseName" v-html="item3.Content"></view>
</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({ },
data: props.paperData, setup(props, context) {
autoplay: false, let {
sortIndex: props.sort + 1, ctx
sortTotal: props.sortTotal, } = getCurrentInstance();
current: 1, //默认从第几个开始-用于从快捷菜单点入 let data = reactive({
ExamIndex: 1, //第几题 data: props.paperData,
}); autoplay: false,
if (props.startIndex) { sortIndex: props.sort + 1,
data.current = props.startIndex; sortTotal: props.sortTotal,
data.ExamIndex = props.startIndex; current: 1, //默认从第几个开始-用于从快捷菜单点入
} ExamIndex: 1, //第几题
let methods = { isOperate: props.isOperate
changeNumToHan, });
jumpPage() { if (props.startIndex) {
uni.navigateTo({ data.current = props.startIndex;
url: "/pages/exam/examPaper", data.ExamIndex = props.startIndex;
}); }
}, let methods = {
back() { changeNumToHan,
uni.navigateBack(); jumpPage() {
}, uni.navigateTo({
onchange(e) { url: "/pages/exam/examPaper",
data.ExamIndex = e.detail.current; });
if (data.ExamIndex === data.data.DetailsList.length + 1) { },
console.log("进入"); back() {
this.$emit("getAfterTopic"); uni.navigateBack();
} },
if (e.detail.current == 0) { onchange(e) {
this.$emit("getBeforeTopic"); data.ExamIndex = e.detail.current;
} if (data.ExamIndex === data.data.DetailsList.length + 1) {
}, console.log("进入");
//点击 this.$emit("getAfterTopic");
getAnswer(allItem, item , item1) { }
allItem.forEach((x) => { if (e.detail.current == 0) {
x.IsAnswer = false; this.$emit("getBeforeTopic");
}); }
item.IsAnswer = !item.IsAnswer; },
context.emit("answerChange", data.data); //点击
this.$forceUpdate(); getAnswer(allItem, item, item1) {
item1.QuestionContentObj.forEach(x=>{ allItem.forEach((x) => {
x.OptionList.forEach(y=>{ x.IsAnswer = false;
if(y.IsAnswer){ });
item1.IsRes=true; item.IsAnswer = !item.IsAnswer;
context.emit("answerChange", data.data);
this.$forceUpdate();
item1.QuestionContentObj.forEach(x => {
x.OptionList.forEach(y => {
if (y.IsAnswer) {
item1.IsRes = true;
}
})
})
},
};
onMounted(() => {
if (props.isLast) {
data.current = props.paperData.DetailsList.length;
} }
}) });
}) let that = methods;
}, return {
}; ...toRefs(data),
onMounted(() => { ...methods,
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;
} }
.ExamIndex_Box{
margin-right:20px;
}
.Exam_Total {
font-size: 25rpx;
color: gray;
}
.myAnswer {
background-color: #00acf9 !important;
color: #ffffff !important;
}
.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; .isTrueAnswer {
} color: green !important;
}
.isNotAnswer {
color: red !important;
}
.AnswerContent {
font-size: 30rpx;
padding: 25rpx;
background-color: #F4F4F4;
border-radius: 5px;
}
.viewAnswerContent {
width: 100%;
border-bottom: 1px solid #d1d1d1;
padding-bottom: 5px;
}
.myAnswer {
background-color: #00acf9 !important;
color: #ffffff !important;
}
.item { .Single_Before {
margin-bottom: 40rpx; font-size: 28rpx;
} font-weight: bold;
color: #da7878;
}
.item1 { .swiper-box {
align-items: center; height: calc(100vh - 270rpx);
} box-sizing: border-box;
}
.item2 { .num {
/* padding-left: 25rpx; */ font-size: 26rpx;
margin: 30rpx 0; font-family: PingFang SC;
} font-weight: bold;
color: #111111;
}
.choose { .item {
background-color: #00acf9 !important; margin-bottom: 40rpx;
color: #ffffff !important; }
}
.chooseNum { .item1 {
width: 40rpx; align-items: center;
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 { .item2 {
font-size: 24rpx; /* padding-left: 25rpx; */
font-family: PingFang SC; margin: 30rpx 0;
font-weight: 500; }
color: #111111;
}
.input { .choose {
box-sizing: border-box; background-color: #00acf9 !important;
width: 690rpx; color: #ffffff !important;
border-bottom: 2rpx solid #000; }
color: #000;
font-size: 22rpx;
}
.textarea { .chooseNum {
box-sizing: border-box; width: 40rpx;
padding: 20rpx 0; 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;
}
/deep/.textarea-placeholder { .chooseName {
font-size: 20rpx; font-size: 24rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #cccccc; color: #111111;
} }
.input {
box-sizing: border-box;
width: 690rpx;
border-bottom: 2rpx solid #000;
color: #000;
font-size: 22rpx;
}
.textarea {
box-sizing: border-box;
padding: 20rpx 0;
}
/deep/.textarea-placeholder {
font-size: 20rpx;
font-family: PingFang SC;
font-weight: 500;
color: #cccccc;
}
</style> </style>
...@@ -30,17 +30,19 @@ ...@@ -30,17 +30,19 @@
</view> </view>
</view> </view>
</template> </template>
<template v-if="item1.QuestionContentObj[1]&&item1.QuestionContentObj[1].length>0"> <template v-if="isOperate">
<view v-for="(item3, index3) in item1.QuestionContentObj[1]" :key="index3"> <template v-if="item1.QuestionContentObj[1]&&item1.QuestionContentObj[1].length>0">
<view class="flex item2 flex_start_center"> <view v-for="(item3, index3) in item1.QuestionContentObj[1]" :key="index3">
<view class="num">{{index3+1}}.</view> <view class="flex item2 flex_start_center">
<view class="chooseName" v-html="item3.Content"></view> <view class="num">{{index3+1}}.</view>
<view class="chooseName" v-html="item3.Content"></view>
</view>
<van-button type="primary" size="small" @click="alertMenu(item3)">
{{item3.Name==''?'请选择':item3.Name}}
</van-button>
<van-action-sheet :show="item3.isShow" @click-overlay="hideVan(item3)" :actions="getSelect(item1.QuestionContentObj[0])" @select="onSelect($event,item3,item1)"/>
</view> </view>
<van-button type="primary" size="small" @click="alertMenu(item3)"> </template>
{{item3.Name==''?'请选择':item3.Name}}
</van-button>
<van-action-sheet :show="item3.isShow" @click-overlay="hideVan(item3)" :actions="getSelect(item1.QuestionContentObj[0])" @select="onSelect($event,item3,item1)"/>
</view>
</template> </template>
</view> </view>
</swiper-item> </swiper-item>
...@@ -70,7 +72,8 @@ ...@@ -70,7 +72,8 @@
paperData: Object, paperData: Object,
sort: Number, sort: Number,
sortTotal: Number, sortTotal: Number,
isLast: Boolean isLast: Boolean,
isOperate: Boolean
}, },
setup(props, context) { setup(props, context) {
let {ctx} = getCurrentInstance(); let {ctx} = getCurrentInstance();
...@@ -87,6 +90,7 @@ ...@@ -87,6 +90,7 @@
sortTotal: props.sortTotal, sortTotal: props.sortTotal,
current: 1, //默认从第几个开始-用于从快捷菜单点入 current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题 ExamIndex: 1, //第几题
isOperate: props.isOperate
}); });
let methods = { let methods = {
...@@ -165,6 +169,26 @@ ...@@ -165,6 +169,26 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.isTrueAnswer {
color: green !important;
}
.isNotAnswer {
color: red !important;
}
.AnswerContent {
font-size: 30rpx;
padding: 25rpx;
background-color: #F4F4F4;
border-radius: 5px;
}
.viewAnswerContent {
width: 100%;
border-bottom: 1px solid #d1d1d1;
padding-bottom: 5px;
}
.Exam_Total { .Exam_Total {
font-size: 25rpx; font-size: 25rpx;
color: gray; color: gray;
......
...@@ -28,15 +28,41 @@ ...@@ -28,15 +28,41 @@
</view> </view>
</view> </view>
</template> </template>
<template v-if="item1.QuestionContentObj[1] && item1.QuestionContentObj[1].length > 0"> <template v-if="isOperate">
<view v-for="(item3, index3) in item1.QuestionContentObj[1]" :key="index3" <template v-if="item1.QuestionContentObj[1] && item1.QuestionContentObj[1].length > 0">
style="margin-bottom: 20px"> <view v-for="(item3, index3) in item1.QuestionContentObj[1]" :key="index3"
<van-button type="primary" size="small" @click="alertMenu(item3)"> style="margin-bottom: 20px">
{{ item3.Name == "" ? "请选择" : item3.Name }} <van-button type="primary" size="small" @click="alertMenu(item3)">
</van-button> {{ item3.Name == "" ? "请选择" : item3.Name }}
<van-action-sheet :show="item3.isShow" @click-overlay="hideVan(item3)" </van-button>
:actions="getSelect(item1.QuestionContentObj[0])" <van-action-sheet :show="item3.isShow" @click-overlay="hideVan(item3)"
@select="onSelect($event, item3, item1)" /> :actions="getSelect(item1.QuestionContentObj[0])"
@select="onSelect($event, item3, item1)" />
</view>
</template>
</template>
<template v-else>
<view class="AnswerContent">
<view>
<text style="color:#8c8a94">正确答案:</text>
<text class="isTrueAnswer">{{item1.Answer}}</text>
<text>
您的答案:
<template v-if="item1.StundetAnswer!=''">
<text v-if="item1.Answer==item1.StundetAnswer" 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;">
<text style="color:#8c8a94">解析:</text>
<view style="color:#000;display:inline-block;" v-html="item1.AnswerParse"></view>
</view>
</view> </view>
</template> </template>
</view> </view>
...@@ -69,6 +95,7 @@ ...@@ -69,6 +95,7 @@
sortTotal: Number, sortTotal: Number,
isLast: Boolean, isLast: Boolean,
startIndex: Number, startIndex: Number,
isOperate: Boolean
}, },
setup(props, context) { setup(props, context) {
let { let {
...@@ -88,6 +115,7 @@ ...@@ -88,6 +115,7 @@
sortTotal: props.sortTotal, sortTotal: props.sortTotal,
current: 1, //默认从第几个开始-用于从快捷菜单点入 current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题 ExamIndex: 1, //第几题
isOperate: props.isOperate
}); });
if (props.startIndex) { if (props.startIndex) {
data.current = props.startIndex; data.current = props.startIndex;
...@@ -174,7 +202,26 @@ ...@@ -174,7 +202,26 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.isTrueAnswer {
color: green !important;
}
.isNotAnswer {
color: red !important;
}
.AnswerContent {
font-size: 30rpx;
padding: 25rpx;
background-color: #F4F4F4;
border-radius: 5px;
}
.viewAnswerContent {
width: 100%;
border-bottom: 1px solid #d1d1d1;
padding-bottom: 5px;
}
.Exam_Total { .Exam_Total {
font-size: 25rpx; font-size: 25rpx;
color: gray; color: gray;
......
...@@ -236,6 +236,7 @@ ...@@ -236,6 +236,7 @@
:isLast="isLast" :isLast="isLast"
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length" :sortTotal="peaperDetail.Paper.GroupList.length"
:isOperate="isOperate"
@getAfterTopic="getAfterTopic()" @getAfterTopic="getAfterTopic()"
@getBeforeTopic="getBeforeTopic()" @getBeforeTopic="getBeforeTopic()"
@answerChange="getAnswerChange($event, index)" @answerChange="getAnswerChange($event, index)"
...@@ -263,6 +264,7 @@ ...@@ -263,6 +264,7 @@
:isLast="isLast" :isLast="isLast"
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length" :sortTotal="peaperDetail.Paper.GroupList.length"
:isOperate="isOperate"
@getAfterTopic="getAfterTopic()" @getAfterTopic="getAfterTopic()"
@getBeforeTopic="getBeforeTopic()" @getBeforeTopic="getBeforeTopic()"
@answerChange="getAnswerChange($event, index)" @answerChange="getAnswerChange($event, index)"
......
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