fix: 修复某些组件页面重复进入无法正常预览的问题

- 修复单选、打分、NPS无法正常预览的问题
This commit is contained in:
Huangzhe
2025-03-21 16:45:36 +08:00
parent 18375e5b31
commit 9d1dd8a1f8
6 changed files with 6 additions and 17 deletions

View File

@@ -20,7 +20,7 @@
</contenteditable> </contenteditable>
</template> </template>
<template #input> <template #input>
<template v-for="item /*optionIndex*/ in element.options" :key="item.id"> <template v-for="item /*optionIndex*/ in element.list ?? element.options" :key="item.id">
<van-radio-group v-if="element.question_type === 1" v-model="choiceValue"> <van-radio-group v-if="element.question_type === 1" v-model="choiceValue">
<option-action <option-action
:data="isPreview ? item.options : item" :data="isPreview ? item.options : item"

View File

@@ -20,7 +20,7 @@
</template> </template>
<template #input> <template #input>
<div <div
v-for="(optionItem, optionItemIndex) in isPreview ? element.list : element.options" v-for="(optionItem, optionItemIndex) in element.list ?? element.options"
:key="optionItemIndex" :key="optionItemIndex"
class="rate-content" class="rate-content"
> >

View File

@@ -20,7 +20,7 @@
</template> </template>
<template #input> <template #input>
<div <div
v-for="(optionItem, optionItemIndex) in element.options" v-for="(optionItem, optionItemIndex) in element.list ?? element.options"
:key="optionItemIndex" :key="optionItemIndex"
class="rate-content" class="rate-content"
> >
@@ -53,7 +53,7 @@
</template> </template>
<script setup> <script setup>
import { defineModel, ref, watch } from 'vue'; import { defineModel, ref } from 'vue';
import RateCharacter from './RateCharacter.vue'; import RateCharacter from './RateCharacter.vue';
/** /**
@@ -63,6 +63,7 @@ const element = defineModel('element', {
type: Object, type: Object,
required: true required: true
}); });
// 答案数值 // 答案数值
const answerValue = defineModel('answerValue', { const answerValue = defineModel('answerValue', {
default: () => [], default: () => [],

View File

@@ -563,7 +563,6 @@ const {
translatedText translatedText
} = storeToRefs(questionStore); } = storeToRefs(questionStore);
// console.log(`questionsData`, questions.value);
const props = defineProps({ const props = defineProps({
isTemplate: { isTemplate: {
type: Boolean, type: Boolean,
@@ -589,7 +588,6 @@ async function getQuestions() {
} }
}); });
data = data.data; data = data.data;
// console.log(`response data: `, data);
// 多语言 // 多语言
data.languageType = [ data.languageType = [
data?.survey?.style?.is_en_tips ? 'en' : '', data?.survey?.style?.is_en_tips ? 'en' : '',

View File

@@ -18,14 +18,7 @@ const value = ref<number[]>([]);
// // 预览新增 emit ['changeAnswer', 'previous', 'next'] // // 预览新增 emit ['changeAnswer', 'previous', 'next']
const emit = defineEmits(['changeAnswer', 'previous', 'next', 'update:element']); const emit = defineEmits(['changeAnswer', 'previous', 'next', 'update:element']);
const question = defineModel<question>('question', { default: { config: { is_required: false } } }); const question = defineModel<question>('question', { default: { config: { is_required: false } } });
initData();
function initData() {
if (question.value?.options) {
// question.value?.list = question.value?.options;
} else if (question.value.list.length) {
question.value.options = question.value.list;
}
}
/** /**
* answer 的答案类型 * answer 的答案类型
* { * {

View File

@@ -1,3 +0,0 @@
import imgUrl from '@/assets/img/create-right-back.png';
export { imgUrl };