From e6f794bbd2877c49573f23045b5d09ab6deababd Mon Sep 17 00:00:00 2001 From: leeing <372711472@qq.com> Date: Thu, 11 Jan 2024 14:50:30 +0800 Subject: [PATCH] update uikit --- react/package.json | 2 +- react/src/YXUIKit/im-kit-ui/package.json | 9 +++++---- .../src/chat/containers/p2pChatContainer.tsx | 15 +++++++++++++-- .../src/chat/containers/teamChatContainer.tsx | 15 +++++++++++++-- .../conversation/components/ConversationItem.tsx | 3 +++ vue/package.json | 2 +- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/react/package.json b/react/package.json index 67c8f45..3db187e 100644 --- a/react/package.json +++ b/react/package.json @@ -9,7 +9,7 @@ "dependencies": { "@xkit-yx/call-kit": "^2.0.1", "@xkit-yx/call-kit-react-ui": "^0.4.1", - "@xkit-yx/im-kit-ui": "^9.6.4", + "@xkit-yx/im-kit-ui": "^9.7.0", "react-dom": "^16.8.0", "umi": "^3.5.40" }, diff --git a/react/src/YXUIKit/im-kit-ui/package.json b/react/src/YXUIKit/im-kit-ui/package.json index 0cbae24..66f519a 100644 --- a/react/src/YXUIKit/im-kit-ui/package.json +++ b/react/src/YXUIKit/im-kit-ui/package.json @@ -1,6 +1,6 @@ { "name": "@xkit-yx/im-kit-ui", - "version": "9.6.4", + "version": "9.7.0", "description": "云信即时通讯组件", "license": "MIT", "main": "lib/index.js", @@ -56,12 +56,13 @@ }, "dependencies": { "@ant-design/icons": "^5.0.1", - "@xkit-yx/core-kit": "^0.10.8", - "@xkit-yx/im-store": "^0.0.15", + "@xkit-yx/core-kit": "^0.11.0", + "@xkit-yx/im-store": "^0.1.0", "@xkit-yx/utils": "^0.5.6", "antd": "^4.16.3", "mobx": "^6.6.1", "mobx-react": "^7.5.2", "react-string-replace": "^1.1.0" - } + }, + "gitHead": "f3ce7aa9536c224fcdc0e4a1a26b333be1036442" } diff --git a/react/src/YXUIKit/im-kit-ui/src/chat/containers/p2pChatContainer.tsx b/react/src/YXUIKit/im-kit-ui/src/chat/containers/p2pChatContainer.tsx index 98b9ff7..ebc98d2 100644 --- a/react/src/YXUIKit/im-kit-ui/src/chat/containers/p2pChatContainer.tsx +++ b/react/src/YXUIKit/im-kit-ui/src/chat/containers/p2pChatContainer.tsx @@ -145,6 +145,7 @@ const P2pChatContainer: React.FC = observer( if (historyMsgs.length < storeConstants.HISTORY_LIMIT) { setNoMore(true) } + return historyMsgs } catch (error) { setLoadingMore(false) message.error(t('getHistoryMsgFailedText')) @@ -466,11 +467,21 @@ const P2pChatContainer: React.FC = observer( !['beReCallMsg', 'reCallMsg'].includes(item.attach?.type || '') ).length < 10 ) { - getHistory(Date.now()).then(() => { + getHistory(Date.now()).then((res) => { scrollToBottom() + if (session && !session.lastMsg && res && res[0]) { + store.sessionStore.addSession([{ ...session, lastMsg: res[0] }]) + } }) } - }, [store.msgStore, sessionId, getHistory, scrollToBottom]) + }, [ + store.msgStore, + store.sessionStore, + session, + sessionId, + getHistory, + scrollToBottom, + ]) // 处理消息 useEffect(() => { diff --git a/react/src/YXUIKit/im-kit-ui/src/chat/containers/teamChatContainer.tsx b/react/src/YXUIKit/im-kit-ui/src/chat/containers/teamChatContainer.tsx index 0814e60..f9b4282 100644 --- a/react/src/YXUIKit/im-kit-ui/src/chat/containers/teamChatContainer.tsx +++ b/react/src/YXUIKit/im-kit-ui/src/chat/containers/teamChatContainer.tsx @@ -274,6 +274,7 @@ const TeamChatContainer: React.FC = observer( if (historyMsgs.length < storeConstants.HISTORY_LIMIT) { setNoMore(true) } + return historyMsgs } catch (error) { setLoadingMore(false) message.error(t('getHistoryMsgFailedText')) @@ -835,11 +836,21 @@ const TeamChatContainer: React.FC = observer( !['beReCallMsg', 'reCallMsg'].includes(item.attach?.type || '') ).length < 10 ) { - getHistory(Date.now()).then(() => { + getHistory(Date.now()).then((res) => { scrollToBottom() + if (session && !session.lastMsg && res && res[0]) { + store.sessionStore.addSession([{ ...session, lastMsg: res[0] }]) + } }) } - }, [store.msgStore, sessionId, getHistory, scrollToBottom]) + }, [ + store.msgStore, + store.sessionStore, + session, + sessionId, + getHistory, + scrollToBottom, + ]) // 处理消息 useEffect(() => { diff --git a/react/src/YXUIKit/im-kit-ui/src/conversation/components/ConversationItem.tsx b/react/src/YXUIKit/im-kit-ui/src/conversation/components/ConversationItem.tsx index 0a3b8e5..bc67729 100644 --- a/react/src/YXUIKit/im-kit-ui/src/conversation/components/ConversationItem.tsx +++ b/react/src/YXUIKit/im-kit-ui/src/conversation/components/ConversationItem.tsx @@ -45,6 +45,9 @@ export const ConversationItem: FC = ({ commonPrefix = 'common', }) => { const date = useMemo(() => { + if (!time) { + return '' + } const _d = moment(time) const isCurrentDay = _d.isSame(moment(), 'day') const isCurrentYear = _d.isSame(moment(), 'year') diff --git a/vue/package.json b/vue/package.json index 1c91341..7f4211b 100644 --- a/vue/package.json +++ b/vue/package.json @@ -11,7 +11,7 @@ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore" }, "dependencies": { - "@xkit-yx/im-kit-ui": "^9.6.4", + "@xkit-yx/im-kit-ui": "^9.7.0", "react": "^16.8.0", "react-dom": "^16.8.0", "vue": "^3.2.45"