From 065b516bd7e82b29352ab4e4e158cf7ca546c789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E8=80=81=E7=99=BD=E5=85=94?= Date: Thu, 18 Sep 2025 10:17:14 +0800 Subject: [PATCH] =?UTF-8?q?refactor(MessageRecord):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84JSON=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 该函数未被组件使用,清理冗余代码以保持代码整洁 --- .../components/MessageRecord/index.tsx | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageRecord/index.tsx b/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageRecord/index.tsx index 68db15d8..86ef639f 100644 --- a/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageRecord/index.tsx +++ b/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageRecord/index.tsx @@ -36,26 +36,6 @@ const MessageRecord: React.FC = ({ contract }) => { ); }; - // 提取content字符串中冒号后面的JSON部分 - const extractJsonFromContent = (content: string): object | null => { - try { - // 查找第一个冒号的位置 - const colonIndex = content.indexOf(":"); - if (colonIndex === -1) { - return null; - } - - // 提取冒号后面的部分并去除前后空格 - const jsonStr = content.substring(colonIndex + 1).trim(); - - // 尝试解析JSON - return JSON.parse(jsonStr); - } catch (error) { - console.error("解析JSON失败:", error); - return null; - } - }; - // 解析表情包文字格式[表情名称]并替换为img标签 const parseEmojiText = (text: string): React.ReactNode[] => { const emojiRegex = /\[([^\]]+)\]/g;