Commit 93166c73 authored by 罗超's avatar 罗超

1

parent 84d9d98c
<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"
<template v-if="item1.QuestionContentObj[1]&& item1.QuestionContentObj[1].length>0"> :autoplay="autoplay"
<view class="num">(1)</view> :current="current"
<view class="num">-({{item1.QuestionContentObj[1].length}})题共用备选答案:</view> @change="onchange"
</template> >
</view> <swiper-item v-if="sortIndex != 1"></swiper-item>
<template v-if="item1.QuestionContentObj[0]&&item1.QuestionContentObj[0].length>0"> <swiper-item
<view v-for="(item2, index2) in item1.QuestionContentObj[0]" :key="index2"> v-for="(item1, index1) in data.DetailsList"
<view class="flex item2 flex_start_center"> :key="item1.id"
<view class="num">{{item2.Name}}</view> >
<view style="margin-left:5px;" class="chooseName" v-html="item2.Content"></view> <view class="item1">
</view> <view class="flex flex_start_center">
</view> <template
</template> v-if="
<template v-if="item1.QuestionContentObj[1]&&item1.QuestionContentObj[1].length>0"> item1.QuestionContentObj[1] &&
<view v-for="(item3, index3) in item1.QuestionContentObj[1]" :key="index3"> item1.QuestionContentObj[1].length > 0
<view class="flex item2 flex_start_center"> "
<view>{{index3+1}}</view> >
<view v-html="item3.Content"></view> <view class="num">(1)</view>
</view> <view class="num"
<van-button type="primary" @click="alertMenu(item3)">弹出菜单</van-button> >-({{
{{item3.isShow}} item1.QuestionContentObj[1].length
<van-action-sheet :value="item3.isShow" :actions="item1.QuestionContentObj[0]" @select="onSelect"/> }})题共用备选答案:</view
</view> >
</template> </template>
</view> </view>
</swiper-item> <template
<swiper-item v-if="sortIndex != sortTotal"></swiper-item> v-if="
</swiper> item1.QuestionContentObj[0] &&
</view> item1.QuestionContentObj[0].length > 0
<van-toast id="van-toast" /> "
</view> >
<view
v-for="(item2, index2) in item1.QuestionContentObj[0]"
:key="index2"
>
<view class="flex item2 flex_start_center">
<view class="num">{{ item2.Name }}</view>
<view
style="margin-left: 5px"
class="chooseName"
v-html="item2.Content"
></view>
</view>
</view>
</template>
<template
v-if="
item1.QuestionContentObj[1] &&
item1.QuestionContentObj[1].length > 0
"
>
<view
v-for="(item3, index3) in item1.QuestionContentObj[1]"
:key="index3"
>
<view class="flex item2 flex_start_center">
<view>{{ index3 + 1 }}</view>
<view v-html="item3.Content"></view>
</view>
<van-button type="primary" @click="alertMenu(item3)"
>弹出菜单</van-button
>
{{ item3.isShow }}
<van-action-sheet
:value="item3.isShow"
:actions="item1.QuestionContentObj[0]"
@select="onSelect"
/>
</view>
</template>
</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) { if (props.paperData.DetailsList && props.paperData.DetailsList.length > 0) {
let {ctx} = getCurrentInstance(); props.paperData.DetailsList[0].QuestionContentObj[1].forEach(
if(props.paperData.DetailsList&&props.paperData.DetailsList.length>0){ (item, index) => {
props.paperData.DetailsList[0].QuestionContentObj[1].forEach((item, index) => { item.isShow = false;
item.isShow=false; }
}); );
} }
console.log(props.paperData,'paperData'); console.log(props.paperData, "paperData");
let data = reactive({ let data = reactive({
data: props.paperData, data: props.paperData,
autoplay: false, autoplay: false,
sortIndex: props.sort + 1, sortIndex: props.sort + 1,
sortTotal: props.sortTotal, sortTotal: props.sortTotal,
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();
}, },
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");
} }
}, },
alertMenu(item){ alertMenu(item) {
item.isShow=true; item.isShow = true;
this.$forceUpdate(); this.$forceUpdate();
console.log(item,'item'); console.log(item, "item");
}, },
onSelect(item){ onSelect(item) {
console.log(item); console.log(item);
// this.show = false; // this.show = false;
// this.$toast({ // this.$toast({
// message:item.name, // message:item.name,
// duration:500 // duration:500
// }) // })
}, },
}; };
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>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<view> <view>
<view class="item" style="padding: 0 20px"> <view class="item" style="padding: 0 20px">
<view class="name"> <view class="name">
<view> <view class="grow">
{{ 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
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
<text class="Single_Before">{{ ExamIndex }}</text <text class="Single_Before">{{ ExamIndex }}</text
>/<text class="Exam_Total">{{ data.DetailsList.length }}</text> >/<text class="Exam_Total">{{ data.DetailsList.length }}</text>
</view> </view>
<i
class="iconfont icon-caidanzu answerSheet"
@click="jumpAnswerSheet"
></i>
</view> </view>
<swiper <swiper
class="swiper-box" class="swiper-box"
...@@ -120,6 +124,11 @@ export default { ...@@ -120,6 +124,11 @@ export default {
this.$emit("getBeforeTopic"); this.$emit("getBeforeTopic");
} }
}, },
jumpAnswerSheet() {
uni.navigateTo({
url: "/pages/exam/answerSheet",
});
},
}; };
onMounted(() => { onMounted(() => {
if (props.isLast) { if (props.isLast) {
...@@ -157,6 +166,12 @@ export default { ...@@ -157,6 +166,12 @@ export default {
color: gray; color: gray;
} }
.answerSheet {
font-size: 30rpx;
margin-left: 20rpx;
color: #000;
}
.swiper-box { .swiper-box {
height: calc(100vh - 270rpx); height: calc(100vh - 270rpx);
box-sizing: border-box; box-sizing: border-box;
......
<template> <template>
<view class="answer-sheets"> <view class="answer-sheets">
<view v-for="(item, index) in questionList" :key="index" class="item"> <view v-for="(item, index) in questionList" :key="index" class="item">
<view class="name">{{ item.name }}</view> <view class="name">
<view {{ changeNumToHan(index + 1) }}{{ item.GroupName }}</view
v-for="(item1, index1) in item.children"
:key="item1.id"
class="flex item1"
> >
<view class="num">{{ item1.num }}</view> <view class="flex flex_wrap">
<view <view
v-for="(item2, index2) in item1.children" v-for="(item1, index1) in item.DetailsList"
:key="item2.id" :key="index1"
class="item2" class="flex item1"
:class="{ choose: item1.choose === item2 }"
@click="change(item.type, index, index1, index2)"
v-if="item.type === 1"
> >
{{ item2 }} {{ index1 + 1 }}
</view>
<view
v-for="(item2, index2) in item1.children"
:key="item2.id"
class="item2"
:class="{ choose: item1.choose.find((e) => e == item2) }"
@click="change(item.type, index, index1, index2)"
v-if="item.type === 2"
>
{{ item2 }}
</view> </view>
</view> </view>
</view> </view>
...@@ -45,74 +29,29 @@ import { ...@@ -45,74 +29,29 @@ import {
computed, computed,
onMounted, onMounted,
} from "vue"; } from "vue";
import { getPaperDetail } from "../../api/exam";
import { changeNumToHan } from "../../utils/index";
export default { export default {
setup() { setup() {
let Gid = uni.getStorageSync("userInfo").Id;
let data = reactive({ let data = reactive({
questionList: [ msg: { GuestId: Gid, PaperId: 5, PublishId: 1 },
{ questionList: [],
name: "一、单选题",
type: 1,
children: [
{
num: 1,
choose: 1,
children: [1, 2, 3, 4, 5],
},
{
num: 2,
choose: 0,
children: [1, 2, 3, 4, 5],
},
{
num: 3,
choose: 0,
children: [1, 2, 3, 4, 5],
},
],
},
{
name: "二、多选题",
type: 2,
children: [
{
num: 1,
choose: [1, 2],
children: [1, 2, 3, 4, 5],
},
{
num: 2,
choose: [],
children: [1, 2, 3, 4, 5],
},
{
num: 3,
choose: [],
children: [1, 2, 3, 4, 5],
},
],
},
],
}); });
let methods = { let methods = {
changeNumToHan,
jumpPage() { jumpPage() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/exam/examPaper", url: "/pages/exam/examPaper",
}); });
}, },
//选题 //选题
change(type, index, index1, index2) { change(type, index, index1, index2) {},
if (type === 1) { async getPaperDetail() {
data.questionList[index].children[index1].choose = let res = await getPaperDetail(data.msg);
data.questionList[index].children[index1].children[index2]; if (res) {
} else if (type === 2) { data.questionList = res.Data.Paper.GroupList;
let choose = data.questionList[index].children[index1].choose; console.log(90, res.Data.Paper.GroupList);
let res = data.questionList[index].children[index1].children[index2];
let find = choose.indexOf(res);
if (find == -1) {
choose.push(res);
} else {
choose.splice(find, 1);
}
} }
}, },
}; };
...@@ -125,6 +64,7 @@ export default { ...@@ -125,6 +64,7 @@ export default {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: "答题卡", title: "答题卡",
}); });
this.getPaperDetail();
}, },
}; };
</script> </script>
...@@ -149,8 +89,17 @@ export default { ...@@ -149,8 +89,17 @@ export default {
margin-bottom: 40rpx; margin-bottom: 40rpx;
} }
.item1 { .item1 {
margin: 25rpx 0; width: 44rpx;
align-items: center; height: 44rpx;
background-color: #00acf9;
border-radius: 50%;
margin: 22rpx;
text-align: center;
line-height: 44rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: bold;
color: #111111;
} }
.item2 { .item2 {
width: 44rpx; width: 44rpx;
......
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