From 94053ac865bb773b1e4ffce2708078c9129998b6 Mon Sep 17 00:00:00 2001 From: WorldSansha Date: Thu, 5 Mar 2026 20:59:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20feat:=20=E4=B8=BA=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E5=8C=BA=E3=80=8C=E6=8A=B1=E4=B8=80=E6=8A=B1=E3=80=8D?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=B7=BB=E5=8A=A0=E5=BC=80=E5=85=B3=E5=92=8C?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在常规设置的其他设置中添加「评论区抱一抱」开关,默认开启 - 首次双击评论时弹出确认提示,避免用户误触 - 第二次取消时提供「取消且不再提示」选项,可直接关闭功能 - 重新开启开关时自动重置提示状态 - 限制抱一抱仅对歌曲评论生效,其他资源类型给出提示 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/List/CommentList.vue | 42 +++++++++++++++++++++--- src/components/Setting/config/general.ts | 13 ++++++++ src/stores/setting.ts | 6 ++++ 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/components/List/CommentList.vue b/src/components/List/CommentList.vue index a53585be9..a3c076679 100644 --- a/src/components/List/CommentList.vue +++ b/src/components/List/CommentList.vue @@ -103,9 +103,10 @@ import { isLogin } from "@/utils/auth"; import { openUserLogin } from "@/utils/modal"; import emoji from "@/assets/data/emoji.json"; import { commentLike, hugComment, getCommentHugList } from "@/api/comment"; -import { useDataStore } from "@/stores"; +import { useDataStore, useSettingStore } from "@/stores"; const userStore = useDataStore(); +const settingStore = useSettingStore(); const props = defineProps<{ data: CommentType[]; @@ -164,13 +165,46 @@ const likeComment = debounce(async (data: CommentType) => { }, 300); // 双击抱一抱 +let hugTipDismissed = false; const handleDoubleClick = debounce(async (item: CommentType) => { + if (!settingStore.enableCommentHug) return; + // 首次双击提示 + if (!settingStore.showedCommentHugTip) { + window.$dialog.warning({ + title: "抱一抱", + content: "双击评论会向评论者发送「抱一抱」,是否继续?", + positiveText: "继续", + negativeText: hugTipDismissed ? "取消且不再提示" : "取消", + onPositiveClick: () => { + settingStore.showedCommentHugTip = true; + executeHug(item); + }, + onNegativeClick: () => { + if (hugTipDismissed) { + settingStore.showedCommentHugTip = true; + settingStore.enableCommentHug = false; + } + hugTipDismissed = true; + }, + }); + return; + } + executeHug(item); +}, 300); + +// 执行抱一抱 +const executeHug = async (item: CommentType) => { if (!isLogin()) { openUserLogin(); return; } - // 本地歌曲不支持抱一抱 - if (typeof props.resId !== "number") return; + // 仅歌曲评论支持抱一抱 + if (typeof props.resId !== "number" || props.type !== 0) { + if (typeof props.resId === "number") { + window.$message.warning("仅歌曲评论支持抱一抱"); + } + return; + } try { const result = await hugComment(userStore.userData.userId, item.id, props.resId); if (result.code === 200) { @@ -207,7 +241,7 @@ const handleDoubleClick = debounce(async (item: CommentType) => { console.error("Hug comment error:", error); window.$message.error("抱一抱失败"); } -}, 300); +};