Commit e6ace375 authored by 罗超's avatar 罗超

1

parent 9eae14cd
<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 }} </view>
{{ changeNumToHan(sortIndex) }}{{ data.GroupName }} <view>
</view> <text class="Single_Before">{{ ExamIndex }}</text
<view> >/<text class="Exam_Total">{{ data.DetailsList.length }}</text>
<text class="Single_Before">{{ExamIndex}}</text>/<text </view>
class="Exam_Total">{{data.DetailsList.length}}</text> </view>
</view> <swiper
</view> class="swiper-box"
<swiper class="swiper-box" :autoplay="autoplay" :current="current" @change="onchange"> :autoplay="autoplay"
<swiper-item></swiper-item> :current="current"
<swiper-item v-for="(item1, index1) in data.DetailsList" :key="item1.id"> @change="onchange"
<view class="item1"> >
<view class="flex flex_start_center"> <swiper-item v-if="sortIndex != 1"></swiper-item>
<view>{{ index1 + 1 }}</view> <swiper-item
<view class="num" v-html="item1.Title"></view> v-for="(item1, index1) in data.DetailsList"
</view> :key="item1.id"
<view v-for="(item2, index2) in item1.QuestionContentObj" :key="item2.id" >
class="flex item2 flex_start_center"> <view class="item1">
<view class="chooseName" @click="change(index1, index2)"> <view class="flex flex_start_center">
<input type="text" v-model="item1.myAnswer" class="input" /> <view>{{ index1 + 1 }}</view>
</view> <view class="num" v-html="item1.Title"></view>
</view> </view>
</view> <view
</swiper-item> v-for="(item2, index2) in item1.QuestionContentObj"
<swiper-item></swiper-item> :key="item2.id"
</swiper> class="flex item2 flex_start_center"
</view> >
<van-toast id="van-toast" /> <view class="chooseName" @click="change(index1, index2)">
</view> <input type="text" v-model="item1.myAnswer" class="input" />
</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 { import { changeNumToHan } from "../../utils/index";
changeNumToHan export default {
} from "../../utils/index"; props: {
export default { paperData: Object,
props: { isLast: Boolean,
paperData: Object, sort: Number,
isLast: Boolean, sortTotal: Number,
sort: Number },
}, setup(props, context) {
setup(props, context) { let { ctx } = getCurrentInstance();
let {ctx} = getCurrentInstance(); props.paperData.DetailsList.forEach((item, index) => {
props.paperData.DetailsList.forEach((item, index) => { item.myAnswer = "";
item.myAnswer = ""; });
}); let data = reactive({
let data = reactive({ data: props.paperData,
data: props.paperData, sortIndex: props.sort + 1,
sortIndex: props.sort+1, sortTotal: props.sortTotal,
current: 1 ,//默认从第几个开始-用于从快捷菜单点入 current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题 ExamIndex: 1, //第几题
}); });
console.log(77, data.sortTotal, data.sortIndex);
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();
}, },
//选题 //选题
change(index1, index2) { change(index1, index2) {
data.data.DetailsList[index1].choose = data.data.DetailsList[index1].choose =
data.data.DetailsList[index1].QuestionContentObj[index2].Name; 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) {
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");
} }
} },
}; };
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;
} }
.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;
} }
.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;
} }
</style> </style>
<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>/<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 class="num" v-html="item1.Title"></view> :current="current"
<!-- <view>{{ item1.Title }}</view> --> @change="onchange"
</view> >
<view v-for="(item2, index2, index3) in item1.QuestionContentObj" :key="index2" <swiper-item v-if="sortIndex != 1"></swiper-item>
class="flex item2 flex_wrap flex_start_center" v-if="index2 === 0"> <swiper-item
<view v-for="(item3, index3) in item2" :key="index3" class="flex item3 flex_start_center"> v-for="(item1, index1) in data.DetailsList"
<view class="chooseNum" :key="item1.id"
:class="{ myAnswer: item1.myAnswer.find((e) => e == item3.Name) }" >
@click="change(index1, index2, index3)">{{ item3.Name }} <view class="item1">
</view> <view class="flex flex_start_center">
<view class="chooseName" @click="change(index1, index2, index3)" v-html="item3.Content"> <view class="num" v-html="item1.Title"></view>
</view> <!-- <view>{{ item1.Title }}</view> -->
</view> </view>
</view> <view
</view> v-for="(item2, index2, index3) in item1.QuestionContentObj"
</swiper-item> :key="index2"
<swiper-item></swiper-item> class="flex item2 flex_wrap flex_start_center"
</swiper> v-if="index2 === 0"
<van-toast id="van-toast" /> >
</view> <view
</view> v-for="(item3, index3) in item2"
:key="index3"
class="flex item3 flex_start_center"
>
<view
class="chooseNum"
:class="{
myAnswer: item1.myAnswer.find((e) => e == item3.Name),
}"
@click="change(index1, index2, index3)"
>{{ item3.Name }}
</view>
<view
class="chooseName"
@click="change(index1, index2, index3)"
v-html="item3.Content"
>
</view>
</view>
</view>
</view>
</swiper-item>
<swiper-item v-if="sortIndex != sortTotal"></swiper-item>
</swiper>
<van-toast id="van-toast" />
</view>
</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,
isLast: Boolean },
}, setup(props, context) {
setup(props, context) { let { ctx } = getCurrentInstance();
let { props.paperData.DetailsList.forEach((item, index) => {
ctx item.myAnswer = [];
} = getCurrentInstance(); });
props.paperData.DetailsList.forEach((item, index) => { let data = reactive({
item.myAnswer = []; data: props.paperData,
}); sortIndex: props.sort + 1,
let data = reactive({ sortTotal: props.sortTotal,
data: props.paperData, autoplay: false,
sortIndex: props.sort+1, current: 1, //默认从第几个开始-用于从快捷菜单点入
autoplay: false, ExamIndex: 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();
}, },
//选题 //选题
change(index1, index2, index3) { change(index1, index2, index3) {
let myAnswer = data.data.DetailsList[index1].myAnswer; let myAnswer = data.data.DetailsList[index1].myAnswer;
let res = let res =
data.data.DetailsList[index1].QuestionContentObj[index2][index3].Name; data.data.DetailsList[index1].QuestionContentObj[index2][index3].Name;
let find = myAnswer.indexOf(res); let find = myAnswer.indexOf(res);
if (find == -1) { if (find == -1) {
myAnswer.push(res); myAnswer.push(res);
} else { } else {
myAnswer.splice(find, 1); myAnswer.splice(find, 1);
} }
}, },
onchange(e) { onchange(e) {
data.ExamIndex = e.detail.current; data.ExamIndex = e.detail.current;
console.log(data.ExamIndex,'data.ExamIndex'); console.log(data.ExamIndex, "data.ExamIndex");
console.log(data.data.DetailsList.length + 1,'length'); console.log(data.data.DetailsList.length + 1, "length");
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;
} }
}) });
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;
} }
.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;
} }
.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; */
} }
.item3 { .item3 {
width: 100%; width: 100%;
padding-left: 25rpx; padding-left: 25rpx;
margin: 20rpx 0; margin: 20rpx 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>
<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>/<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 class="num" v-html="item1.Title"></view> :current="current"
</view> @change="onchange"
<view v-for="(item2, index2) in item1.QuestionContentObj" :key="item2.id" >
class="item2 flex flex_start_center"> <swiper-item v-if="sortIndex != 1"></swiper-item>
<view class="chooseNum" :class="{ myAnswer: item1.myAnswer.find((e) => e == item2.Name) }" <swiper-item
@click="change(index1, index2)">{{ item2.Name }} v-for="(item1, index1) in data.DetailsList"
</view> :key="item1.id"
<view class="chooseName" @click="change(index1, index2)" v-html="item2.Content"></view> >
</view> <view class="item1">
</view> <view class="flex flex_start_center">
</swiper-item> <view class="num" v-html="item1.Title"></view>
<swiper-item></swiper-item> </view>
</swiper> <view
</view> v-for="(item2, index2) in item1.QuestionContentObj"
<van-toast id="van-toast" /> :key="item2.id"
</view> class="item2 flex flex_start_center"
>
<view
class="chooseNum"
:class="{
myAnswer: item1.myAnswer.find((e) => e == item2.Name),
}"
@click="change(index1, index2)"
>{{ item2.Name }}
</view>
<view
class="chooseName"
@click="change(index1, index2)"
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>
</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: { isLast: Boolean,
paperData: Object, sort: Number,
isLast: Boolean, sortTotal: Number,
sort:Number },
}, setup(props, context) {
setup(props, context) { props.paperData.DetailsList.forEach((item, index) => {
props.paperData.DetailsList.forEach((item, index) => { item.myAnswer = [];
item.myAnswer = []; });
}); let data = reactive({
let data = reactive({ data: props.paperData,
data: props.paperData, sortIndex: props.sort + 1,
sortIndex: props.sort+1, sortTotal: props.sortTotal,
autoplay: false, autoplay: false,
current: 1, //默认从第几个开始-用于从快捷菜单点入 current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题 ExamIndex: 1, //第几题
}); });
let methods = { console.log(91, data.sortIndex);
changeNumToHan, let methods = {
jumpPage() { changeNumToHan,
uni.navigateTo({ jumpPage() {
url: "/pages/exam/examPaper", uni.navigateTo({
}); url: "/pages/exam/examPaper",
}, });
back() { },
uni.navigateBack(); back() {
}, uni.navigateBack();
//选题 },
change(index1, index2) { //选题
let myAnswer = data.data.DetailsList[index1].myAnswer; change(index1, index2) {
let res = data.data.DetailsList[index1].QuestionContentObj[index2].Name; let myAnswer = data.data.DetailsList[index1].myAnswer;
let find = myAnswer.indexOf(res); let res = data.data.DetailsList[index1].QuestionContentObj[index2].Name;
if (find == -1) { let find = myAnswer.indexOf(res);
myAnswer.push(res); if (find == -1) {
} else { myAnswer.push(res);
myAnswer.splice(find, 1); } else {
} myAnswer.splice(find, 1);
}, }
onchange(e) { },
data.ExamIndex = e.detail.current; onchange(e) {
if (data.ExamIndex === data.data.DetailsList.length + 1) { data.ExamIndex = e.detail.current;
this.$emit('getAfterTopic'); if (data.ExamIndex === data.data.DetailsList.length + 1) {
} this.$emit("getAfterTopic");
if(e.detail.current==0){ }
this.$emit('getBeforeTopic'); if (e.detail.current == 0 && data.sortIndex != 1) {
} this.$emit("getBeforeTopic");
}, console.log("多选返回", e);
}; }
onMounted(() => { },
// if(props.isLast){ };
// data.current = props.paperData.DetailsList.length; onMounted(() => {
// } // if(props.isLast){
}); // data.current = props.paperData.DetailsList.length;
let that = methods; // }
return { });
...toRefs(data), let that = methods;
...methods, return {
}; ...toRefs(data),
}, ...methods,
onLoad() {}, };
}; },
onLoad() {},
};
</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;
} }
.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;
} }
.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>
<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>/<text class="Exam_Total">{{data.DetailsList.length}}</text> </view>
</view> <view>
</view> <text class="Single_Before">{{ ExamIndex }}</text
<swiper class="swiper-box" :autoplay="autoplay" :current="current" @change="onchange"> >/<text class="Exam_Total">{{ data.DetailsList.length }}</text>
<swiper-item></swiper-item> </view>
</view>
<swiper
class="swiper-box"
:autoplay="autoplay"
:current="current"
@change="onchange"
:skip-hidden-item-layout="true"
>
<!-- <swiper-item v-if="sortIndex != 1">第一页</swiper-item> -->
<swiper-item>第一页</swiper-item>
<swiper-item <swiper-item
v-for="(item1, index1) in data.DetailsList" v-for="(item1, index1) in data.DetailsList"
:key="item1.id" :key="item1.id"
...@@ -41,8 +51,8 @@ ...@@ -41,8 +51,8 @@
</view> </view>
</view> </view>
</swiper-item> </swiper-item>
<swiper-item></swiper-item> <swiper-item v-if="sortIndex != sortTotal">最后一页</swiper-item>
</swiper> </swiper>
</view> </view>
<van-toast id="van-toast" /> <van-toast id="van-toast" />
</view> </view>
...@@ -61,18 +71,23 @@ import { ...@@ -61,18 +71,23 @@ import {
} from "vue"; } from "vue";
import { changeNumToHan } from "../../utils/index"; import { changeNumToHan } from "../../utils/index";
export default { export default {
props: { paperData: Object, sort: Number , isLast: Boolean}, props: {
paperData: Object,
sort: Number,
sortTotal: Number,
isLast: Boolean,
},
setup(props, context) { setup(props, context) {
let { ctx } = getCurrentInstance(); let { ctx } = getCurrentInstance();
let data = reactive({ let data = reactive({
autoplay: false, autoplay: false,
sortIndex: props.sort+1, sortIndex: props.sort + 1, //大题序号
sortTotal: props.sortTotal, //总共多少道大题
data: props.paperData, data: props.paperData,
current: 1 ,//默认从第几个开始-用于从快捷菜单点入 current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题 ExamIndex: 1, //第几题
}); });
console.log(77, data.sortIndex != 1, data.sortIndex != data.sortTotal);
let methods = { let methods = {
changeNumToHan, changeNumToHan,
jumpPage() { jumpPage() {
...@@ -88,23 +103,27 @@ export default { ...@@ -88,23 +103,27 @@ export default {
data.data.DetailsList[index1].myAnswer = data.data.DetailsList[index1].myAnswer =
data.data.DetailsList[index1].QuestionContentObj[index2].Name; data.data.DetailsList[index1].QuestionContentObj[index2].Name;
}, },
onchange(e){ onchange(e) {
data.ExamIndex = e.detail.current; console.log(106, e.detail.current);
if(data.ExamIndex===data.data.DetailsList.length+1){ if (data.sortIndex == 1) {
console.log('进入') data.ExamIndex = e.detail.current;
this.$emit('getAfterTopic'); }
}
if(e.detail.current==0){ if (data.ExamIndex === data.data.DetailsList.length + 1) {
this.$emit('getBeforeTopic'); console.log("单选", e.detail);
} this.$emit("getAfterTopic");
} }
if (e.detail.current == 0 && data.sortIndex != 1) {
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,
...@@ -123,41 +142,50 @@ export default { ...@@ -123,41 +142,50 @@ export default {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.Single_Before{
font-size: 28rpx; .Single_Before {
font-weight: bold; font-size: 28rpx;
color:#DA7878; font-weight: bold;
color: #da7878;
} }
.Exam_Total{
font-size:25rpx; .Exam_Total {
color:gray; font-size: 25rpx;
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;
} }
.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;
...@@ -171,10 +199,11 @@ export default { ...@@ -171,10 +199,11 @@ export default {
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>
\ No newline at end of file
<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}}道,{{data.GScore}}分)</text> <text style="color: #999999"
</view> >(共{{ data.DetailsList.length }}道,{{ data.GScore }}分)</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 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 class="num" v-html="item1.Title"></view> :autoplay="autoplay"
</view> :current="current"
@change="onchange"
>
<swiper-item v-if="sortIndex != 1"></swiper-item>
<swiper-item
v-for="(item1, index1) in data.DetailsList"
:key="item1.id"
>
<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="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 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,
isLast: Boolean },
}, setup(props, context) {
setup(props, context) { let { ctx } = getCurrentInstance();
let {
ctx
} = getCurrentInstance();
let data = reactive({ let data = reactive({
autoplay: false, autoplay: false,
data: props.paperData, data: props.paperData,
sortIndex: props.sort + 1, sortIndex: props.sort + 1, //大题序号
current: 0, //默认从第几个开始-用于从快捷菜单点入 sortTotal: props.sortTotal, //总共多少道大题
ExamIndex: 1, //第几题 current: 0, //默认从第几个开始-用于从快捷菜单点入
}); 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();
}, },
//选题 //选题
change(index1, index2) { change(index1, index2) {
data.data.DetailsList[index1].myAnswer = data.data.DetailsList[index1].myAnswer =
data.data.DetailsList[index1].QuestionContentObj[index2].Name; data.data.DetailsList[index1].QuestionContentObj[index2].Name;
}, },
onchange(e) { onchange(e) {
data.ExamIndex = e.detail.current+1; data.ExamIndex = e.detail.current + 1;
if (data.ExamIndex === data.data.DetailsList.length+1) { if (data.ExamIndex === data.data.DetailsList.length + 1) {
this.$emit('getAfterTopic'); this.$emit("getAfterTopic");
} }
} },
}; };
onMounted(() => { onMounted(() => {
if (props.isLast) { if (props.isLast) {
data.current = data.data.DetailsList.length-1; data.current = data.data.DetailsList.length - 1;
} }
}) });
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;
} }
.Exam_Total { .Exam_Total {
font-size: 25rpx; font-size: 25rpx;
color: gray; color: gray;
} }
.swiper-box { .swiper-box {
/* height: calc(100vh - 250rpx - constant(safe-area-inset-top, 40rpx)); */ /* height: calc(100vh - 250rpx - constant(safe-area-inset-top, 40rpx)); */
height: calc(100vh - 270rpx); height: calc(100vh - 270rpx);
box-sizing: border-box; box-sizing: border-box;
/* padding-bottom: env(safe-area-inset-top, 40rpx); */ /* padding-bottom: env(safe-area-inset-top, 40rpx); */
/* background-color: #f00; */ /* background-color: #f00; */
} }
.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; */
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>
<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(data.GSortNum + 1) }}{{ data.GroupName }} {{ changeNumToHan(data.GSortNum + 1) }}{{ 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>/<text class="Exam_Total">{{data.DetailsList.length}}</text> </view>
</view> <view>
</view> <text class="Single_Before">{{ ExamIndex }}</text
<swiper class="swiper-box" :autoplay="autoplay" :current="current" @change="onchange"> >/<text class="Exam_Total">{{ data.DetailsList.length }}</text>
<swiper-item></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 class="num" v-html="item1.Title"></view> :autoplay="autoplay"
</view> :current="current"
@change="onchange"
>
<swiper-item v-if="sortIndex != 1"></swiper-item>
<swiper-item
v-for="(item1, index1) in data.DetailsList"
:key="item1.id"
>
<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="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 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,
isLast: Boolean },
}, setup(props, context) {
setup(props, context) { let { ctx } = getCurrentInstance();
let {ctx} = getCurrentInstance(); let data = reactive({
let data = reactive({ autoplay: false,
autoplay: false, sortIndex: props.sort + 1,
sortIndex: props.sort+1, sortTotal: props.sortTotal,
data: props.paperData, data: props.paperData,
current: 1 ,//默认从第几个开始-用于从快捷菜单点入 current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 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();
}, },
//选题 //选题
change(index1, index2) { change(index1, index2) {
data.data.DetailsList[index1].myAnswer = data.data.DetailsList[index1].myAnswer =
data.data.DetailsList[index1].QuestionContentObj[index2].Name; 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) {
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;
} }
.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;
} }
.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;
} }
.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>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
:current="current" :current="current"
@change="onchange" @change="onchange"
> >
<swiper-item></swiper-item> <swiper-item v-if="sortIndex != 1"></swiper-item>
<swiper-item <swiper-item
v-for="(item1, index1) in data.DetailsList" v-for="(item1, index1) in data.DetailsList"
:key="item1.id" :key="item1.id"
...@@ -33,43 +33,103 @@ ...@@ -33,43 +33,103 @@
v-html="item1.Title" v-html="item1.Title"
></view> ></view>
</view> </view>
<view <view class="questionBox" :style="{ height: `${questionH}rpx` }">
class="questionBox"
:style="{ height: `${questionH}rpx` }"
@touchstart="touchstart"
@touchmove="touchmove"
@touchend="touchend"
>
<view class="questionTotal">本阅读理解共5小题</view>
<view <view
v-for="(item2, index2) in item1.QuestionContentObj" class="questionTotal"
:key="index2" @touchstart="touchstart"
class="item2" @touchmove="touchmove"
@touchend="touchend"
>本阅读理解共5小题</view
> >
<view class="flex questionTitle"> <view class="questionView">
<view>{{ index2 + 1 }}</view> <view
<view v-html="item2.SubTitle"></view> v-for="(item2, index2) in item1.QuestionContentObj"
</view> :key="index2"
<view v-for="(item3, index3) in item2.SubAnwser" :key="index3"> class="item2"
<view class="flex flex_start_center item3"> >
<view class="flex questionTitle">
<view
>{{ index2 + 1 }}、({{ item2.QuestionName }},{{
item2.SubScore
}}分)</view
>
<view v-html="item2.SubTitle"></view>
</view>
<view
v-for="(item3, index3) in item2.SubAnwser"
:key="index3"
>
<!-- 单选 、判断-->
<view
class="flex flex_start_center item3"
v-if="
item2.QuestionKey === 'single' ||
item2.QuestionKey === 'judge'
"
>
<view
class="chooseNum"
:class="{ myAnswer: item2.myAnswer === item3.Name }"
@click="singerChange(index1, index2, index3)"
>{{ item3.Name }}
</view>
<view
class="chooseName"
@click="singerChange(index1, index2, index3)"
v-html="item3.Content"
></view>
</view>
<!-- 多选 -->
<view <view
class="chooseNum" class="flex flex_start_center item3"
:class="{ myAnswer: item2.myAnswer === item3.Name }" v-if="item2.QuestionKey === 'multiple'"
@click="change(index1, index2, index3)" >
>{{ item3.Name }} <view
class="chooseNum"
:class="{
myAnswer: item2.myAnswer.find((e) => e == item3.Name),
}"
@click="multipleChange(index1, index2, index3)"
>{{ item3.Name }}
</view>
<view
class="chooseName"
@click="multipleChange(index1, index2, index3)"
v-html="item3.Content"
></view>
</view> </view>
<!-- 填空 -->
<view <view
class="chooseName" class="flex flex_start_center item3"
@click="change(index1, index2, index3)" v-if="item2.QuestionKey === 'fill-in'"
v-html="item3.Content" >
></view> <view class="chooseNum">{{ index3 + 1 }} </view>
<input
type="text"
v-model="item2.myAnswer"
class="chooseName chooseName2"
placeholder="请填写答案"
/>
</view>
<!-- 简答 -->
<view
class="flex flex_start_center item3"
v-if="item2.QuestionKey === 'short-answer'"
>
<textarea
type="text"
v-model="item2.myAnswer"
class="chooseName chooseName2"
placeholder="请填写答案"
/>
</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</swiper-item> </swiper-item>
<swiper-item></swiper-item> <swiper-item v-if="sortIndex != sortTotal"></swiper-item>
</swiper> </swiper>
</view> </view>
<van-toast id="van-toast" /> <van-toast id="van-toast" />
...@@ -87,28 +147,37 @@ import { ...@@ -87,28 +147,37 @@ import {
computed, computed,
onMounted, onMounted,
} from "vue"; } from "vue";
import { changeNumToHan } from "../../utils/index"; import { changeNumToHan, getSystemInfo } from "../../utils/index";
export default { export default {
props: { props: {
paperData: Object, paperData: Object,
sort: Number, sort: Number,
isLast: Boolean sortTotal: Number,
isLast: Boolean,
}, },
setup(props, context) { setup(props, context) {
let { ctx } = getCurrentInstance(); let { ctx } = getCurrentInstance();
let data = reactive({ let data = reactive({
autoplay: false, autoplay: false,
sortIndex: props.sort + 1, sortIndex: props.sort + 1,
sortTotal: props.sortTotal, //总共多少道大题
data: props.paperData, data: props.paperData,
Score: 0, //总分 Score: 0, //总分
current: 1, //默认从第几个开始-用于从快捷菜单点入 current: 1, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题 ExamIndex: 1, //第几题
questionH: 800, //问题区域高度 questionH: 500, //问题区域高度
timer: null, timer: null,
timeOutEvent: false, timeOutEvent: false,
}); });
data.data.DetailsList.forEach((item) => { data.data.DetailsList.forEach((item) => {
item.Title = item.Title.replace(/\<img/gi, '<img style="max-width:100%"'); item.Title = item.Title.replace(/\<img/gi, '<img style="max-width:100%"');
item.QuestionContentObj.forEach((_item) => {
if (_item.QuestionKey === "multiple") {
_item.myAnswer = [];
} else {
_item.myAnswer = "嘻嘻";
}
});
}); });
let methods = { let methods = {
changeNumToHan, changeNumToHan,
...@@ -120,14 +189,33 @@ export default { ...@@ -120,14 +189,33 @@ export default {
back() { back() {
uni.navigateBack(); uni.navigateBack();
}, },
//选题 //----------------------------------------选题----------------------------------
change(index1, index2, index3) { // 单选or判断
singerChange(index1, index2, index3) {
data.data.DetailsList[index1].QuestionContentObj[index2].myAnswer = data.data.DetailsList[index1].QuestionContentObj[index2].myAnswer =
data.data.DetailsList[index1].QuestionContentObj[index2].SubAnwser[ data.data.DetailsList[index1].QuestionContentObj[index2].SubAnwser[
index3 index3
].Name; ].Name;
}, },
// 多选
multipleChange(index1, index2, index3) {
let myAnswer = data.data.DetailsList[index1].QuestionContentObj[index2]
.myAnswer
? data.data.DetailsList[index1].QuestionContentObj[index2].myAnswer
: [];
let res =
data.data.DetailsList[index1].QuestionContentObj[index2].SubAnwser[
index3
].Name;
let find = myAnswer.indexOf(res);
if (find == -1) {
myAnswer.push(res);
} else {
myAnswer.splice(find, 1);
}
},
onchange(e) { onchange(e) {
// data.questionH = 500;
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("进入");
...@@ -139,7 +227,6 @@ export default { ...@@ -139,7 +227,6 @@ export default {
}, },
//触摸事件 //触摸事件
touchstart(e) { touchstart(e) {
console.log(133, e);
clearTimeout(data.timer); clearTimeout(data.timer);
data.timer = setTimeout(() => { data.timer = setTimeout(() => {
data.timeOutEvent = true; data.timeOutEvent = true;
...@@ -147,11 +234,13 @@ export default { ...@@ -147,11 +234,13 @@ export default {
}, },
touchmove(e) { touchmove(e) {
if (data.timeOutEvent) { if (data.timeOutEvent) {
console.log("151", "长按了"); console.log("长按了");
let touches = e.touches[0]; let touches = e.touches[0];
// let startTx = touches.clientX;
let startTy = touches.clientY; let startTy = touches.clientY;
console.log(134, startTy); getSystemInfo((res) => {
let screenHeight = res.screenHeight;
data.questionH = (screenHeight - startTy) * 2;
});
} }
}, },
touchend() { touchend() {
...@@ -160,8 +249,8 @@ export default { ...@@ -160,8 +249,8 @@ export default {
}, },
}; };
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;
...@@ -202,7 +291,7 @@ export default { ...@@ -202,7 +291,7 @@ export default {
} }
.swiper-box { .swiper-box {
height: calc(100vh - 270rpx); height: calc(100vh - 230rpx);
box-sizing: border-box; box-sizing: border-box;
overflow: auto; overflow: auto;
} }
...@@ -233,10 +322,15 @@ export default { ...@@ -233,10 +322,15 @@ export default {
background-color: #eee; background-color: #eee;
position: absolute; position: absolute;
left: 0rpx; left: 0rpx;
bottom: env(safe-area-inset-bottom); bottom: 0rpx;
z-index: 9; z-index: 9;
color: #000000; color: #000000;
}
.questionView {
height: 100%;
overflow-y: auto; overflow-y: auto;
box-sizing: border-box;
padding-bottom: 80rpx;
} }
.questionTotal { .questionTotal {
text-align: center; text-align: center;
...@@ -287,4 +381,8 @@ export default { ...@@ -287,4 +381,8 @@ export default {
font-weight: 500; font-weight: 500;
color: #111111; color: #111111;
} }
.chooseName2 {
flex-grow: 1;
border-bottom: 1px solid #111;
}
</style> </style>
...@@ -28,8 +28,10 @@ ...@@ -28,8 +28,10 @@
<!-- 数字单选题 --> <!-- 数字单选题 -->
<SingleChoiceNumber <SingleChoiceNumber
:paperData="item" :paperData="item"
@getBeforeTopic="getBeforeTopic()"
@getAfterTopic="getAfterTopic()" @getAfterTopic="getAfterTopic()"
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length"
:isLast="isLast" :isLast="isLast"
v-if=" v-if="
item.QuestionTypeKey === 'single-number' && index === changeIndex item.QuestionTypeKey === 'single-number' && index === changeIndex
...@@ -40,6 +42,7 @@ ...@@ -40,6 +42,7 @@
:paperData="item" :paperData="item"
:isLast="isLast" :isLast="isLast"
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length"
@getBeforeTopic="getBeforeTopic()" @getBeforeTopic="getBeforeTopic()"
@getAfterTopic="getAfterTopic()" @getAfterTopic="getAfterTopic()"
v-if="item.QuestionTypeKey === 'multiple' && index === changeIndex" v-if="item.QuestionTypeKey === 'multiple' && index === changeIndex"
...@@ -49,6 +52,7 @@ ...@@ -49,6 +52,7 @@
:paperData="item" :paperData="item"
:isLast="isLast" :isLast="isLast"
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length"
@getBeforeTopic="getBeforeTopic()" @getBeforeTopic="getBeforeTopic()"
@getAfterTopic="getAfterTopic()" @getAfterTopic="getAfterTopic()"
v-if="item.QuestionTypeKey === 'single' && index === changeIndex" v-if="item.QuestionTypeKey === 'single' && index === changeIndex"
...@@ -58,6 +62,7 @@ ...@@ -58,6 +62,7 @@
:paperData="item" :paperData="item"
:isLast="isLast" :isLast="isLast"
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length"
@getBeforeTopic="getBeforeTopic()" @getBeforeTopic="getBeforeTopic()"
@getAfterTopic="getAfterTopic()" @getAfterTopic="getAfterTopic()"
v-if="item.QuestionTypeKey === 'listening' && index === changeIndex" v-if="item.QuestionTypeKey === 'listening' && index === changeIndex"
...@@ -67,6 +72,7 @@ ...@@ -67,6 +72,7 @@
:paperData="item" :paperData="item"
:isLast="isLast" :isLast="isLast"
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length"
@getBeforeTopic="getBeforeTopic()" @getBeforeTopic="getBeforeTopic()"
@getAfterTopic="getAfterTopic()" @getAfterTopic="getAfterTopic()"
v-if="item.QuestionTypeKey === 'fill-in' && index === changeIndex" v-if="item.QuestionTypeKey === 'fill-in' && index === changeIndex"
...@@ -77,6 +83,7 @@ ...@@ -77,6 +83,7 @@
:paperData="item" :paperData="item"
:isLast="isLast" :isLast="isLast"
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length"
@getAfterTopic="getAfterTopic()" @getAfterTopic="getAfterTopic()"
@getBeforeTopic="getBeforeTopic()" @getBeforeTopic="getBeforeTopic()"
v-if=" v-if="
...@@ -89,12 +96,13 @@ ...@@ -89,12 +96,13 @@
:paperData="item" :paperData="item"
:isLast="isLast" :isLast="isLast"
:sort="index" :sort="index"
:sortTotal="peaperDetail.Paper.GroupList.length"
@getAfterTopic="getAfterTopic()" @getAfterTopic="getAfterTopic()"
@getBeforeTopic="getBeforeTopic()" @getBeforeTopic="getBeforeTopic()"
v-if="item.QuestionTypeKey === 'judge' && index === changeIndex" v-if="item.QuestionTypeKey === 'judge' && index === changeIndex"
/> />
<!--简答题、名词解释、论述题、计算题、口语题、其它--> <!--简答题、名词解释、论述题、计算题、口语题、其它-->
<Write <!-- <Write
:paperData="item" :paperData="item"
v-if=" v-if="
item.QuestionTypeKey === 'short-answer' || item.QuestionTypeKey === 'short-answer' ||
...@@ -103,7 +111,7 @@ ...@@ -103,7 +111,7 @@
item.QuestionTypeKey === 'calculation' || item.QuestionTypeKey === 'calculation' ||
item.QuestionTypeKey === 'entry-problem' item.QuestionTypeKey === 'entry-problem'
" "
/> /> -->
<!-- <Connect :paperData="item" v-if="item.QuestionTypeKey === 'matching'" /> <!-- <Connect :paperData="item" v-if="item.QuestionTypeKey === 'matching'" />
<Sort <Sort
:paperData="item" :paperData="item"
......
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