From 14bcca097a591d3d7c08bf3c73eec92a59721048 Mon Sep 17 00:00:00 2001
From: wangxiangwen <1906413238@qq.com>
Date: Wed, 23 Jul 2025 18:12:17 +0800
Subject: [PATCH 1/3] =?UTF-8?q?set=E5=8F=AA=E6=9C=89=E4=B8=80=E6=AC=A1+?=
=?UTF-8?q?=E8=83=BD=E8=BE=93=E5=85=A5=E8=B4=9F=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/views/zhongchou/activity/set/index.vue | 76 ++++++++++++++++------
activitylink/src/views/zhongchou/index.vue | 1 -
2 files changed, 57 insertions(+), 20 deletions(-)
diff --git a/activitylink/src/views/zhongchou/activity/set/index.vue b/activitylink/src/views/zhongchou/activity/set/index.vue
index bb98281..2bb33be 100644
--- a/activitylink/src/views/zhongchou/activity/set/index.vue
+++ b/activitylink/src/views/zhongchou/activity/set/index.vue
@@ -9,17 +9,21 @@
-
+
确认
@@ -29,7 +33,7 @@
-
+
确认
@@ -37,9 +41,9 @@
-
+
@@ -54,7 +58,7 @@
- 您确定要设置初始数据为 {{ setinitiaData }} 分钟吗?
+ 您确定要设置初始数据为 {{ setinitiaData }} 分钟吗?(只能修改一次!)
@@ -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 @@
-
+ handleNumberInput('amount', val, addForm, 99999)"
+ placeholder="请输入数量"
+ style="width: 100%;"
+ >
-
+ handleNumberInput('perWin', val, addForm, 500)"
+ placeholder="请输入抽取人数"
+ style="width: 100%;"
+ >
-
+ handleNumberInput('sort', val, addForm, 100000000)"
+ placeholder="请输入排序等级"
+ style="width: 100%;"
+ >
@@ -69,16 +81,28 @@
-
+ handleNumberInput('amount', val, editForm, 99999)"
+ placeholder="请输入数量"
+ style="width: 100%;"
+ >
-
+ handleNumberInput('perWin', val, editForm, 500)"
+ placeholder="请输入抽取人数"
+ style="width: 100%;"
+ >
-
+ handleNumberInput('sort', val, editForm, 100000000)"
+ placeholder="请输入排序等级"
+ style="width: 100%;"
+ >
@@ -125,9 +149,9 @@ const editLevel = (row) => {
editForm.value = {
id: row.id,
gradeName: row.gradeName,
- amount: row.amount,
- perWin: row.perWin,
- sort: row.sort
+ amount: String(row.amount),
+ perWin: String(row.perWin),
+ sort: String(row.sort)
}
editVisible.value = true
}
@@ -249,6 +273,29 @@ const deleteLevel = (row) => {
})
}
+// 处理数字输入并限制最大值
+const handleNumberInput = (field, value, form, maxValue) => {
+ // 1. 过滤非数字字符
+ let filteredValue = value.replace(/[^\d]/g, '');
+
+ // 2. 处理空值情况
+ if (filteredValue === '') {
+ form[field] = '';
+ return;
+ }
+
+ // 3. 转换为数字并限制最大值
+ let numValue = Number(filteredValue);
+
+ // 4. 应用最大值限制
+ if (numValue > maxValue) {
+ form[field] = String(maxValue);
+ } else {
+ // 5. 保留原始输入(但去除前导零)
+ form[field] = numValue === 0 ? '0' : filteredValue.replace(/^0+/, '') || '0';
+ }
+};
+
//清空表单(关闭对话框时调用)
const resetForm = () => {
addForm.value = {
From 1a986548af28d1516c43ce0b4385f9fa5ee138f5 Mon Sep 17 00:00:00 2001
From: wangxiangwen <1906413238@qq.com>
Date: Thu, 24 Jul 2025 15:54:25 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
activitylink/src/views/zhongchou/activity/detail/index.vue | 7 ++++++-
activitylink/src/views/zhongchou/user/index.vue | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/activitylink/src/views/zhongchou/activity/detail/index.vue b/activitylink/src/views/zhongchou/activity/detail/index.vue
index d69669e..2578f70 100644
--- a/activitylink/src/views/zhongchou/activity/detail/index.vue
+++ b/activitylink/src/views/zhongchou/activity/detail/index.vue
@@ -45,7 +45,12 @@
-
+
+
+ {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
+
+
+
diff --git a/activitylink/src/views/zhongchou/user/index.vue b/activitylink/src/views/zhongchou/user/index.vue
index 9014a03..67e1f21 100644
--- a/activitylink/src/views/zhongchou/user/index.vue
+++ b/activitylink/src/views/zhongchou/user/index.vue
@@ -123,7 +123,7 @@ try {
const response = await deleteuserByjwcode({ jwcode: deleteJwcode.value })
if (response.code === 200) {
ElMessage.success('删除成功')
- fetchWinList() // 刷新列表
+ handleReset() // 刷新列表
} else {
ElMessage.error(response.message || '删除失败')
}