diff --git a/pages/plugins/live/pull/components/like-effect/like-effect.vue b/pages/plugins/live/pull/components/like-effect/like-effect.vue
index 8cb6d386..9a6bfc4e 100644
--- a/pages/plugins/live/pull/components/like-effect/like-effect.vue
+++ b/pages/plugins/live/pull/components/like-effect/like-effect.vue
@@ -1,43 +1,45 @@
-
-
-
-
-
- {{ like.icon }}
-
-
-
-
- x {{ likeCount }}
-
+
+
+
+
+
+
+ {{ like.icon }}
+
+
+
+
+ x {{ likeCount }}
+
+
@@ -75,7 +77,8 @@
likeCountScale: 1,
lastLikeTime: 0,
likeCountTimer: null,
- resetTimer: null // 重置计数的定时器
+ resetTimer: null, // 重置计数的定时器
+ lastClickTime: 0 // 防止双击添加多个图标
}
},
computed: {
@@ -90,6 +93,13 @@
},
methods: {
addLike(event, options = {}) {
+ // 防抖处理,防止双击添加多个图标
+ const now = Date.now();
+ if (now - this.lastClickTime < 200) {
+ return;
+ }
+ this.lastClickTime = now;
+
// 获取点击坐标
let x, y;
// 尝试多种方式获取坐标
@@ -106,13 +116,13 @@
console.log('Click coordinates:', x, y);
- // 添加随机偏差 (-20px 到 20px)
- const offsetX = Math.floor(Math.random() * 41) - 20;
- const offsetY = Math.floor(Math.random() * 41) - 20;
+ // 添加随机偏差 (-10px 到 10px)
+ const offsetX = Math.floor(Math.random() * 41) - 10;
+ const offsetY = Math.floor(Math.random() * 41) - 10;
// 确保图标位置不超过点击位置20px范围
- const clampedOffsetX = Math.max(-20, Math.min(20, offsetX));
- const clampedOffsetY = Math.max(-20, Math.min(20, offsetY));
+ const clampedOffsetX = Math.max(-10, Math.min(10, offsetX));
+ const clampedOffsetY = Math.max(-10, Math.min(10, offsetY));
// 调整后的坐标
const adjustedX = x + clampedOffsetX - 10;
@@ -157,7 +167,7 @@
icon: icon,
imageSrc: imageSrc
};
-
+ console.log(newLike, '111');
// 添加到列表
this.likeList.push(newLike);
console.log('Added like item:', newLike);
@@ -186,6 +196,12 @@
this.resetTimer = null;
}
+ // 清除之前的隐藏定时器
+ if (this.likeCountTimer) {
+ clearTimeout(this.likeCountTimer);
+ this.likeCountTimer = null;
+ }
+
// 如果距离上次点赞超过1秒,重置计数
if (currentTime - this.lastLikeTime > 1000) {
this.likeCount = 1;
@@ -217,22 +233,18 @@
});
}
- // 清除之前的定时器
- if (this.likeCountTimer) {
- clearTimeout(this.likeCountTimer);
- }
-
- // 设置隐藏定时器(1000ms后隐藏,但不重置计数)
+ // 设置隐藏定时器(200ms后隐藏,但不重置计数)
if (this.likeCount >= 3) {
this.likeCountTimer = setTimeout(() => {
this.hideLikeCount();
-
- // 设置重置计数的定时器(在隐藏后1秒重置)
- this.resetTimer = setTimeout(() => {
- this.likeCount = 0;
- }, 1000);
- }, 1000); // 200ms后隐藏
+ }, 200);
}
+
+ // 设置重置计数的定时器(在隐藏后1秒重置)
+ this.resetTimer = setTimeout(() => {
+ this.likeCount = 0;
+ this.showLikeCount = false;
+ }, 1200);
},
// 隐藏数量提示
@@ -343,9 +355,11 @@
position: absolute;
top: 0;
left: 0;
+ /* #ifndef-nvue */
width: 100%;
height: 100%;
pointer-events: none;
+ /* #endif */
z-index: 9999;
}
@@ -374,7 +388,7 @@
.like-count {
opacity: 1;
- animation: shrinkUp 0.2s ease-out forwards;
+ animation: shrinkUp 1s ease-out forwards;
}
@keyframes zoomInOut {
diff --git a/pages/plugins/live/pull/components/live-content/live-content.vue b/pages/plugins/live/pull/components/live-content/live-content.vue
index a0ade794..adb173ee 100644
--- a/pages/plugins/live/pull/components/live-content/live-content.vue
+++ b/pages/plugins/live/pull/components/live-content/live-content.vue
@@ -7,14 +7,14 @@
-