feat: 增加矩阵问题的组件
- 增加 MartrixQuestion 组件 - 增加对应测试数据
This commit is contained in:
@@ -1,43 +1,24 @@
|
||||
<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">
|
||||
<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>
|
||||
|
||||
<martrix-question v-if="element.question_type === 9" :element="element"
|
||||
:active="chooseQuestionId === element.id" />
|
||||
|
||||
</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>
|
||||
@@ -51,12 +32,12 @@ import BaseSelect from './components/Questions/BaseSelect.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';
|
||||
const activeIndex = ref(-1);
|
||||
/**
|
||||
* 工具函数
|
||||
*/
|
||||
function util() {
|
||||
function util () {
|
||||
/** 通过id找到数组中对应的下标 */
|
||||
const getIndexById = (arr, id) => arr.findIndex((i) => i.id === id);
|
||||
/** 通过分页找到数组中对应的下标 */
|
||||
|
||||
Reference in New Issue
Block a user