Commit 43ab0259 authored by 罗超's avatar 罗超

1

parent f5be80d4
...@@ -16,10 +16,7 @@ ...@@ -16,10 +16,7 @@
@change="onchange" @change="onchange"
> >
<swiper-item v-if="sortIndex != 1"></swiper-item> <swiper-item v-if="sortIndex != 1"></swiper-item>
<swiper-item <swiper-item v-for="(item1, index1) in data.DetailsList" :key="index1">
v-for="(item1, index1) in data.DetailsList"
:key="item1.id"
>
<view class="item1"> <view class="item1">
<view class="flex flex_start_center"> <view class="flex flex_start_center">
<view>{{ index1 + 1 }}</view> <view>{{ index1 + 1 }}</view>
...@@ -27,11 +24,11 @@ ...@@ -27,11 +24,11 @@
</view> </view>
<view <view
v-for="(item2, index2) in item1.QuestionContentObj" v-for="(item2, index2) in item1.QuestionContentObj"
:key="item2.id" :key="index2"
class="flex item2 flex_start_center" class="flex item2 flex_start_center"
> >
<view class="chooseName" @click="change(index1, index2)"> <view class="chooseName">
<input type="text" v-model="item1.myAnswer" class="input" /> <input type="text" v-model="item2.Content" class="input" />
</view> </view>
</view> </view>
</view> </view>
...@@ -82,14 +79,6 @@ export default { ...@@ -82,14 +79,6 @@ export default {
url: "/pages/exam/examPaper", url: "/pages/exam/examPaper",
}); });
}, },
back() {
uni.navigateBack();
},
//选题
change(index1, index2) {
data.data.DetailsList[index1].choose =
data.data.DetailsList[index1].QuestionContentObj[index2].Name;
},
onchange(e) { onchange(e) {
data.ExamIndex = e.detail.current; data.ExamIndex = e.detail.current;
if (data.ExamIndex === data.data.DetailsList.length + 1) { if (data.ExamIndex === data.data.DetailsList.length + 1) {
......
<template> <template>
<!-- 单选题 --> <!-- 判断题 -->
<view> <view>
<view class="item" style="padding: 0 20px"> <view class="item" style="padding: 0 20px">
<view class="name"> <view class="name">
...@@ -21,10 +21,7 @@ ...@@ -21,10 +21,7 @@
@change="onchange" @change="onchange"
> >
<swiper-item v-if="sortIndex != 1"></swiper-item> <swiper-item v-if="sortIndex != 1"></swiper-item>
<swiper-item <swiper-item v-for="(item1, index1) in data.DetailsList" :key="index1">
v-for="(item1, index1) in data.DetailsList"
:key="item1.id"
>
<view class="item1"> <view class="item1">
<view class="flex flex_start_center"> <view class="flex flex_start_center">
<view class="num" v-html="item1.Title"></view> <view class="num" v-html="item1.Title"></view>
...@@ -32,18 +29,18 @@ ...@@ -32,18 +29,18 @@
<view <view
v-for="(item2, index2) in item1.QuestionContentObj" v-for="(item2, index2) in item1.QuestionContentObj"
:key="item2.id" :key="index2"
class="flex item2 flex_start_center" class="flex item2 flex_start_center"
> >
<view <view
class="chooseNum" class="chooseNum"
:class="{ myAnswer: item1.myAnswer === item2.Name }" :class="{ myAnswer: item2.IsAnswer }"
@click="change(index1, index2)" @click="change(item1, item2)"
>{{ item2.Name }} >{{ item2.Name }}
</view> </view>
<view <view
class="chooseName" class="chooseName"
@click="change(index1, index2)" @click="change(item1, item2)"
v-html="item2.Content" v-html="item2.Content"
></view> ></view>
</view> </view>
...@@ -97,9 +94,14 @@ export default { ...@@ -97,9 +94,14 @@ export default {
uni.navigateBack(); uni.navigateBack();
}, },
//选题 //选题
change(index1, index2) { change(item1, item2) {
data.data.DetailsList[index1].myAnswer = item1.QuestionContentObj.map((e) => {
data.data.DetailsList[index1].QuestionContentObj[index2].Name; if (e.Name == item2.Name) {
e.IsAnswer = true;
} else {
e.IsAnswer = false;
}
});
}, },
onchange(e) { onchange(e) {
data.ExamIndex = e.detail.current; data.ExamIndex = e.detail.current;
......
<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;">(共{{data.DetailsList.length}}道,{{data.GScore}}分)</text> <text style="color: #999999"
</view> >(共{{ data.DetailsList.length }}道,{{ data.GScore }}分)</text
<view> >
<text class="Single_Before">{{ExamIndex}}</text>/ </view>
<text class="Exam_Total">{{data.DetailsList.length}}</text> <view>
</view> <text class="Single_Before">{{ ExamIndex }}</text
</view> >/
<swiper class="swiper-box" :autoplay="autoplay" :current="current" @change="onchange"> <text class="Exam_Total">{{ data.DetailsList.length }}</text>
<swiper-item v-if="sortIndex != 1"></swiper-item> </view>
<swiper-item v-for="(item1, index1) in data.DetailsList" :key="item1.id"> </view>
<view class="item1"> <swiper
<view class="flex flex_start_center"> class="swiper-box"
<view>{{ index1 + 1 }}</view> :autoplay="autoplay"
<view class="num" v-html="item1.Title"></view> :current="current"
</view> @change="onchange"
<view class="chooseName"> >
<textarea type="text" v-model="item1.myAnswer" class="input textarea" placeholder="请填写答案" <swiper-item v-if="sortIndex != 1"></swiper-item>
placeholder-style="textarea-placeholder" :maxlength="-1" /> <swiper-item
</view> v-for="(item1, index1) in data.DetailsList"
</view> :key="item1.id"
</swiper-item> >
<swiper-item v-if="sortIndex != sortTotal"></swiper-item> <view class="item1">
</swiper> <view class="flex flex_start_center">
</view> <view>{{ index1 + 1 }}</view>
<van-toast id="van-toast" /> <view class="num" v-html="item1.Title"></view>
</view> </view>
<view class="chooseName">
<textarea
type="text"
v-model="item1.Answer"
class="input textarea"
placeholder="请填写答案"
placeholder-style="textarea-placeholder"
:maxlength="-1"
/>
</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 { import { changeNumToHan } from "../../utils/index";
changeNumToHan export default {
} from "../../utils/index"; props: {
export default { paperData: Object,
props: { sort: Number,
paperData: Object, sortTotal: Number,
sort: Number, isLast: Boolean,
sortTotal: Number, },
isLast: Boolean setup(props, context) {
}, let { ctx } = getCurrentInstance();
setup(props, context) { props.paperData.DetailsList.forEach((item, index) => {
let { item.myAnswer = "";
ctx });
} = getCurrentInstance(); let data = reactive({
props.paperData.DetailsList.forEach((item, index) => { data: props.paperData,
item.myAnswer = ""; autoplay: false,
}); sortTotal: props.sortTotal,
let data = reactive({ sortIndex: props.sort + 1,
data: props.paperData, current: 1, //默认从第几个开始-用于从快捷菜单点入
autoplay: false, ExamIndex: 1, //第几题
sortTotal: props.sortTotal, });
sortIndex: props.sort + 1,
current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题
});
let methods = { let methods = {
changeNumToHan, changeNumToHan,
jumpPage() { jumpPage() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/exam/examPaper", url: "/pages/exam/examPaper",
}); });
}, },
back() { back() {
uni.navigateBack(); uni.navigateBack();
}, },
onchange(e) { onchange(e) {
data.ExamIndex = e.detail.current; data.ExamIndex = e.detail.current;
if (data.ExamIndex === data.data.DetailsList.length + 1) { if (data.ExamIndex === data.data.DetailsList.length + 1) {
console.log('进入') console.log("进入");
this.$emit('getAfterTopic'); this.$emit("getAfterTopic");
} }
if (e.detail.current == 0) { if (e.detail.current == 0) {
this.$emit('getBeforeTopic'); this.$emit("getBeforeTopic");
} }
} },
}; };
onMounted(() => { onMounted(() => {
if (props.isLast) { if (props.isLast) {
data.current = props.paperData.DetailsList.length; data.current = props.paperData.DetailsList.length;
} }
}) });
let that = methods; let that = methods;
return { return {
...toRefs(data), ...toRefs(data),
...methods, ...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;
} }
.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;
} }
.item { .item {
margin-bottom: 40rpx; margin-bottom: 40rpx;
} }
.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;
} }
.choose { .choose {
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;
} }
.input { .input {
box-sizing: border-box; box-sizing: border-box;
width: 690rpx; width: 690rpx;
border-bottom: 2rpx solid #000; border-bottom: 2rpx solid #000;
color: #000; color: #000;
font-size: 22rpx; font-size: 22rpx;
} }
.textarea { .textarea {
box-sizing: border-box; box-sizing: border-box;
padding: 20rpx 0; padding: 20rpx 0;
} }
/deep/.textarea-placeholder { /deep/.textarea-placeholder {
font-size: 20rpx; font-size: 20rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #cccccc; color: #cccccc;
} }
</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