From d9287b47fad56b9f481bb3cb1fbfeb152a0c8789 Mon Sep 17 00:00:00 2001 From: zoujing Date: Thu, 16 Oct 2025 20:19:43 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9B=20=E5=8F=91=E9=80=81=E7=9A=84?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=B1=BB=E5=9E=8B=E7=9A=84=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constant/constant.js | 8 +++---- .../components/chat/ChatMainList/index.vue | 23 +++++++++---------- .../components/chat/ChatQuickAccess/index.vue | 4 ++-- .../module/ActivityListComponent/index.vue | 4 ++-- .../module/AttachListComponent/index.vue | 10 ++++---- .../module/DiscoveryCradContentList/index.vue | 4 ++-- .../components/module/MoreService/index.vue | 4 ++-- .../module/RecommendPostsList/index.vue | 4 ++-- 8 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/constant/constant.js b/src/constant/constant.js index 48fd96d..3f8c3cc 100644 --- a/src/constant/constant.js +++ b/src/constant/constant.js @@ -6,8 +6,8 @@ export const NOTICE_EVENT_LOGOUT = "NOTICE_EVENT_LOGOUT"; // 滚动到底部 export const SCROLL_TO_BOTTOM = "SCROLL_TO_BOTTOM"; -// 推荐帖子 -export const RECOMMEND_POSTS_TITLE = "RECOMMEND_POSTS_TITLE"; +// 发送消息文本类型 +export const SEND_MESSAGE_CONTENT_TEXT = "SEND_MESSAGE_CONTENT_TEXT"; -// 发送命令类型 -export const SEND_COMMAND_TYPE = "SEND_COMMAND_TYPE"; +// 发送消息命令类型 +export const SEND_MESSAGE_COMMAND_TYPE = "SEND_MESSAGE_COMMAND_TYPE"; diff --git a/src/pages/index/components/chat/ChatMainList/index.vue b/src/pages/index/components/chat/ChatMainList/index.vue index d0ad468..2a3cf82 100644 --- a/src/pages/index/components/chat/ChatMainList/index.vue +++ b/src/pages/index/components/chat/ChatMainList/index.vue @@ -70,7 +70,6 @@ @@ -125,8 +124,8 @@ import { onMounted, nextTick, onUnmounted, ref, defineEmits } from "vue"; import { onLoad } from "@dcloudio/uni-app"; import { SCROLL_TO_BOTTOM, - RECOMMEND_POSTS_TITLE, - SEND_COMMAND_TYPE, + SEND_MESSAGE_CONTENT_TEXT, + SEND_MESSAGE_COMMAND_TYPE, NOTICE_EVENT_LOGOUT, NOTICE_EVENT_LOGIN_SUCCESS, } from "@/constant/constant"; @@ -264,14 +263,14 @@ const scrollToBottom = () => { const setTimeoutScrollToBottom = () => setTimeout(() => scrollToBottom(), 100); // 发送普通消息 -const handleReply = (text) => { +const handleReplyText = (text) => { // 重置消息状态,准备接收新的AI回复 resetMessageState(); sendMessage(text); setTimeoutScrollToBottom(); }; -// 是发送指令 +// 是发送指令消息 const handleReplyInstruct = async (item) => { await checkToken(); // 更多服务 @@ -335,15 +334,15 @@ const addNoticeListener = () => { }, 200); }); - uni.$on(RECOMMEND_POSTS_TITLE, (value) => { - console.log("RECOMMEND_POSTS_TITLE:", value); + uni.$on(SEND_MESSAGE_CONTENT_TEXT, (value) => { + console.log("SEND_MESSAGE_CONTENT_TEXT:", value); if (value && value.length > 0) { - handleReply(value); + handleReplyText(value); } }); - uni.$on(SEND_COMMAND_TYPE, (item) => { - console.log("SEND_COMMAND_TYPE:", item); + uni.$on(SEND_MESSAGE_COMMAND_TYPE, (item) => { + console.log("SEND_MESSAGE_COMMAND_TYPE:", item); if (item && item.type) { handleReplyInstruct(item); } @@ -746,8 +745,8 @@ const stopRequest = () => { onUnmounted(() => { uni.$off(NOTICE_EVENT_LOGIN_SUCCESS); uni.$off(SCROLL_TO_BOTTOM); - uni.$off(RECOMMEND_POSTS_TITLE); - uni.$off(SEND_COMMAND_TYPE); + uni.$off(SEND_MESSAGE_CONTENT_TEXT); + uni.$off(SEND_MESSAGE_COMMAND_TYPE); uni.$off(NOTICE_EVENT_LOGOUT); resetConfig(); diff --git a/src/pages/index/components/chat/ChatQuickAccess/index.vue b/src/pages/index/components/chat/ChatQuickAccess/index.vue index 8ef5138..bd18ada 100644 --- a/src/pages/index/components/chat/ChatQuickAccess/index.vue +++ b/src/pages/index/components/chat/ChatQuickAccess/index.vue @@ -21,7 +21,7 @@ diff --git a/src/pages/index/components/module/ActivityListComponent/index.vue b/src/pages/index/components/module/ActivityListComponent/index.vue index d91738e..02c0342 100644 --- a/src/pages/index/components/module/ActivityListComponent/index.vue +++ b/src/pages/index/components/module/ActivityListComponent/index.vue @@ -26,7 +26,7 @@ diff --git a/src/pages/index/components/module/AttachListComponent/index.vue b/src/pages/index/components/module/AttachListComponent/index.vue index 68dc3df..f674cdd 100644 --- a/src/pages/index/components/module/AttachListComponent/index.vue +++ b/src/pages/index/components/module/AttachListComponent/index.vue @@ -12,9 +12,12 @@ diff --git a/src/pages/index/components/module/MoreService/index.vue b/src/pages/index/components/module/MoreService/index.vue index ca340ce..4f70f9d 100644 --- a/src/pages/index/components/module/MoreService/index.vue +++ b/src/pages/index/components/module/MoreService/index.vue @@ -40,7 +40,7 @@