Commit f576a5a8 authored by 罗超's avatar 罗超

1

parent 33416f68
<template> <template>
<!-- 单选题 --> <!-- 单选题 -->
<view> <view>
<view class="item"> <view class="item">
<view class="name"> <view class="name">
<view> <view>
{{ changeNumToHan(sortIndex) }}{{ data.GroupName }} {{ changeNumToHan(sortIndex) }}{{ data.GroupName }}
<text style="color:#999999;">(共{{data.DetailsList.length}}道,{{Score}}分)</text> <text style="color: #999999"
</view> >(共{{ data.DetailsList.length }}道,{{ Score }}分)</text
<view> >
<text class="Single_Before">{{ExamIndex}}</text>/<text </view>
class="Exam_Total">{{data.DetailsList.length}}</text> <view>
</view> <text class="Single_Before">{{ ExamIndex }}</text
</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="item1.id"> <swiper
<view class="item1"> class="swiper-box"
<view class="flex flex_start_center"> :autoplay="autoplay"
<view>{{ index1 + 1 }}</view> :current="current"
<view class="num readTitle" v-html="item1.Title"></view> @change="onchange"
</view> >
<swiper-item></swiper-item>
<swiper-item
v-for="(item1, index1) in data.DetailsList"
:key="item1.id"
>
<view class="item1">
<view class="flex flex_start_center">
<view>{{ index1 + 1 }}</view>
<view class="num readTitle" v-html="item1.Title"></view>
</view>
<view v-for="(item2, index2) in item1.QuestionContentObj" :key="item2.id" <view
class="flex item2 flex_start_center"> v-for="(item2, index2) in item1.QuestionContentObj"
<view class="chooseNum" :class="{ myAnswer: item1.myAnswer === item2.Name }" :key="item2.id"
@click="change(index1, index2)">{{ item2.Name }} class="flex item2 flex_start_center"
</view> >
<view class="chooseName" @click="change(index1, index2)" v-html="item2.Content"></view> <view
</view> class="chooseNum"
</view> :class="{ myAnswer: item1.myAnswer === item2.Name }"
</swiper-item> @click="change(index1, index2)"
<swiper-item></swiper-item> >{{ item2.Name }}
</swiper> </view>
</view> <view
<van-toast id="van-toast" /> class="chooseName"
</view> @click="change(index1, index2)"
v-html="item2.Content"
></view>
</view>
</view>
</swiper-item>
<swiper-item></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 { import { changeNumToHan } from "../../utils/index";
changeNumToHan export default {
} from "../../utils/index"; props: {
export default { paperData: Object,
props: { sort: Number,
paperData: Object, },
sort: Number setup(props, context) {
}, let { ctx } = getCurrentInstance();
setup(props, context) { let data = reactive({
let { autoplay: false,
ctx sortIndex: props.sort + 1,
} = getCurrentInstance(); data: props.paperData,
Score: 0, //总分
current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题
});
data.data.DetailsList.forEach((item) => {
item.Title = item.Title.replace(/\<img/gi, '<img style="max-width:100%"');
console.log(90, item.Title);
});
let data = reactive({ let methods = {
autoplay: false, changeNumToHan,
sortIndex: props.sort + 1, jumpPage() {
data: props.paperData, uni.navigateTo({
Score: 0, //总分 url: "/pages/exam/examPaper",
current: 1, //默认从第几个开始-用于从快捷菜单点入 });
ExamIndex: 1, //第几题 },
}); back() {
uni.navigateBack();
let methods = { },
changeNumToHan, //选题
jumpPage() { change(index1, index2) {
uni.navigateTo({ data.data.DetailsList[index1].myAnswer =
url: "/pages/exam/examPaper", data.data.DetailsList[index1].QuestionContentObj[index2].Name;
}); },
}, //获取总分
back() { getScore() {
uni.navigateBack(); data.Score = 0;
}, data.data.DetailsList.forEach((x) => {
//选题 data.Score += parseFloat(x.Score);
change(index1, index2) { });
data.data.DetailsList[index1].myAnswer = },
data.data.DetailsList[index1].QuestionContentObj[index2].Name; onchange(e) {
}, data.ExamIndex = e.detail.current;
//获取总分 if (data.ExamIndex === data.data.DetailsList.length + 1) {
getScore() { console.log("进入");
data.Score = 0; this.$emit("getAfterTopic");
data.data.DetailsList.forEach(x => { }
data.Score += parseFloat(x.Score); if (e.detail.current == 0) {
}) this.$emit("getBeforeTopic");
}, }
onchange(e) { },
data.ExamIndex = e.detail.current; };
if (data.ExamIndex === data.data.DetailsList.length + 1) { onMounted(() => {
console.log('进入') console.log(props.paperData, "props.paperData");
this.$emit('getAfterTopic'); that.getScore();
} });
if (e.detail.current == 0) { let that = methods;
this.$emit('getBeforeTopic'); return {
} ...toRefs(data),
} ...methods,
}; };
onMounted(() => { },
console.log(props.paperData, 'props.paperData'); };
that.getScore();
})
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 { .Single_Before {
font-size: 28rpx; font-size: 28rpx;
font-weight: bold; font-weight: bold;
color: #DA7878; color: #da7878;
} }
.Exam_Total { .Exam_Total {
font-size: 25rpx; font-size: 25rpx;
color: gray; color: gray;
} }
.swiper-box { .swiper-box {
height: calc(100vh - 270rpx); height: calc(100vh - 270rpx);
box-sizing: border-box; box-sizing: border-box;
} }
.num { .num {
font-size: 26rpx; font-size: 26rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: bold; font-weight: bold;
color: #111111; color: #111111;
} }
.readTitle img{ .readTitle img {
max-width:100%; max-width: 100%;
} }
.item { .item {
/* margin-bottom: 40rpx; */ /* margin-bottom: 40rpx; */
position: relative; position: relative;
} }
.item1 { .item1 {
/* margin: 25rpx 0; */ /* margin: 25rpx 0; */
align-items: center; align-items: center;
} }
.item2 { .item2 {
padding-left: 25rpx; padding-left: 25rpx;
margin: 30rpx 0; margin: 30rpx 0;
} }
.myAnswer { .myAnswer {
background-color: #00acf9 !important; background-color: #00acf9 !important;
color: #ffffff !important; color: #ffffff !important;
} }
.chooseNum { .chooseNum {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
text-align: center; text-align: center;
line-height: 40rpx; line-height: 40rpx;
border-radius: 50%; border-radius: 50%;
border: 1px solid #e2e2e2; border: 1px solid #e2e2e2;
margin-right: 30rpx; margin-right: 30rpx;
font-size: 26rpx; font-size: 26rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: bold; font-weight: bold;
color: #111111; color: #111111;
} }
.chooseName { .chooseName {
font-size: 24rpx; font-size: 24rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #111111; color: #111111;
} }
</style> </style>
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