From 10159259364a4decd58783f4632732b997a2bc59 Mon Sep 17 00:00:00 2001 From: wangxiangwen <1906413238@qq.com> Date: Fri, 25 Jul 2025 15:39:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84=E9=98=B2=E6=8A=96=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/set/index.vue | 100 +++++++++++++-------- 1 file changed, 63 insertions(+), 37 deletions(-) diff --git a/activitylink/src/views/zhongchou/activity/set/index.vue b/activitylink/src/views/zhongchou/activity/set/index.vue index 120c859..b109058 100644 --- a/activitylink/src/views/zhongchou/activity/set/index.vue +++ b/activitylink/src/views/zhongchou/activity/set/index.vue @@ -262,50 +262,63 @@ const cancelset = () => { // 确定设置初始数据 // 确定设置初始数据 -const confirmInitialData = async () => { - try { - const id = activityStone.selectactivityId - const time = setinitiaData.value - - if (!id) { - ElMessage.warning('未获取到活动ID') - return - } - - if (time === null || time <= 0) { - ElMessage.warning('请输入有效的分钟数') - return - } - - const response = await setTime( - { - activityId: id, - time: time - } - ) - - if (response.code === 200) { - await fetchData() - showInitialConfirmDialog.value = false - setinitiaData.value=0 - ElMessage.success('设置成功') - ifshow(); - - } else { - ElMessage.error(response.message || '设置失败') - } - } catch (error) { - console.error('设置初始数据失败:', error) - ElMessage.error('请求失败,请重试') - } -} +// const confirmInitialData = async () => { +// try { +// const id = activityStone.selectactivityId +// const time = setinitiaData.value + +// if (!id) { +// ElMessage.warning('未获取到活动ID') +// return +// } + +// if (time === null || time <= 0) { +// ElMessage.warning('请输入有效的分钟数') +// return +// } + +// const response = await setTime( +// { +// activityId: id, +// time: time +// } +// ) + +// if (response.code === 200) { +// await fetchData() +// showInitialConfirmDialog.value = false +// setinitiaData.value=0 +// ElMessage.success('设置成功') +// ifshow(); + +// } else { +// ElMessage.error(response.message || '设置失败') +// } +// } catch (error) { +// console.error('设置初始数据失败:', error) +// ElMessage.error('请求失败,请重试') +// } +// } // 确定添加 +// 添加防抖标志 +const isAdding = ref(false); +const addCooldown = 1500; // 1.5秒冷却时间 + const confirmAdd = async () => { + // 防抖检查 + if (isAdding.value) { + ElMessage.warning('操作过于频繁,请稍后再试'); + return; + } + const type = pendingAction.value; // 修改市场一的验证逻辑,移除 > 0 的检查 if (type === 'one' && addCountOne.value !== null && addCountOne.value !== 0) { + // 设置防抖标志 + isAdding.value = true; + markerOneTotal.value += parseInt(addCountOne.value); showOne.value = markerOneTotal.value; @@ -334,12 +347,20 @@ const confirmAdd = async () => { // 回滚操作 markerOneTotal.value -= parseInt(addCountOne.value); showOne.value = markerOneTotal.value; + } finally { + // 无论成功或失败,都需要在1.5秒后重置防抖标志 + setTimeout(() => { + isAdding.value = false; + }, addCooldown); } addCountOne.value = null; // 修改市场二的验证逻辑,移除 > 0 的检查 } else if (type === 'two' && addCountTwo.value !== null && addCountTwo.value !== 0) { + // 设置防抖标志 + isAdding.value = true; + markerTwoTotal.value += parseInt(addCountTwo.value); showTwo.value = markerTwoTotal.value; @@ -367,6 +388,11 @@ const confirmAdd = async () => { // 回滚 markerTwoTotal.value -= parseInt(addCountTwo.value); showTwo.value = markerTwoTotal.value; + } finally { + // 无论成功或失败,都需要在1.5秒后重置防抖标志 + setTimeout(() => { + isAdding.value = false; + }, addCooldown); } addCountTwo.value = null; From e58fff4e3f60ef2456f8efb892a3af51439fc00f Mon Sep 17 00:00:00 2001 From: wangxiangwen <1906413238@qq.com> Date: Sat, 26 Jul 2025 17:30:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=9C=B0=E5=8C=BA=E7=9A=84=E6=A1=86+=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E7=9A=84=E6=98=AF=E6=B4=BB=E5=8A=A8=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- activitylink/src/stone/activityStone.js | 18 +++++++++++++++++- .../src/views/zhongchou/activity/detail/index.vue | 5 +++-- activitylink/src/views/zhongchou/activity/index.vue | 1 + activitylink/src/views/zhongchou/winning/index.vue | 7 ++++--- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/activitylink/src/stone/activityStone.js b/activitylink/src/stone/activityStone.js index e798e94..16f9f86 100644 --- a/activitylink/src/stone/activityStone.js +++ b/activitylink/src/stone/activityStone.js @@ -37,6 +37,16 @@ export const useactivityStone = defineStore('activityStone', () => { }); }; + // 新增:持久化活动名称 + const activityName = ref(localStorage.getItem('activityName') || ''); + const setActivityName = (value) => { + activityName.value = value; + localStorage.setItem('activityName', value); + activityStorage.setItem('activityName', value).catch((err) => { + console.error('保存 activityName 到 localforage 失败:', err); + }); + }; + // 初始化恢复 const initialize = async () => { try { @@ -48,11 +58,15 @@ export const useactivityStone = defineStore('activityStone', () => { const storedId = await activityStorage.getItem('selectactivityId'); if (storedId !== null) selectactivityId.value = storedId; + + const storedName = await activityStorage.getItem('activityName'); + if (storedName !== null) activityName.value = storedName; } catch (error) { console.warn('从 localforage 恢复失败,尝试从 localStorage 恢复'); searchUsername.value = localStorage.getItem('searchUsername') || ''; searchJwcode.value = localStorage.getItem('searchJwcode') || ''; selectactivityId.value = localStorage.getItem('selectactivityId') || ''; + activityName.value = localStorage.getItem('activityName') || ''; } }; @@ -62,8 +76,10 @@ export const useactivityStone = defineStore('activityStone', () => { selectactivityId, searchUsername, searchJwcode, + activityName, setselectedactivityId, setSearchUsername, - setSearchJwcode + setSearchJwcode, + setActivityName }; }); \ No newline at end of file diff --git a/activitylink/src/views/zhongchou/activity/detail/index.vue b/activitylink/src/views/zhongchou/activity/detail/index.vue index 2578f70..a46c390 100644 --- a/activitylink/src/views/zhongchou/activity/detail/index.vue +++ b/activitylink/src/views/zhongchou/activity/detail/index.vue @@ -10,7 +10,7 @@ 当前总参与人数:{{ totalParticipants }}人          参与{{marketOneLabel}}总人数:{{ usParticipants }}人      {{marketOneLabel}}助力总次数:{{ usAssists }}次          参与{{marketTwoLabel}}总人数:{{ hkParticipants }}人      {{marketTwoLabel}}助力总次数:{{ hkAssists }}次          - 当前活动id:{{ activityStone.selectactivityId }} + 当前活动名称为:{{ activityStone.activityName }} @@ -51,8 +51,9 @@ - + + diff --git a/activitylink/src/views/zhongchou/activity/index.vue b/activitylink/src/views/zhongchou/activity/index.vue index c6caa59..e17e062 100644 --- a/activitylink/src/views/zhongchou/activity/index.vue +++ b/activitylink/src/views/zhongchou/activity/index.vue @@ -398,6 +398,7 @@ const handleCurrentChange = (val) => { // 跳转详情页方法 const goToDetail = (row) => { activityStone.setselectedactivityId(row.id); + activityStone.setActivityName(row.activityName); router.push({ name: 'activityDetail' }); }; diff --git a/activitylink/src/views/zhongchou/winning/index.vue b/activitylink/src/views/zhongchou/winning/index.vue index fd3504d..f785812 100644 --- a/activitylink/src/views/zhongchou/winning/index.vue +++ b/activitylink/src/views/zhongchou/winning/index.vue @@ -4,7 +4,7 @@

中奖管理

- + @@ -45,10 +45,11 @@
- + + - +