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/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;
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 @@
-
+
+
-
+