Merge branch 'feature/feature-20250430-h5' of https://e.coding.yili.com/yldc/ylst/ylst-survey-h5 into feature/feature-20250430-h5
This commit is contained in:
@@ -34,7 +34,6 @@ const fileLimit = computed(() => {
|
||||
};
|
||||
});
|
||||
|
||||
console.log(fileLimit.value);
|
||||
/**
|
||||
* 上传文件
|
||||
* @description 上传文件
|
||||
@@ -75,7 +74,7 @@ function handleFileUpload() {
|
||||
// 上传文件
|
||||
|
||||
// 生成答案
|
||||
answer.value = files;
|
||||
question.value.answer = files;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
const answer = ref<FileList>();
|
||||
|
||||
// const answer = ref<FileList>();
|
||||
const answer = ref<FileList | []>([]);
|
||||
/**
|
||||
* 文件限制
|
||||
* @property {number} max - 最大文件大小
|
||||
|
||||
@@ -650,6 +650,12 @@ async function answer(callback, callbackBeforePage) {
|
||||
// 表单验证(当前页)
|
||||
const errors = questions.value.filter((question) => {
|
||||
const { config, answer, question_type: questionType, error } = question;
|
||||
|
||||
console.log(answer, questionType, error);
|
||||
// 单独 处理 图文
|
||||
if (questionType === 6) {
|
||||
return;
|
||||
}
|
||||
let isError = false;
|
||||
// 如果问题没有答案还有是必须填空的,就往下处理
|
||||
// 2025/4/1新增 : 如果有 error 内容, 同样视为有错误
|
||||
@@ -687,6 +693,13 @@ async function answer(callback, callbackBeforePage) {
|
||||
question.error = translatedText.value.PleaseInputAValue;
|
||||
} else if (answer && questionType === 2) {
|
||||
// 多选题
|
||||
// 选项数量
|
||||
|
||||
console.log(translatedText.value);
|
||||
// isError = true;
|
||||
// question.error = translatedText.value.PleaseSelectAtLeastOneOptions(
|
||||
// config.min_select ? config.min_select : 0
|
||||
// );
|
||||
} else if (answer && questionType === 10) {
|
||||
// 矩阵多选题
|
||||
} else if (answer && questionType === 12) {
|
||||
@@ -701,7 +714,9 @@ async function answer(callback, callbackBeforePage) {
|
||||
if (Object.keys(answer).length < (+config.min_select || 0)) {
|
||||
// 选项数量
|
||||
isError = true;
|
||||
question.error = translatedText.value.PleaseSelectAtLeastOneOptions(config.min_select);
|
||||
question.error = translatedText.value.PleaseSelectAtLeastOneOptions(
|
||||
config.min_select ? config.min_select : 0
|
||||
);
|
||||
}
|
||||
} else if (answer && questionType === 17) {
|
||||
// 恒定总和题
|
||||
|
||||
@@ -3,16 +3,17 @@ import FileUpload from '@/views/Design/components/Questions/FileUpload.vue';
|
||||
const questionIndex = defineModel<number>('questionIndex', { default: NaN });
|
||||
const answerIndex = computed(() => question.value.title);
|
||||
const question = defineModel<question>('question', { default: () => {} });
|
||||
import { answer } from '@/views/Design/components/Questions/hooks/useFileUploadHooks';
|
||||
// import { answer } from '@/views/Design/components/Questions/hooks/useFileUploadHooks';
|
||||
import { computed, watch } from 'vue';
|
||||
|
||||
const emit = defineEmits(['changeAnswer']);
|
||||
watch(answer, () => {
|
||||
// 暂时先将答案挂到 question,后续需要优化
|
||||
question.value.answer = answer.value;
|
||||
// emit('changeAnswer', answer.value);
|
||||
// console.log(`question`, question.value);
|
||||
});
|
||||
// watch(answer, () => {
|
||||
// // 暂时先将答案挂到 question,后续需要优化
|
||||
// question.value.answer = answer.value;
|
||||
// console.log(question.value.answer);
|
||||
// // emit('changeAnswer', answer.value);
|
||||
// // console.log(`question`, question.value);
|
||||
// });
|
||||
</script>
|
||||
<template>
|
||||
<!-- 文件上传题 -->
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import TextWithImages from '@/views/Design/components/Questions/TextWithImages.vue';
|
||||
import { computed } from 'vue';
|
||||
import { computed, watch } from 'vue';
|
||||
|
||||
// 问题
|
||||
const question = defineModel<question>('question', { default: {} });
|
||||
// question 序号
|
||||
const answerIndex = computed(() => question.value?.title ?? 0);
|
||||
// 答案
|
||||
const answer = defineModel('answer', { default: {} });
|
||||
const answer = defineModel('answer');
|
||||
// answer 提供默认值
|
||||
answer.value = {};
|
||||
question.value.answer = '123';
|
||||
|
||||
watch(
|
||||
answer,
|
||||
(v) => {
|
||||
console.log(v, 'sd');
|
||||
console.log(question.value.answer, 'sd');
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
|
||||
// setTimeout(() => {
|
||||
// answer.value = '123';
|
||||
// }, 300);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user