1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <template>
- <view v-if="question" class="phone-yuedu-box">
- <view class="phone-shiti-question">
- <view class="question-num">{{question.onlyNum}}、</view>
- <!-- 题干区域 -->
- <!-- <rich-text :nodes="question.name"></rich-text> -->
- </view>
- <!-- 选项区域 -->
- <view class="yuedu-option-box">
- <swiper class="swiper-box" @change="onSwitchChange" :current="swiperDotIndex">
- <swiper-item v-for="(item,index) in data.content" :key="index">
- {{item}}
- <view class="swiper-item" :class="'swiper-item' + index" style="height: 300rpx;background-color: #ccc;">
- <template v-if="item.stTypeId == 1">
- <!-- 单选 -->
- <danxuan :question="item" :key="item.stId"></danxuan>
- </template>
- <template v-if="item.stTypeId == 2">
- <!-- 多选 -->
- <duoxuan :question="item" :key="item.stId"></duoxuan>
- </template>
- <template v-if="item.stTypeId == 3">
- <!-- 判断 -->
- <panduan :question="item" :key="item.stId"></panduan>
- </template>
- <template v-if="item.stTypeId == 4">
- <!-- 填空 -->
- <tiankong :question="item" :key="item.stId"></tiankong>
- </template>
- <template v-if="item.stTypeId == 5">
- <!-- 简答 -->
- <jianda :question="item" :key="item.stId"></jianda>
- </template>
- </view>
- </swiper-item>
- </swiper>
- </view>
- </view>
- </template>
- <script setup>
- import {
- reactive,
- watch,
- ref
- } from 'vue';
- import danxuan from "@/components/questions/danxuan.vue";
- import duoxuan from "@/components/questions/duoxuan.vue";
- import tiankong from "@/components/questions/tiankong.vue";
- import panduan from "@/components/questions/panduan.vue";
- import jianda from "@/components/questions/jianda.vue";
- const props = defineProps({
- question: {
- type: Object,
- },
- showError: {
- type: Boolean,
- default: false
- }
- })
- const data = reactive({
- content: []
- })
- const swiperDotIndex = ref(0);
- watch(() => props.question, (question) => {
- data.content = [...question.danxuan, ...question.duoxuan, ...question.panduan, ...question.tiankong, ...
- question.jianda
- ];
- data.content.map((item,index) => {
- item.onlyNum = index+1;
- return item
- })
- }, {
- immediate: true
- })
- function onSwitchChange(e) {
- console.log('eeee', e)
- }
- </script>
- <style lang="scss">
- .swiper-item {
- height: 200px;
- }
- </style>
|