Merge remote-tracking branch 'origin/feature/feature-20250331-h5' into feature/feature-20250331-h5

This commit is contained in:
陈昱达
2025-03-06 17:39:57 +08:00
13 changed files with 993 additions and 451 deletions

View File

@@ -1,46 +1,33 @@
<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 === 9"
:element="element"
:active="chooseQuestionId === element.id"
v-if="element.question_type === 8 || element.question_type === 9 || element.question_type === 10"
:element="element" :active="chooseQuestionId === element.id"
/>
<!-- 打分题 -->
<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"
/>
@@ -55,11 +42,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>
@@ -75,11 +58,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>
@@ -168,6 +148,21 @@ const actionOptions = [
fun: 'radioAddOption'
}
]
}, {
question_type: [8, 9, 10],
// 矩阵问卷逻辑处理
actions: [
{
label: '添加行标签',
icon: 'add',
fun: 'addMatrixRowOption'
},
{
label: '添加列标签',
icon: 'add',
fun: 'addMatrixColumnOption'
}
]
}
];
// 事件分发
@@ -197,6 +192,23 @@ const actionFun = {
});
});
element.last_option_index += 1;
},
/**
* martrix 矩阵行数增加
* @param element {import('./components/Questions/types/martrix.js').MatrixSurveyQuestion}
*/
addMatrixRowOption: (element) => {
element.options[0].push({
option: '新增行'
});
},
/**
* martrix 矩阵列数增加
* @param element {import('./components/Questions/types/martrix.js').MatrixSurveyQuestion}
*/
addMatrixColumnOption: (element) => {
element.options[1].push({ option: '新增列' });
}
};
@@ -215,7 +227,7 @@ onMounted(() => {
color: #333;
.slot-actions {
& .action-item + .action-item {
& .action-item+.action-item {
margin-left: 10px;
}
}