diff --git a/activitylink/src/views/zhongchou/activity/index.vue b/activitylink/src/views/zhongchou/activity/index.vue index 1f6c9be..65c9de8 100644 --- a/activitylink/src/views/zhongchou/activity/index.vue +++ b/activitylink/src/views/zhongchou/activity/index.vue @@ -14,7 +14,7 @@
- + @@ -79,7 +79,11 @@ > - + @@ -200,9 +204,9 @@ const fetchMarketList = async () => { } catch (error) { console.error('请求市场列表失败:', error) } -} - +}// 防抖标志 +const isSubmitting = ref(false); // 取消添加 const cancel = () => { centerDialogVisible.value = false; @@ -228,7 +232,15 @@ const addActivityShow = () => { const addForm = ref(); // 定义 addForm ref const addActivity = async () => { + // 防抖检查 + if (isSubmitting.value) { + ElMessage.warning('操作过于频繁,请稍后再试'); + return; + } + try { + isSubmitting.value = true; // 设置提交标志 + const valid = await new Promise((resolve, reject) => { addForm.value.validate(valid => { if (valid) { @@ -240,6 +252,22 @@ const addActivity = async () => { }); if (!valid) { + isSubmitting.value = false; // 重置提交标志 + return; + } + + // 验证活动名称是否包含空格(双重保险) + if (!activity.value.activityName || activity.value.activityName.trim() === '') { + ElMessage.error('活动名称不能为空'); + isSubmitting.value = false; // 重置提交标志 + return; + } + + // 确保活动名称中没有空格 + const cleanedActivityName = activity.value.activityName.replace(/\s/g, ''); + if (cleanedActivityName !== activity.value.activityName) { + ElMessage.error('活动名称中不能包含空格'); + isSubmitting.value = false; // 重置提交标志 return; } @@ -266,6 +294,11 @@ const addActivity = async () => { } catch (error) { console.error('添加活动失败:', error); ElMessage.error('请求失败,请重试'); + } finally { + // 3秒后重置提交标志 + setTimeout(() => { + isSubmitting.value = false; + }, 3000); } }; @@ -317,6 +350,7 @@ const activity = ref({ const rules = { activityName: [ { required: true, message: '请输入活动名称', trigger: 'blur' } + // 移除了自定义验证器,因为清理逻辑在提交时处理 ], marketOne: [ { required: true, message: '请选择市场一', trigger: 'change' } @@ -334,7 +368,6 @@ const rules = { { required: true, message: '请选择结束时间', trigger: 'change' } ] } - // 分页配置 const currentPage = ref(1); const pageSize = ref(10); // 每页显示 10 条 @@ -346,6 +379,13 @@ const currentPageData = computed(() => { return tableData.value.slice(start, end); }); +// 处理活动名称输入,自动清除所有空格 +const handleActivityNameInput = (value) => { + // 清除所有空格 + const cleanedValue = value.replace(/\s/g, ''); + activity.value.activityName = cleanedValue; +}; + // 分页事件处理 const handleSizeChange = (val) => { pageSize.value = val; diff --git a/activitylink/src/views/zhongchou/gift/importuser/index.vue b/activitylink/src/views/zhongchou/gift/importuser/index.vue index e2b2746..f05b975 100644 --- a/activitylink/src/views/zhongchou/gift/importuser/index.vue +++ b/activitylink/src/views/zhongchou/gift/importuser/index.vue @@ -252,4 +252,31 @@ onMounted(() => { .table-container { overflow-y: auto; } + +.table-container { + height: 650px; /* 设置固定高度 */ + overflow-y: auto; /* 启用垂直滚动条 */ + overflow-x: hidden; /* 隐藏水平滚动条(如果不需要的话) */ + border: 1px solid #ebeef5; /* 可选:添加边框 */ + border-radius: 4px; /* 可选:添加圆角 */ +} + +/* 可选:自定义滚动条样式 */ +.table-container::-webkit-scrollbar { + width: 8px; +} + +.table-container::-webkit-scrollbar-track { + background: #f1f1f1; + border-radius: 4px; +} + +.table-container::-webkit-scrollbar-thumb { + background: #c1c1c1; + border-radius: 4px; +} + +.table-container::-webkit-scrollbar-thumb:hover { + background: #a8a8a8; +} \ No newline at end of file