开发: 聊天页面修改
This commit is contained in:
@@ -124,9 +124,9 @@ const ChatLogs: React.FC = () => {
|
||||
if (res.err_code == 0) {
|
||||
if (Array.isArray(res.data)) {
|
||||
if (param.curr_page == 1) {
|
||||
setChatLogs([...res.data, { curr_page: param.curr_page }]);
|
||||
setChatLogs([...res.data.reverse(), { curr_page: param.curr_page }]);
|
||||
} else {
|
||||
setChatLogs([...res.data, { curr_page: param.curr_page }, ...chatLogs]);
|
||||
setChatLogs([...res.data.reverse(), { curr_page: param.curr_page }, ...chatLogs]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,28 +270,28 @@ const ChatLogs: React.FC = () => {
|
||||
></div>
|
||||
);
|
||||
} else {
|
||||
if (timeDiffRef.current == '') {
|
||||
timeDiffRef.current = item.msg_time;
|
||||
timeShowRef.current = false;
|
||||
} else {
|
||||
if (
|
||||
Date.parse(item.msg_time) - Date.parse(timeDiffRef.current) >
|
||||
5 * 60 * 1000
|
||||
) {
|
||||
timeDiffRef.current = item.msg_time;
|
||||
timeShowRef.current = true;
|
||||
} else {
|
||||
timeShowRef.current = false;
|
||||
}
|
||||
}
|
||||
// if (timeDiffRef.current == '') {
|
||||
// timeDiffRef.current = item.msg_time;
|
||||
// timeShowRef.current = false;
|
||||
// } else {
|
||||
// if (
|
||||
// new Date(item.msg_time).getTime() - new Date(timeDiffRef.current).getTime() >
|
||||
// 5 * 60 * 1000
|
||||
// ) {
|
||||
// timeDiffRef.current = item.msg_time;
|
||||
// timeShowRef.current = true;
|
||||
// } else {
|
||||
// timeShowRef.current = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (i == 0) {
|
||||
timeShowRef.current = true;
|
||||
}
|
||||
// if (i == 0) {
|
||||
// timeShowRef.current = true;
|
||||
// }
|
||||
|
||||
return (
|
||||
<div key={item.msg_id}>
|
||||
{timeShowRef.current ? <ChatTime msgtime={item.msg_time}></ChatTime> : null}
|
||||
<ChatTime msgtime={item.msg_time}></ChatTime>
|
||||
<ChatBar from={selectStaff} to={selectCustFollow} chat={item}></ChatBar>
|
||||
</div>
|
||||
);
|
||||
|
Reference in New Issue
Block a user