From dbe4ee692ca8edee3f1b6c52c48455c1a82c915f 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: Fri, 14 Nov 2025 11:00:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0WeChat=20API=E4=BB=A5?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=96=B0=E7=AB=AF=E7=82=B9=EF=BC=8C=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E8=8E=B7=E5=8F=96=E5=8F=AF=E8=BD=AC=E7=A7=BB=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E5=88=97=E8=A1=A8=E7=9A=84=E9=80=BB=E8=BE=91=E3=80=82?= =?UTF-8?q?=E9=87=8D=E6=9E=84ProfileCard=E7=BB=84=E4=BB=B6=E4=BB=A5?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=BB=98=E8=AE=A4=E6=B4=BB=E5=8A=A8=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E5=8D=A1=E4=B8=BA=E2=80=9Cprofile=E2=80=9D=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=80=82=E7=A7=BB=E9=99=A4=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=92=8C=E9=80=BB=E8=BE=91=EF=BC=8C=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Touchkebao/src/pages/pc/ckbox/weChat/api.ts | 2 +- .../components/toContract/index.tsx | 2 +- .../ProfileModules/components/detailValue.tsx | 102 ++++++++++++++++++ .../components/ProfileModules/index.tsx | 26 +---- .../components/ProfileCard/index.tsx | 10 +- 5 files changed, 112 insertions(+), 30 deletions(-) create mode 100644 Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/components/ProfileModules/components/detailValue.tsx diff --git a/Touchkebao/src/pages/pc/ckbox/weChat/api.ts b/Touchkebao/src/pages/pc/ckbox/weChat/api.ts index 8ce1bcac..32bb9604 100644 --- a/Touchkebao/src/pages/pc/ckbox/weChat/api.ts +++ b/Touchkebao/src/pages/pc/ckbox/weChat/api.ts @@ -94,7 +94,7 @@ export function WechatFriendAllot(params: { //获取可转移客服列表 export function getTransferableAgentList() { - return request2("/api/account/myDepartmentAccountsForTransfer", {}, "GET"); + return request("/v1/kefu/accounts/list", {}, "GET"); } // 微信好友列表 diff --git a/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/toContract/index.tsx b/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/toContract/index.tsx index 1c7975f5..21dfa37a 100644 --- a/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/toContract/index.tsx +++ b/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/MessageEnter/components/toContract/index.tsx @@ -49,7 +49,7 @@ const ToContract: React.FC = ({ const openModal = () => { setVisible(true); getTransferableAgentList().then(data => { - setCustomerServiceList(data); + setCustomerServiceList(data.list); }); }; diff --git a/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/components/ProfileModules/components/detailValue.tsx b/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/components/ProfileModules/components/detailValue.tsx new file mode 100644 index 00000000..b6377058 --- /dev/null +++ b/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/components/ProfileModules/components/detailValue.tsx @@ -0,0 +1,102 @@ +import React, { useCallback } from "react"; +import { Button, Input } from "antd"; + +import styles from "../Person.module.scss"; + +export interface DetailValueField { + label: string; + key: string; + ifEdit?: boolean; + placeholder?: string; +} + +export interface DetailValueProps { + fields: DetailValueField[]; + value?: Record; + onChange?: (next: Record) => void; + onSubmit?: (next: Record) => void; + submitText?: string; + submitting?: boolean; + renderFooter?: React.ReactNode; +} + +const DetailValue: React.FC = ({ + fields, + value, + onChange, + onSubmit, + submitText = "保存", + submitting = false, + renderFooter, +}) => { + const handleFieldChange = useCallback( + (fieldKey: string, nextVal: string) => { + const baseValue = value ?? {}; + const nextValue = { + ...baseValue, + [fieldKey]: nextVal, + }; + onChange?.(nextValue); + }, + [onChange, value], + ); + + const handleSubmit = useCallback(() => { + onSubmit?.(value ?? {}); + }, [onSubmit, value]); + + const formValue = value ?? {}; + + return ( +
+ {fields.map(field => { + const disabled = field.ifEdit === false; + const fieldValue = formValue[field.key] ?? ""; + + return ( +
+ {field.label}: +
+ {disabled ? ( + {fieldValue || field.placeholder || "--"} + ) : ( + + handleFieldChange(field.key, event.target.value) + } + onPressEnter={handleSubmit} + /> + )} +
+
+ ); + })} + + {(onSubmit || renderFooter) && ( +
+ {renderFooter} + {onSubmit && ( + + )} +
+ )} +
+ ); +}; + +export default DetailValue; diff --git a/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/components/ProfileModules/index.tsx b/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/components/ProfileModules/index.tsx index 847b3b41..b71db1e0 100644 --- a/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/components/ProfileModules/index.tsx +++ b/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/components/ProfileModules/index.tsx @@ -97,9 +97,7 @@ const Person: React.FC = ({ contract }) => { useState(false); const [isTransferOwnerSelectionVisible, setIsTransferOwnerSelectionVisible] = useState(false); - const [selectedFriends, setSelectedFriends] = useState( - [], - ); + const [contractList, setContractList] = useState([]); const handleAddFriend = member => { @@ -374,16 +372,6 @@ const Person: React.FC = ({ contract }) => { messageApi.success("已应用AI生成的群公告内容"); }; - // 点击编辑群公告按钮 - const handleEditGroupNotice = () => { - if (!hasGroupManagePermission()) { - messageApi.error("只有群主才能修改群公告"); - return; - } - setGroupNoticeValue(contract.notice || ""); - setIsGroupNoticeModalVisible(true); - }; - // 处理我在本群中的昵称保存 const handleSaveSelfDisplayName = () => { sendCommand("CmdChatroomOperate", { @@ -397,12 +385,6 @@ const Person: React.FC = ({ contract }) => { setIsEditingSelfDisplayName(false); }; - // 点击编辑群昵称按钮 - const handleEditSelfDisplayName = () => { - setSelfDisplayNameValue(contract.selfDisplyName || ""); - setIsEditingSelfDisplayName(true); - }; - // 处理取消编辑 const handleCancelEdit = () => { setRemarkValue(contract.conRemark || ""); @@ -508,18 +490,19 @@ const Person: React.FC = ({ contract }) => { }, }); }; - + const extendFields = JSON.parse(contract.extendFields || "{}"); // 构建联系人或群聊详细信息 const contractInfo = { name: contract.name || contract.nickname, nickname: contract.nickname, - conRemark: remarkValue, // 使用当前编辑的备注值 alias: contract.alias, wechatId: contract.wechatId, chatroomId: isGroup ? contract.chatroomId : undefined, chatroomOwner: isGroup ? contract.chatroomOwner : undefined, avatar: contract.avatar || contract.chatroomAvatar, phone: contract.phone || "-", + conRemark: remarkValue, // 使用当前编辑的备注值 + remark: extendFields.remark || "-", email: contract.email || "-", department: contract.department || "-", position: contract.position || "-", @@ -1278,7 +1261,6 @@ const Person: React.FC = ({ contract }) => { visible={isFriendSelectionVisible} onCancel={() => setIsFriendSelectionVisible(false)} onConfirm={(selectedIds, selectedItems) => { - setSelectedFriends(selectedItems); handleAddMember( selectedIds.map(id => parseInt(id)), selectedItems, diff --git a/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/index.tsx b/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/index.tsx index 5fe73a75..7d322637 100644 --- a/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/index.tsx +++ b/Touchkebao/src/pages/pc/ckbox/weChat/components/ChatWindow/components/ProfileCard/index.tsx @@ -16,7 +16,7 @@ interface PersonProps { } const Person: React.FC = ({ contract }) => { - const [activeKey, setActiveKey] = useState("quickwords"); + const [activeKey, setActiveKey] = useState("profile"); const isGroup = "chatroomId" in contract; const tabItems = useMemo(() => { const baseItems = [ @@ -42,8 +42,8 @@ const Person: React.FC = ({ contract }) => { }, [contract, isGroup]); useEffect(() => { - setActiveKey("quickwords"); - setRenderedKeys(["quickwords"]); + setActiveKey("profile"); + setRenderedKeys(["profile"]); }, [contract]); const tabHeaderItems = useMemo( @@ -56,9 +56,7 @@ const Person: React.FC = ({ contract }) => { [tabItems], ); - const [renderedKeys, setRenderedKeys] = useState(() => [ - "quickwords", - ]); + const [renderedKeys, setRenderedKeys] = useState(() => ["profile"]); useEffect(() => { if (!availableKeys.includes(activeKey) && availableKeys.length > 0) {