feat: 增加签名问卷的支持

- 增加 SignQuestion 组件
- 增加响应的内容数据
- 在 Index 页面正常挂载组件显示
This commit is contained in:
Huangzhe
2025-03-07 11:37:23 +08:00
parent 5686c295e1
commit dbe96cad56
3 changed files with 285 additions and 37 deletions

View File

@@ -1,57 +1,49 @@
<template>
<div class="design-create">
<draggable
v-model:data="questionInfo.questions"
item-key="id"
handle=".moverQues"
chosenClass="chosen"
animation="300"
:scroll="true"
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"
:element="element" :questions="questionInfo.questions" :index="index"
:chooseQuestionId="chooseQuestionId" @get-choose-question-id="getChooseQuestionId"
>
<!-- 选择题 -->
<Choice
v-if="element.question_type === 1 || element.question_type === 2"
:element="element"
v-if="element.question_type === 1 || element.question_type === 2" :element="element"
:active="chooseQuestionId === element.id"
></Choice>
<!-- 填空题 -->
<Completion
v-if="element.question_type === 4"
:element="element"
:active="chooseQuestionId === element.id"
v-if="element.question_type === 4" :element="element" :active="chooseQuestionId === element.id"
sn="lXEBBpE2"
></Completion>
<!-- 矩阵题 -->
<martrix-question
v-if="
element.question_type === 8 ||
element.question_type === 9 ||
element.question_type === 10
"
:element="element"
:active="chooseQuestionId === element.id"
element.question_type === 9 ||
element.question_type === 10
" :element="element" :active="chooseQuestionId === element.id"
/>
<!-- 签名题 -->
<sign-question
v-if="element.question_type === 22" :element="element"
:active="chooseQuestionId === element.id"
></sign-question>
<!-- 打分题 -->
<Rate
v-if="element.question_type === 5"
:element="element"
:active="chooseQuestionId === element.id"
v-if="element.question_type === 5" :element="element" :active="chooseQuestionId === element.id"
sn="lXEBBpE2"
/>
<!--图文-->
<TextWithImages
v-if="element.question_type === 6"
:element="element"
v-if="element.question_type === 6" :element="element"
:active="chooseQuestionId === element.id"
/>
@@ -59,11 +51,7 @@
<template #action="{ element: el }">
<div class="flex slot-actions">
<template v-for="(item, optionIndex) in actionOptions">
<div
v-if="item.question_type.includes(el.question_type)"
:key="optionIndex"
class="flex"
>
<div v-if="item.question_type.includes(el.question_type)" :key="optionIndex" class="flex">
<template v-for="(act, actIndex) in item.actions" :key="actIndex">
<div class="flex align-center action-item" @click="actionEvent(act, el)">
<van-icon :name="act.icon"></van-icon>
@@ -79,11 +67,8 @@
<!-- {{ 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=""
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>
@@ -102,6 +87,7 @@ import Completion from './components/Questions/Completion.vue';
import MartrixQuestion from './components/Questions/MartrixQuestion.vue';
import Rate from './components/Questions/Rate.vue';
import TextWithImages from '@/views/Design/components/Questions/TextWithImages.vue';
import SignQuestion from './components/Questions/SignQuestion.vue';
const activeIndex = ref(-1);
/**
@@ -252,7 +238,7 @@ onMounted(() => {
color: #333;
.slot-actions {
& .action-item + .action-item {
& .action-item+.action-item {
margin-left: 10px;
}
}