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 @@
- + + + + diff --git a/activitylink/src/views/zhongchou/activity/index.vue b/activitylink/src/views/zhongchou/activity/index.vue index 4023486..1f6c9be 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 bb98281..06c5432 100644 --- a/activitylink/src/views/zhongchou/activity/set/index.vue +++ b/activitylink/src/views/zhongchou/activity/set/index.vue @@ -9,37 +9,40 @@

数据设置:

- - -   分钟 -      - 确认 -
+ +
{{ initialData }}分钟
- -
- - -      - 确认 -      -
- -
- - -      - 确认 -      - -
+ +
+ + + 确认 + +
+ + +
+ + + 确认 + +
-
+ @@ -53,15 +56,15 @@ - - 您确定要设置初始数据为 {{ setinitiaData }} 分钟吗? +
@@ -82,7 +85,7 @@ const addCountTwo = ref(null); const showConfirmDialog = ref(false); const showInitialConfirmDialog = ref(false); const pendingAction = ref(null); // 存储待执行的操作类型 ('one' or 'two') - +const isInitialDataSet = ref(false); // 用于跟踪初始数据是否已经设置 // API返回的数据 const marketOne = ref(''); // 市场一类型 const marketTwo = ref(''); // 市场二类型 @@ -128,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 { // ✅ 修改传参方式为对象 @@ -162,13 +220,23 @@ const fetchData = async () => { }; - +const ifshow = () =>{ + if(initialData.value >0) + { + isInitialDataSet.value = true; + } + else + { + isInitialDataSet.value = false; + } +} // 组件挂载时获取数据 -onMounted(() => { - fetchData(); +onMounted(async () => { + await fetchData(); + ifshow(); }); // 打开确认弹窗 @@ -221,6 +289,7 @@ const confirmInitialData = async () => { showInitialConfirmDialog.value = false setinitiaData.value=0 ElMessage.success('设置成功') + ifshow(); } else { ElMessage.error(response.message || '设置失败') @@ -235,7 +304,8 @@ const confirmInitialData = async () => { const confirmAdd = async () => { const type = pendingAction.value; - if (type === 'one' && addCountOne.value !== null && addCountOne.value > 0) { + // 修改市场一的验证逻辑,移除 > 0 的检查 + if (type === 'one' && addCountOne.value !== null && addCountOne.value !== 0) { markerOneTotal.value += parseInt(addCountOne.value); showOne.value = markerOneTotal.value; @@ -256,6 +326,7 @@ const confirmAdd = async () => { // 可选:回滚操作 markerOneTotal.value -= parseInt(addCountOne.value); showOne.value = markerOneTotal.value; + fetchData(); } } catch (error) { console.error('添加助力次数失败:', error); @@ -267,7 +338,8 @@ const confirmAdd = async () => { addCountOne.value = null; - } else if (type === 'two' && addCountTwo.value !== null && addCountTwo.value > 0) { + // 修改市场二的验证逻辑,移除 > 0 的检查 + } else if (type === 'two' && addCountTwo.value !== null && addCountTwo.value !== 0) { markerTwoTotal.value += parseInt(addCountTwo.value); showTwo.value = markerTwoTotal.value; @@ -287,6 +359,7 @@ const confirmAdd = async () => { // 回滚 markerTwoTotal.value -= parseInt(addCountTwo.value); showTwo.value = markerTwoTotal.value; + fetchData(); } } catch (error) { console.error('添加助力次数失败:', error); @@ -325,25 +398,72 @@ const goBack = () => { display: flex; align-items: center; justify-content: flex-start; - flex-wrap: wrap; + flex-wrap: nowrap; + gap: 15px; } .setting-item label { - margin-right: 20px; font-size: 1.1rem; - min-width: 200px; + white-space: nowrap; + flex: 0 0 auto; +} + +/* 专门针对带有展示次数的项(市场一和市场二) */ +.setting-item.has-show-label { + flex-wrap: wrap; +} + +/* 为市场项添加特殊处理 */ +.setting-item:has(.el-input-number) label:first-child { + flex: 0 0 auto; +} + +/* 将展示次数标签推向右侧 */ +.setting-item:has(.el-input-number) label:last-child { + margin-left: auto; + flex: 0 0 auto; } .el-input-number { width: 180px; + flex: 0 0 auto; } .el-button { height: 40px; font-size: 1.1rem; padding: 0 20px; + 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/index.vue b/activitylink/src/views/zhongchou/index.vue index cc2c5b8..10ed759 100644 --- a/activitylink/src/views/zhongchou/index.vue +++ b/activitylink/src/views/zhongchou/index.vue @@ -43,7 +43,6 @@ const handleLogout = () => { console.error('退出错误:', error); } }).catch(() => { - // router.back() ElMessage.info('已取消退出'); }); }; diff --git a/activitylink/src/views/zhongchou/level/index.vue b/activitylink/src/views/zhongchou/level/index.vue index 8ec93e3..9d720e0 100644 --- a/activitylink/src/views/zhongchou/level/index.vue +++ b/activitylink/src/views/zhongchou/level/index.vue @@ -45,7 +45,7 @@ @@ -61,7 +61,7 @@ @@ -83,7 +83,7 @@ @@ -99,7 +99,7 @@ @@ -277,16 +277,16 @@ 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); 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 || '删除失败') }