fix(weChat): 修复消息记录显示和右键菜单问题
- 修正消息记录中自己消息的显示样式 - 更新右键菜单图标和功能项 - 优化联系人列表加载逻辑 - 移除无用代码和注释
This commit is contained in:
@@ -19,31 +19,13 @@
|
||||
line-height: 1.5;
|
||||
border-radius: 0;
|
||||
transition: all 0.2s ease;
|
||||
width: 100%;
|
||||
|
||||
&:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
&:global(.ant-menu-item-danger) {
|
||||
color: #ff4d4f;
|
||||
|
||||
&:hover {
|
||||
background-color: #fff2f0;
|
||||
color: #ff4d4f;
|
||||
}
|
||||
}
|
||||
|
||||
&:global(.ant-menu-item-disabled) {
|
||||
color: #bfbfbf;
|
||||
cursor: not-allowed;
|
||||
|
||||
&:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
:global(.ant-menu-item-icon) {
|
||||
margin-right: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ import { Menu, message } from "antd";
|
||||
import {
|
||||
CopyOutlined,
|
||||
DeleteOutlined,
|
||||
ShareAltOutlined,
|
||||
CheckSquareOutlined,
|
||||
RollbackOutlined,
|
||||
ReloadOutlined,
|
||||
ExportOutlined,
|
||||
LinkOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { ChatRecord } from "@/pages/pc/ckbox/data";
|
||||
import styles from "./ClickMenu.module.scss";
|
||||
@@ -130,33 +133,33 @@ const ClickMenu: React.FC<ClickMenuProps> = ({
|
||||
const menuItems = [
|
||||
{
|
||||
key: "copy",
|
||||
icon: <CopyOutlined />,
|
||||
icon: <ExportOutlined />,
|
||||
label: "转发",
|
||||
onClick: handleCopy,
|
||||
disabled: !messageData.content || messageData.msgType === 3, // 图片消息不能复制文本
|
||||
},
|
||||
{
|
||||
key: "forward",
|
||||
icon: <ShareAltOutlined />,
|
||||
icon: <CopyOutlined />,
|
||||
label: "复制",
|
||||
onClick: handleForward,
|
||||
},
|
||||
{
|
||||
key: "copy",
|
||||
icon: <CopyOutlined />,
|
||||
icon: <CheckSquareOutlined />,
|
||||
label: "多条转发",
|
||||
onClick: handleCopy,
|
||||
disabled: !messageData.content || messageData.msgType === 3, // 图片消息不能复制文本
|
||||
},
|
||||
{
|
||||
key: "delete",
|
||||
icon: <DeleteOutlined />,
|
||||
icon: <LinkOutlined />,
|
||||
label: "引用",
|
||||
onClick: handleDelete,
|
||||
},
|
||||
{
|
||||
key: "delete",
|
||||
icon: <DeleteOutlined />,
|
||||
icon: <RollbackOutlined />,
|
||||
label: "撤回",
|
||||
onClick: handleDelete,
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { Avatar, Divider } from "antd";
|
||||
import { Avatar } from "antd";
|
||||
import { UserOutlined, LoadingOutlined } from "@ant-design/icons";
|
||||
import AudioMessage from "./components/AudioMessage/AudioMessage";
|
||||
import SmallProgramMessage from "./components/SmallProgramMessage";
|
||||
@@ -526,7 +526,7 @@ const MessageRecord: React.FC<MessageRecordProps> = ({ contract }) => {
|
||||
className={`${styles.messageItem} ${
|
||||
isOwn ? styles.ownMessage : styles.otherMessage
|
||||
}`}
|
||||
onContextMenu={e => handleContextMenu(e, msg)}
|
||||
onContextMenu={e => isOwn && handleContextMenu(e, msg)}
|
||||
>
|
||||
<div className={styles.messageContent}>
|
||||
{/* 如果不是群聊 */}
|
||||
@@ -538,7 +538,6 @@ const MessageRecord: React.FC<MessageRecordProps> = ({ contract }) => {
|
||||
icon={<UserOutlined />}
|
||||
className={styles.messageAvatar}
|
||||
/>
|
||||
|
||||
<div>
|
||||
{!isOwn && (
|
||||
<div className={styles.messageSender}>
|
||||
@@ -558,7 +557,6 @@ const MessageRecord: React.FC<MessageRecordProps> = ({ contract }) => {
|
||||
icon={<UserOutlined />}
|
||||
className={styles.messageAvatar}
|
||||
/>
|
||||
|
||||
<div>
|
||||
{!isOwn && (
|
||||
<div className={styles.messageSender}>
|
||||
@@ -575,8 +573,17 @@ const MessageRecord: React.FC<MessageRecordProps> = ({ contract }) => {
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{isOwn && <>{parseMessageContent(msg?.content, msg, msg?.msgType)}</>}
|
||||
{isOwn && (
|
||||
<>
|
||||
<Avatar
|
||||
size={32}
|
||||
src={groupMemberAvatar(msg)}
|
||||
icon={<UserOutlined />}
|
||||
className={styles.messageAvatar}
|
||||
/>
|
||||
<div>{parseMessageContent(msg?.content, msg, msg?.msgType)}</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -6,13 +6,10 @@ import SidebarMenu from "./components/SidebarMenu/index";
|
||||
import VerticalUserList from "./components/VerticalUserList";
|
||||
import PageSkeleton from "./components/Skeleton";
|
||||
import styles from "./index.module.scss";
|
||||
import { addChatSession } from "@/store/module/ckchat/ckchat";
|
||||
const { Content, Sider } = Layout;
|
||||
import { chatInitAPIdata, initSocket } from "./main";
|
||||
import { useWeChatStore } from "@/store/module/weChat/weChat";
|
||||
|
||||
import { KfUserListData } from "@/pages/pc/ckbox/data";
|
||||
|
||||
const CkboxPage: React.FC = () => {
|
||||
// 不要在组件初始化时获取sendCommand,而是在需要时动态获取
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -21,23 +18,7 @@ const CkboxPage: React.FC = () => {
|
||||
// 方法一:使用 Promise 链式调用处理异步函数
|
||||
setLoading(true);
|
||||
chatInitAPIdata()
|
||||
.then(response => {
|
||||
// const data = response as {
|
||||
// contractList: any[];
|
||||
// groupList: any[];
|
||||
// kfUserList: KfUserListData[];
|
||||
// newContractList: { groupName: string; contacts: any[] }[];
|
||||
// };
|
||||
// const { contractList } = data;
|
||||
|
||||
// //找出已经在聊天的
|
||||
// const isChatList = contractList.filter(
|
||||
// v => (v?.config && v.config?.chat) || false,
|
||||
// );
|
||||
// isChatList.forEach(v => {
|
||||
// addChatSession(v);
|
||||
// });
|
||||
|
||||
.then(() => {
|
||||
// 数据加载完成后初始化WebSocket连接
|
||||
initSocket();
|
||||
})
|
||||
|
||||
@@ -199,8 +199,10 @@ export const getAllContactList = async () => {
|
||||
|
||||
allContacts = [...allContacts, ...contractList];
|
||||
|
||||
console.log(contractList.length == 0);
|
||||
|
||||
// 如果返回的数据少于请求的数量,说明已经没有更多数据了
|
||||
if (contractList.length < count) {
|
||||
if (contractList.length == 0) {
|
||||
hasMore = false;
|
||||
} else {
|
||||
// 获取最后一条数据的id作为下一次请求的prevId
|
||||
|
||||
Reference in New Issue
Block a user