From b33b620b2ebe672871fae53bb78fd3d7b5c943da Mon Sep 17 00:00:00 2001 From: wangxiangwen <1906413238@qq.com> Date: Thu, 24 Jul 2025 13:55:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=89=80=E6=9C=89=E5=B0=8F=E6=95=B0?= =?UTF-8?q?=E7=82=B9=E4=B8=8D=E8=83=BD=E8=BE=93=E5=85=A5=E5=A4=84=E7=90=86?= =?UTF-8?q?+=E8=AE=BE=E7=BD=AE=E6=95=B0=E6=8D=AE=E8=B4=9F=E6=95=B0?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/zhongchou/activity/index.vue | 2 +- .../src/views/zhongchou/activity/set/index.vue | 138 ++++++++++++++++----- activitylink/src/views/zhongchou/level/index.vue | 77 +++++++++--- 3 files changed, 173 insertions(+), 44 deletions(-) diff --git a/activitylink/src/views/zhongchou/activity/index.vue b/activitylink/src/views/zhongchou/activity/index.vue index b5fbc6a..372a885 100644 --- a/activitylink/src/views/zhongchou/activity/index.vue +++ b/activitylink/src/views/zhongchou/activity/index.vue @@ -240,7 +240,6 @@ const addActivity = async () => { }); if (!valid) { - ElMessage.warning('请填写完整表单'); return; } @@ -259,6 +258,7 @@ const addActivity = async () => { if (response.code === 200) { ElMessage.success('活动添加成功'); centerDialogVisible.value = false; + resetForm(); fetchActivityList(); } else { ElMessage.error(response.message || '活动添加失败'); diff --git a/activitylink/src/views/zhongchou/activity/set/index.vue b/activitylink/src/views/zhongchou/activity/set/index.vue index 2bb33be..06c5432 100644 --- a/activitylink/src/views/zhongchou/activity/set/index.vue +++ b/activitylink/src/views/zhongchou/activity/set/index.vue @@ -10,35 +10,34 @@
-
- -   分钟 -      - 确认 -
-
{{ initialData }}分钟
+
{{ initialData }}分钟
- -
- - -      - 确认 -      - -
- - -
- - -      - 确认 -      - -
+ +
+ + + 确认 + +
+ + +
+ + + 确认 + +
- + @@ -132,7 +131,62 @@ const marketTwoName = ref(''); // } // }; +const timerOne = ref(null); +const timerTwo = ref(null); + +const handleIntegerInput1 = (value) => { + // 清除之前的定时器 + if (timerOne.value) { + clearTimeout(timerOne.value); + } + + // 1. 替换所有非数字和非负号的字符 + let filtered = value.replace(/[^-0-9]/g, ''); + // 2. 如果以负号开头,只保留第一个负号,其余负号删除 + if (filtered.includes('-')) { + const firstChar = filtered[0]; + const rest = filtered.slice(1).replace(/-/g, ''); // 删除其余负号 + filtered = firstChar === '-' ? '-' + rest : rest; + } + + // 3. 如果是单独的 '-',设置延迟校验 + if (filtered === '-') { + timerOne.value = setTimeout(() => { + addCountOne.value = ''; + timerOne.value = null; + }, 1000); // 延迟200ms + } else { + // 4. 更新绑定值 + addCountOne.value = filtered; + } +}; + +const handleIntegerInput2 = (value) => { + // 清除之前的定时器 + if (timerTwo.value) { + clearTimeout(timerTwo.value); + } + + // 同上逻辑 + let filtered = value.replace(/[^-0-9]/g, ''); + + if (filtered.includes('-')) { + const firstChar = filtered[0]; + const rest = filtered.slice(1).replace(/-/g, ''); + filtered = firstChar === '-' ? '-' + rest : rest; + } + + // 如果是单独的 '-',设置延迟校验 + if (filtered === '-') { + timerTwo.value = setTimeout(() => { + addCountTwo.value = ''; + timerTwo.value = null; + }, 1000); // 延迟200ms + } else { + addCountTwo.value = filtered; + } +}; const fetchData = async () => { try { // ✅ 修改传参方式为对象 @@ -382,6 +436,34 @@ const goBack = () => { flex: 0 0 auto; } +.setting-item { + display: flex; + align-items: center; + margin-bottom: 25px; +} + +.fixed-label { + width: 250px; /* 固定宽度 */ + text-align: left; /* 右对齐,更美观 */ + margin-right: 20px; /* 固定间距 */ + white-space: nowrap; /* 防止换行 */ +} + +.fixed-input { + width: 230px; /* 固定宽度 */ + margin-right: 30px; /* 固定间距 */ +} + +.fixed-button { + margin-right: 20px; /* 固定间距 */ +} + +/* 确保最后一个 label 不需要右边距 */ +.setting-item .fixed-label:last-child { + margin-right: 0; +} + + h3 { font-size: 1.8rem; margin-bottom: 20px; diff --git a/activitylink/src/views/zhongchou/level/index.vue b/activitylink/src/views/zhongchou/level/index.vue index 1fd1884..9d720e0 100644 --- a/activitylink/src/views/zhongchou/level/index.vue +++ b/activitylink/src/views/zhongchou/level/index.vue @@ -43,16 +43,28 @@ - + - + - +