From 966e56ad749b2c337fc681606b2c711a0b85a50a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=98=B1=E8=BE=BE?= Date: Wed, 28 May 2025 23:19:14 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=A0=B7=E5=BC=8F):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=BE=93=E5=85=A5=E6=A1=86=E6=A0=B7=E5=BC=8F=E5=92=8C?= =?UTF-8?q?=E7=9F=A9=E9=98=B5=E6=96=87=E6=9C=AC=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整了 main.scss 和 public.scss 中的样式 -重构了 MatrixText 组件,支持数字和文本输入 - 优化了 Completion 组件的默认值设置 - 修改了验证逻辑,允许空值作为有效答案 --- src/assets/css/main.scss | 2 +- src/assets/css/public.scss | 9 + src/main.ts | 2 +- .../components/Questions/Completion.vue | 2 +- .../components/Questions/MatrixText.vue | 72 ++++++- src/views/Survey/views/Preview/Index.vue | 197 +++++++++++------- .../questions/PreviewCompletion.vue | 15 +- .../validate/validateStringLength.ts | 2 +- 8 files changed, 206 insertions(+), 95 deletions(-) diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index 980fd45..b06f073 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -51,7 +51,7 @@ a, top: 0; width: 100%; // background-color: linear-gradient(to bottom, theme.$theme-color 200px, theme.$nav-color 300px); - background: url("../img/home/nav.png") theme.$nav-color; + background: url('../img/home/nav.png') theme.$nav-color; color: #000; & .van-nav-bar__content { diff --git a/src/assets/css/public.scss b/src/assets/css/public.scss index 9bcf277..5c70206 100644 --- a/src/assets/css/public.scss +++ b/src/assets/css/public.scss @@ -300,3 +300,12 @@ input { background: linear-gradient(180deg, #e8fad7 0%, #ffffff 8%); } //background: linear-gradient( 180deg, #E8FAD7 0%, #FFFFFF 100%); + +.el-input-number__decrease, +.el-input-number__increase { + display: none; +} +.el-input-number .el-input__wrapper, +.el-input-number.is-controls-right .el-input__wrapper { + padding: 0; +} diff --git a/src/main.ts b/src/main.ts index 2c73458..78209e3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,7 +12,7 @@ import appBridge from '@/assets/js/appBridge'; import VConsole from 'vconsole'; import './assets/css/main.scss'; // 引入 swiper 样式 -import 'swiper/css'; +import 'swiper/css'; import 'swiper/css/navigation'; import 'swiper/css/pagination'; diff --git a/src/views/Design/components/Questions/Completion.vue b/src/views/Design/components/Questions/Completion.vue index 6066075..49fef7d 100644 --- a/src/views/Design/components/Questions/Completion.vue +++ b/src/views/Design/components/Questions/Completion.vue @@ -58,7 +58,7 @@ import { toRefs, watch } from 'vue'; import { ElInputNumber } from 'element-plus'; import { showFailToast } from 'vant'; -const completionValue = defineModel('completionValue', { default: null, type: String }); +const completionValue = defineModel('completionValue', { default: '', type: String }); const props = defineProps({ isPreview: { type: Boolean, diff --git a/src/views/Design/components/Questions/MatrixText.vue b/src/views/Design/components/Questions/MatrixText.vue index 5a72c41..981a6a9 100644 --- a/src/views/Design/components/Questions/MatrixText.vue +++ b/src/views/Design/components/Questions/MatrixText.vue @@ -1,16 +1,40 @@ diff --git a/src/views/Survey/views/Preview/components/questions/validate/validateStringLength.ts b/src/views/Survey/views/Preview/components/questions/validate/validateStringLength.ts index 75f5dea..9e696e9 100644 --- a/src/views/Survey/views/Preview/components/questions/validate/validateStringLength.ts +++ b/src/views/Survey/views/Preview/components/questions/validate/validateStringLength.ts @@ -22,7 +22,7 @@ export function validateMinLength( // 如果包含相应的 text_type, 也不处理,1是整数,2是小数 if ([1, 2].includes(config.text_type)) return; - if (answer.length > Number(config.min)) return; + if (answer.length >= Number(config.min)) return; return { isError: true, errorMessage: translatedText.PleaseEnterMoreCharacters(config.min)