Commit 575346f3 authored by zhengke's avatar zhengke

修改

parent 5da09d00
<template>
<!-- 多选题 -->
<view>
<view class="item">
<view class="name"
>{{ changeNumToHan(data.GSortNum + 1) }}{{ data.GroupName }}</view
>
<view
v-for="(item1, index1) in data.DetailsList"
:key="item1.id"
class="item1"
>
<view class="flex flex_start_center">
<view>{{ index1 + 1 }}</view>
<view class="num" v-html="item1.Title"></view>
</view>
<view
v-for="(item2, index2) in item1.QuestionContentObj"
:key="item2.id"
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>
</view>
<van-toast id="van-toast" />
</view>
<!-- 多选题 -->
<view>
<view class="item">
<view class="name">
<view>
{{ changeNumToHan(data.GSortNum + 1) }}{{ data.GroupName }}
<text>(共{{data.DetailsList.length}}道,{{Score}}分)</text>
</view>
<view>
<text class="Single_Before">{{ExamIndex}}</text>/<text
class="Exam_Total">{{data.DetailsList.length}}</text>
</view>
</view>
<swiper class="swiper-box" :autoplay="autoplay" :current="current" @change="onchange">
<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" v-html="item1.Title"></view>
</view>
<view v-for="(item2, index2) in item1.QuestionContentObj" :key="item2.id"
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></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 },
setup(props, context) {
props.paperData.DetailsList.forEach((item, index) => {
item.myAnswer = [];
});
let data = reactive({
data: props.paperData,
});
let methods = {
changeNumToHan,
jumpPage() {
uni.navigateTo({
url: "/pages/exam/examPaper",
});
},
back() {
uni.navigateBack();
},
//选题
change(index1, index2) {
let myAnswer = data.data.DetailsList[index1].myAnswer;
let res = data.data.DetailsList[index1].QuestionContentObj[index2].Name;
let find = myAnswer.indexOf(res);
if (find == -1) {
myAnswer.push(res);
} else {
myAnswer.splice(find, 1);
}
},
};
onMounted(() => {});
return {
...toRefs(data),
...methods,
};
},
onLoad() {},
};
import {
ref,
reactive,
toRefs,
toRef,
getCurrentInstance,
watch,
computed,
onMounted,
} from "vue";
import {
changeNumToHan
} from "../../utils/index";
export default {
props: {
paperData: Object
},
setup(props, context) {
props.paperData.DetailsList.forEach((item, index) => {
item.myAnswer = [];
});
let data = reactive({
data: props.paperData,
autoplay: false,
Score: 0, //总分
current: 0, //默认从第几个开始-用于从快捷菜单点入
ExamIndex: 1, //第几题
});
let methods = {
changeNumToHan,
jumpPage() {
uni.navigateTo({
url: "/pages/exam/examPaper",
});
},
back() {
uni.navigateBack();
},
//选题
change(index1, index2) {
let myAnswer = data.data.DetailsList[index1].myAnswer;
let res = data.data.DetailsList[index1].QuestionContentObj[index2].Name;
let find = myAnswer.indexOf(res);
if (find == -1) {
myAnswer.push(res);
} else {
myAnswer.splice(find, 1);
}
},
//获取总分
getScore() {
data.Score = 0;
data.data.DetailsList.forEach(x => {
data.Score += x.Score
})
},
onchange(e) {
data.ExamIndex = e.detail.current + 1;
if (data.ExamIndex === data.data.DetailsList.length + 1) {
console.log('进入')
this.$emit('getIndex');
}
}
};
onMounted(() => {
that.getScore();
});
let that = methods;
return {
...toRefs(data),
...methods,
};
},
onLoad() {},
};
</script>
<style scoped>
.name {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 800;
color: #111111;
}
.num {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: bold;
color: #111111;
}
.item {
margin-bottom: 40rpx;
}
.item1 {
margin: 25rpx 0;
align-items: center;
}
.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>
\ No newline at end of file
.name {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 800;
color: #111111;
}
.num {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: bold;
color: #111111;
}
.item {
margin-bottom: 40rpx;
}
.item1 {
margin: 25rpx 0;
align-items: center;
}
.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>
<template>
<!-- 单选题 -->
<view>
<view class="item">
<view class="name"
>{{ changeNumToHan(sort + 1) }}{{ data.GroupName }}</view
>
<view
v-for="(item1, index1) in data.DetailsList"
:key="item1.id"
class="item1"
>
<view class="flex flex_start_center">
<view>{{ index1 + 1 }}</view>
<view class="num" v-html="item1.Title"></view>
</view>
<view
v-for="(item2, index2) in item1.QuestionContentObj"
:key="item2.id"
class="flex item2 flex_start_center"
>
<view
class="chooseNum"
:class="{ myAnswer: item1.myAnswer === item2.Name }"
@click="change(index1, index2)"
>{{ item2.Name }}
</view>
<view
class="chooseName"
@click="change(index1, index2)"
v-html="item2.Content"
></view>
</view>
</view>
</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 },
setup(props, context) {
let { ctx } = getCurrentInstance();
let data = reactive({
data: props.paperData,
});
let methods = {
changeNumToHan,
jumpPage() {
uni.navigateTo({
url: "/pages/exam/examPaper",
});
},
back() {
uni.navigateBack();
},
//选题
change(index1, index2) {
data.data.DetailsList[index1].myAnswer =
data.data.DetailsList[index1].QuestionContentObj[index2].Name;
},
};
return {
...toRefs(data),
...methods,
};
},
};
</script>
<style scoped>
.name {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 800;
color: #111111;
}
.num {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: bold;
color: #111111;
}
.item {
margin-bottom: 40rpx;
}
.item1 {
margin: 25rpx 0;
align-items: center;
}
.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>
\ No newline at end of file
......@@ -41,7 +41,8 @@
</view>
</view>
</swiper-item>
</swiper>
<swiper-item></swiper-item>
</swiper>
</view>
<van-toast id="van-toast" />
</view>
......@@ -100,9 +101,9 @@ export default {
console.log(data.ExamIndex,'index1');
console.log(data.data.DetailsList.length,'index2');
if(data.ExamIndex==data.data.DetailsList.length){
if(data.ExamIndex===data.data.DetailsList.length+1){
console.log('进入')
//this.$emit('getIndex');
this.$emit('getIndex');
}
}
};
......@@ -119,7 +120,7 @@ export default {
};
</script>
<style scoped>
.name {
/* .name {
height: 90rpx;
font-size: 28rpx;
font-family: PingFang SC;
......@@ -128,7 +129,7 @@ export default {
display: flex;
align-items: center;
justify-content: space-between;
}
} */
.Single_Before{
font-size: 28rpx;
font-weight: bold;
......
......@@ -25,14 +25,14 @@
</van-nav-bar>
<view class="exam-con">
<view v-for="(item, index) in peaperDetail.Paper.GroupList" :key="index">
<SingleChoice
<SingleChoiceNumber
:paperData="item"
@getIndex="getIndex()"
:sort="index"
v-if="item.QuestionTypeKey === 'single-number'&&index===changeIndex" />
<MultipleChoice
:paperData="item"
v-if="item.QuestionTypeKey === 'multiple'"
v-if="item.QuestionTypeKey === 'multiple'&&index===changeIndex"
/>
<FillInTheBlanks
:paperData="item"
......@@ -76,7 +76,7 @@ import {
} from "vue";
import { getSystemInfo } from "../../utils/index";
import { getPaperDetail } from "../../api/exam";
import SingleChoice from "../../components/subject/SingleChoice1.vue";
import SingleChoiceNumber from "../../components/subject/SingleChoiceNumber.vue";
import MultipleChoice from "../../components/subject/MultipleChoice.vue";
import FillInTheBlanks from "../../components/subject/FillInTheBlanks";
import Judge from "../../components/subject/judge.vue";
......@@ -85,7 +85,7 @@ import Connect from "../../components/subject/Connect.vue"; //"连线题"
import Sort from "../../components/subject/Sort"; //"排序题"
export default {
components: {
SingleChoice,
SingleChoiceNumber,
MultipleChoice,
FillInTheBlanks,
Judge,
......@@ -148,4 +148,19 @@ export default {
box-sizing: border-box;
padding: 0 30rpx 30rpx;
}
.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;
}
</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