Merge branch 'feature/feature-20250331-h5' of https://e.coding.yili.com/yldc/ylst/ylst-survey-h5 into feature/feature-20250331-h5

This commit is contained in:
Huangzhe
2025-03-05 17:18:52 +08:00
16 changed files with 1373 additions and 221 deletions

View File

@@ -1,24 +1,60 @@
<template>
<div class="design-create">
<draggable v-model:data="questionInfo.questions" item-key="id" handle=".moverQues" chosenClass="chosen"
animation="300" :scroll="true">
<draggable
v-model:data="questionInfo.questions"
item-key="id"
handle=".moverQues"
chosenClass="chosen"
animation="300"
:scroll="true"
>
<template #item="{ element, index }">
<choose-question :element="element" :questions="questionInfo.questions" :index="index"
:chooseQuestionId="chooseQuestionId" @get-choose-question-id="getChooseQuestionId">
<base-select v-if="element.question_type === 1" :element="element"
:active="chooseQuestionId === element.id"></base-select>
<Completion v-if="element.question_type === 4" :element="element" :active="chooseQuestionId === element.id"
sn="lXEBBpE2"></Completion>
<choose-question
:element="element"
:questions="questionInfo.questions"
:index="index"
:chooseQuestionId="chooseQuestionId"
@get-choose-question-id="getChooseQuestionId"
>
<!-- 选择题 -->
<Choice
v-if="element.question_type === 1"
:element="element"
:active="chooseQuestionId === element.id"
></Choice>
<!-- 填空题 -->
<Completion
v-if="element.question_type === 4"
:element="element"
:active="chooseQuestionId === element.id"
sn="lXEBBpE2"
></Completion>
<martrix-question v-if="element.question_type === 9" :element="element"
:active="chooseQuestionId === element.id" />
<martrix-question
v-if="element.question_type === 9"
:element="element"
:active="chooseQuestionId === element.id"
/>
<!-- 打分题 -->
<Rate
v-if="element.question_type === 5"
:element="element"
:active="chooseQuestionId === element.id"
sn="lXEBBpE2"
/>
<!-- @update="updateHandle" -->
</choose-question>
<!-- {{ element.question_type }}-->
<!-- {{questionInfo.survey.pages.length}}-->
<paging v-if="!element.question_type && questionInfo.survey.pages.length > 1" :info="element" :index="index"
:active="pageIsActive(activeIndex, questionInfo.questions, element.page)" @click.stop="" />
<paging
v-if="!element.question_type && questionInfo.survey.pages.length > 1"
:info="element"
:index="index"
:active="pageIsActive(activeIndex, questionInfo.questions, element.page)"
@click.stop=""
/>
</template>
</draggable>
</div>
@@ -28,16 +64,18 @@ import { ref, onMounted } from 'vue';
import { useCounterStore } from '@/stores/counter';
import { storeToRefs } from 'pinia';
import Draggable from './components/Draggable.vue';
import BaseSelect from './components/Questions/BaseSelect.vue';
import Choice from './components/Questions/Choice.vue';
import ChooseQuestion from './components/ChooseQuestion.vue';
import Paging from './components/Questions/paging/Paging.vue';
import Completion from './components/Questions/Completion.vue';
import MartrixQuestion from './components/Questions/MartrixQuestion.vue';
import Rate from './components/Questions/Rate.vue';
const activeIndex = ref(-1);
/**
* 工具函数
*/
function util () {
function util() {
/** 通过id找到数组中对应的下标 */
const getIndexById = (arr, id) => arr.findIndex((i) => i.id === id);
/** 通过分页找到数组中对应的下标 */