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) {