From 8507b640b2bcd07640d5ff8a87adf1ab88e72d5d 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: Wed, 10 Sep 2025 17:55:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix(ckchat):=20=E5=B0=86deleteChatSession?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=B1=BB=E5=9E=8B=E4=BB=8Estring=E6=94=B9?= =?UTF-8?q?=E4=B8=BAnumber?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改deleteChatSession方法的参数类型以匹配实际使用场景,同时在相关组件中直接使用store中的方法而非直接导入,保持 --- .../components/toContract/index.tsx | 9 +++++---- .../components/MessageEnter/index.tsx | 17 ++--------------- Cunkebao/src/store/module/ckchat/ckchat.data.ts | 2 +- Cunkebao/src/store/module/ckchat/ckchat.ts | 2 +- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/toContract/index.tsx b/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/toContract/index.tsx index 8fd4c404..be2f9cb2 100644 --- a/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/toContract/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/toContract/index.tsx @@ -7,7 +7,7 @@ import { WechatFriendRebackAllot, } from "@/pages/pc/ckbox/weChat/api"; import { useCurrentContact } from "@/store/module/weChat/weChat"; -import { deleteChatSession } from "@/store/module/ckchat/ckchat"; +import { useCkChatStore } from "@/store/module/ckchat/ckchat"; import { contractService, weChatGroupService } from "@/utils/db"; const { TextArea } = Input; const { Option } = Select; @@ -39,6 +39,7 @@ const ToContract: React.FC = ({ const [customerServiceList, setCustomerServiceList] = useState( [], ); + const deleteChatSession = useCkChatStore(state => state.deleteChatSession); // 打开弹窗 const openModal = () => { setVisible(true); @@ -89,12 +90,12 @@ const ToContract: React.FC = ({ message.success("转接成功"); try { // 删除聊天会话 - deleteChatSession(currentContact.id.toString()); + deleteChatSession(currentContact.id); // 删除本地数据库记录 if ("chatroomId" in currentContact) { await weChatGroupService.delete(currentContact.id); } else { - await contractService.delete(currentContact.id.toString()); + await contractService.delete(currentContact.id); } } catch (deleteError) { console.error("删除本地数据失败:", deleteError); @@ -129,7 +130,7 @@ const ToContract: React.FC = ({ message.success("转回成功"); try { // 删除聊天会话 - deleteChatSession(currentContact.id.toString()); + deleteChatSession(currentContact.id); // 删除本地数据库记录 if ("chatroomId" in currentContact) { await weChatGroupService.delete(currentContact.id); diff --git a/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/index.tsx b/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/index.tsx index 7676158d..22b99d15 100644 --- a/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/index.tsx @@ -1,12 +1,9 @@ import React, { useState } from "react"; -import { Layout, Input, Button, Tooltip, Modal } from "antd"; +import { Layout, Input, Button, Modal } from "antd"; import { - ShareAltOutlined, SendOutlined, - AudioOutlined, FolderOutlined, PictureOutlined, - MessageOutlined, } from "@ant-design/icons"; import { ContractData, weChatGroup } from "@/pages/pc/ckbox/data"; import { useWebSocketStore } from "@/store/module/websocket/websocket"; @@ -176,17 +173,7 @@ const MessageEnter: React.FC = ({ contract }) => { />
- { - console.log("转接数据:", data); - // 这里可以添加实际的转接逻辑 - }} - onReturn={() => { - console.log("执行一键转回操作"); - // 这里可以添加实际的转回逻辑 - }} - /> + { diff --git a/Cunkebao/src/store/module/ckchat/ckchat.data.ts b/Cunkebao/src/store/module/ckchat/ckchat.data.ts index 9477aacb..3d74c36c 100644 --- a/Cunkebao/src/store/module/ckchat/ckchat.data.ts +++ b/Cunkebao/src/store/module/ckchat/ckchat.data.ts @@ -60,7 +60,7 @@ export interface CkChatState { updateCtrlUser: (user: KfUserListData) => void; clearkfUserList: () => void; addChatSession: (session: any) => void; - deleteChatSession: (sessionId: string) => void; + deleteChatSession: (sessionId: number) => void; setUserInfo: (userInfo: CkUserInfo) => void; clearUserInfo: () => void; updateAccount: (account: Partial) => void; diff --git a/Cunkebao/src/store/module/ckchat/ckchat.ts b/Cunkebao/src/store/module/ckchat/ckchat.ts index 3ac0ba7f..5928866d 100644 --- a/Cunkebao/src/store/module/ckchat/ckchat.ts +++ b/Cunkebao/src/store/module/ckchat/ckchat.ts @@ -389,7 +389,7 @@ export const useCkChatStore = createPersistStore( })); }, // 删除聊天会话 - deleteChatSession: (sessionId: string) => { + deleteChatSession: (sessionId: number) => { set(state => ({ chatSessions: state.chatSessions.filter(item => item.id !== sessionId), })); From 9ed298bf3eae362f44112b856daae274d628e863 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: Wed, 10 Sep 2025 18:08:09 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat(weChat):=20=E6=B7=BB=E5=8A=A0=E6=B8=85?= =?UTF-8?q?=E7=A9=BA=E5=BD=93=E5=89=8D=E8=81=94=E7=B3=BB=E4=BA=BA=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在weChat模块中添加clearCurrentContact方法用于清空当前联系人和消息,并在ckchat模块中调用该方法确保删除会话时同步清空联系人 --- Cunkebao/src/store/module/ckchat/ckchat.ts | 7 ++++++- Cunkebao/src/store/module/weChat/weChat.data.ts | 3 ++- Cunkebao/src/store/module/weChat/weChat.ts | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Cunkebao/src/store/module/ckchat/ckchat.ts b/Cunkebao/src/store/module/ckchat/ckchat.ts index 5928866d..1b44fcbe 100644 --- a/Cunkebao/src/store/module/ckchat/ckchat.ts +++ b/Cunkebao/src/store/module/ckchat/ckchat.ts @@ -9,7 +9,10 @@ import { } from "@/pages/pc/ckbox/data"; import { weChatGroupService, contractService } from "@/utils/db"; import { createContractList } from "@/store/module/ckchat/api"; - +import { useWeChatStore } from "@/store/module/weChat/weChat"; +// 从weChat store获取clearCurrentContact方法 +const getClearCurrentContact = () => + useWeChatStore.getState().clearCurrentContact; export const useCkChatStore = createPersistStore( set => ({ userInfo: null, @@ -393,6 +396,8 @@ export const useCkChatStore = createPersistStore( set(state => ({ chatSessions: state.chatSessions.filter(item => item.id !== sessionId), })); + //当前选中的客户清空 + getClearCurrentContact(); }, // 设置用户信息 setUserInfo: (userInfo: CkUserInfo) => { diff --git a/Cunkebao/src/store/module/weChat/weChat.data.ts b/Cunkebao/src/store/module/weChat/weChat.data.ts index f7839ef0..7cdd4b73 100644 --- a/Cunkebao/src/store/module/weChat/weChat.data.ts +++ b/Cunkebao/src/store/module/weChat/weChat.data.ts @@ -6,7 +6,8 @@ export interface WeChatState { // 当前聊天用户的消息列表(只存储当前聊天用户的消息) currentMessages: ChatRecord[]; - + // 清空当前联系人 + clearCurrentContact: () => void; // 消息加载状态 messagesLoading: boolean; isLoadingData: boolean; diff --git a/Cunkebao/src/store/module/weChat/weChat.ts b/Cunkebao/src/store/module/weChat/weChat.ts index fa537c1d..f4f3cb0c 100644 --- a/Cunkebao/src/store/module/weChat/weChat.ts +++ b/Cunkebao/src/store/module/weChat/weChat.ts @@ -24,7 +24,10 @@ export const useWeChatStore = create()( messagesLoading: false, isLoadingData: false, currentGroupMembers: [], - + //清空当前联系人 + clearCurrentContact: () => { + set({ currentContract: null, currentMessages: [] }); + }, // Actions setCurrentContact: ( contract: ContractData | weChatGroup, From 23c54af27d10e655c9e79997ed4c4370d6988d4c 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: Wed, 10 Sep 2025 18:21:42 +0800 Subject: [PATCH 3/4] =?UTF-8?q?refactor(weChat):=20=E7=A7=BB=E9=99=A4ChatR?= =?UTF-8?q?ecord=E7=BB=84=E4=BB=B6=E4=B8=AD=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84onSearch=E5=B1=9E=E6=80=A7=E5=B9=B6=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将ChatRecord组件的搜索逻辑移至store管理,移除未使用的onSearch回调属性 更新构建产物文件路径 --- Cunkebao/dist/.vite/manifest.json | 36 +++++++++---------- Cunkebao/dist/index.html | 12 +++---- .../components/chatRecord/index.tsx | 25 ++++--------- .../components/MessageEnter/index.tsx | 8 +---- 4 files changed, 32 insertions(+), 49 deletions(-) diff --git a/Cunkebao/dist/.vite/manifest.json b/Cunkebao/dist/.vite/manifest.json index 06997412..426614a4 100644 --- a/Cunkebao/dist/.vite/manifest.json +++ b/Cunkebao/dist/.vite/manifest.json @@ -1,17 +1,17 @@ { - "_charts-BjEBSMrK.js": { - "file": "assets/charts-BjEBSMrK.js", + "_charts-DN1cefc8.js": { + "file": "assets/charts-DN1cefc8.js", "name": "charts", "imports": [ - "_ui-CiJ_pikt.js", - "_vendor-BPPoWDlG.js" + "_ui-5V-xZWkf.js", + "_vendor-Bq99rrm8.js" ] }, - "_ui-CiJ_pikt.js": { - "file": "assets/ui-CiJ_pikt.js", + "_ui-5V-xZWkf.js": { + "file": "assets/ui-5V-xZWkf.js", "name": "ui", "imports": [ - "_vendor-BPPoWDlG.js" + "_vendor-Bq99rrm8.js" ], "css": [ "assets/ui-D0C0OGrH.css" @@ -21,30 +21,30 @@ "file": "assets/ui-D0C0OGrH.css", "src": "_ui-D0C0OGrH.css" }, - "_utils-DiZV3oaL.js": { - "file": "assets/utils-DiZV3oaL.js", + "_utils-Ft3ushmX.js": { + "file": "assets/utils-Ft3ushmX.js", "name": "utils", "imports": [ - "_vendor-BPPoWDlG.js" + "_vendor-Bq99rrm8.js" ] }, - "_vendor-BPPoWDlG.js": { - "file": "assets/vendor-BPPoWDlG.js", + "_vendor-Bq99rrm8.js": { + "file": "assets/vendor-Bq99rrm8.js", "name": "vendor" }, "index.html": { - "file": "assets/index-DPe1huLQ.js", + "file": "assets/index-9Clf2a7g.js", "name": "index", "src": "index.html", "isEntry": true, "imports": [ - "_vendor-BPPoWDlG.js", - "_utils-DiZV3oaL.js", - "_ui-CiJ_pikt.js", - "_charts-BjEBSMrK.js" + "_vendor-Bq99rrm8.js", + "_ui-5V-xZWkf.js", + "_utils-Ft3ushmX.js", + "_charts-DN1cefc8.js" ], "css": [ - "assets/index-prcd5sVt.css" + "assets/index-CK1wd128.css" ] } } \ No newline at end of file diff --git a/Cunkebao/dist/index.html b/Cunkebao/dist/index.html index f953a3da..408e052b 100644 --- a/Cunkebao/dist/index.html +++ b/Cunkebao/dist/index.html @@ -11,13 +11,13 @@ - - - - - + + + + + - +
diff --git a/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/chatRecord/index.tsx b/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/chatRecord/index.tsx index b7af4596..3068e42d 100644 --- a/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/chatRecord/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/chatRecord/index.tsx @@ -2,17 +2,16 @@ import React, { useState } from "react"; import { Button, Modal, Input, DatePicker, message } from "antd"; import { MessageOutlined } from "@ant-design/icons"; import dayjs from "dayjs"; +import { useWeChatStore } from "@/store/module/weChat/weChat"; const { RangePicker } = DatePicker; interface ChatRecordProps { - onSearch?: (data: { dateRange: [string, string]; content: string }) => void; className?: string; disabled?: boolean; } const ChatRecord: React.FC = ({ - onSearch, className, disabled = false, }) => { @@ -22,6 +21,7 @@ const ChatRecord: React.FC = ({ null, ); const [loading, setLoading] = useState(false); + const SearchMessage = useWeChatStore(state => state.SearchMessage); // 打开弹窗 const openModal = () => { @@ -43,26 +43,15 @@ const ChatRecord: React.FC = ({ return; } - if (!searchContent.trim()) { - message.warning("请输入查找内容"); - return; - } - try { setLoading(true); - + const [From, To] = dateRange; const searchData = { - dateRange: [ - dateRange[0].format("YYYY-MM-DD 00:00:00"), - dateRange[1].format("YYYY-MM-DD 23:59:59"), - ] as [string, string], - content: searchContent.trim(), + From: From.unix() * 1000, + To: To.unix() * 1000, + keyword: searchContent.trim(), }; - - // 调用回调函数 - if (onSearch) { - await onSearch(searchData); - } + await SearchMessage(searchData); message.success("查找完成"); closeModal(); diff --git a/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/index.tsx b/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/index.tsx index 22b99d15..70dd3370 100644 --- a/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/index.tsx @@ -174,13 +174,7 @@ const MessageEnter: React.FC = ({ contract }) => {
- { - console.log("查找数据:", data); - // 这里可以添加实际的查找逻辑 - }} - /> +
From 919f0dc120e8b4c2984539ff4708580b858f0571 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, 11 Sep 2025 10:05:21 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat(=E8=A1=A8=E5=8D=95):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=87=87=E9=9B=86=E5=86=85=E5=AE=B9=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在表单页面新增采集内容类型选择功能,支持用户选择文本、图片和视频类型 --- .../pages/mobile/mine/content/form/index.tsx | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/Cunkebao/src/pages/mobile/mine/content/form/index.tsx b/Cunkebao/src/pages/mobile/mine/content/form/index.tsx index 0082d02c..2aed0816 100644 --- a/Cunkebao/src/pages/mobile/mine/content/form/index.tsx +++ b/Cunkebao/src/pages/mobile/mine/content/form/index.tsx @@ -48,6 +48,11 @@ export default function ContentForm() { const [showEndPicker, setShowEndPicker] = useState(false); const [keywordsInclude, setKeywordsInclude] = useState(""); const [keywordsExclude, setKeywordsExclude] = useState(""); + const [catchType, setCatchType] = useState([ + "text", + "image", + "video", + ]); const [submitting, setSubmitting] = useState(false); const [loading, setLoading] = useState(false); @@ -65,6 +70,7 @@ export default function ContentForm() { setSelectedFriendsOptions(data.friendsGroupsOptions || []); setKeywordsInclude((data.keywordInclude || []).join(",")); setKeywordsExclude((data.keywordExclude || []).join(",")); + setCatchType(data.catchType || ["text", "image", "video"]); setAIPrompt(data.aiPrompt || ""); setUseAI(!!data.aiPrompt); setEnabled(data.status === 1); @@ -108,6 +114,7 @@ export default function ContentForm() { .split(/,|,|\n|\s+/) .map(s => s.trim()) .filter(Boolean), + catchType, aiPrompt, timeEnabled: dateRange[0] || dateRange[1] ? 1 : 0, startTime: dateRange[0] ? formatDate(dateRange[0]) : "", @@ -236,6 +243,46 @@ export default function ContentForm() { + {/* 采集内容类型 */} +
采集内容类型
+
+
+ {["text", "image", "video"].map(type => ( +
{ + setCatchType(prev => + prev.includes(type) + ? prev.filter(t => t !== type) + : [...prev, type], + ); + }} + > + + {type === "text" + ? "文本" + : type === "image" + ? "图片" + : "视频"} + +
+ ))} +
+
+
是否启用AI