From d81ef3be720adea3548a5b115be2591eef21351d Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Thu, 25 Jul 2024 09:59:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InvitingPersonnelModal/index.tsx | 39 +++++-------------- src/page/Meeting/index.tsx | 15 ++++++- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/components/InvitingPersonnelModal/index.tsx b/src/components/InvitingPersonnelModal/index.tsx index 676d3cc..793a966 100644 --- a/src/components/InvitingPersonnelModal/index.tsx +++ b/src/components/InvitingPersonnelModal/index.tsx @@ -1,5 +1,5 @@ import styles from '@/components/InvitingPersonnelModal/index.module.scss' -import { Button, Checkbox, Input, Modal, Pagination, message } from 'antd'; +import { Button, Checkbox, Input, Modal, Pagination, Radio, message } from 'antd'; import { useState, useImperativeHandle, forwardRef, useEffect } from "react"; import { SearchOutlined } from '@ant-design/icons'; import { GetUserList } from '@/api/Home/User'; @@ -20,16 +20,7 @@ const InvitingPersonnelModal = forwardRef((props: any, ref: any) => { const [isInvitingPersonnelModal, setIsInvitingPersonnelModal] = useState(false); const [isFirstRender, setIsFirstRender] = useState(true); const [user, setUser] = useState({}); - const [operation, setOperation] = useState<{ - options: { label: string; value: number }[]; - optionsValue: number[]; - }>({ - options: [ - { label: '在线', value: 1 }, - { label: '不在线', value: 2 }, - ], - optionsValue: [1] - }); + const [optionsValue, setOperationValue] = useState(1); const [list, setList] = useState({ data: [], searchKeywod: '', @@ -60,15 +51,7 @@ const InvitingPersonnelModal = forwardRef((props: any, ref: any) => { }) } } - }, [operation.optionsValue]); - - // 设置勾选 - const changeOptionsValue = (checkedValues: number[]): void => { - setOperation({ - ...operation, - optionsValue: checkedValues, - }) - }; + }, [optionsValue]); // 获取用户列表 const getUserList = async (): Promise => { Promise.all([ @@ -77,7 +60,7 @@ const InvitingPersonnelModal = forwardRef((props: any, ref: any) => { pageIndex: list.pageIndex, pageSize: list.pageSize, searchKeywod: list.searchKeywod, - isOnline: operation.optionsValue.length === 1 ? operation.optionsValue[0] === 1 ? true : false : '', + isOnline: optionsValue === 1 ? true : false, }) ]).then(res => { if (res[0].code === 200 && res[1].code === 200) { @@ -130,14 +113,12 @@ const InvitingPersonnelModal = forwardRef((props: any, ref: any) => { } }} /> - { - changeOptionsValue(e) - }} - /> + { + setOperationValue(e.target.value) + }} style={{ flexShrink: 0, margin: '10px 0' }} value={optionsValue}> + 在线 + 离线 +
{list.data.length ? list.data.map((item: any, index: number) =>
diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index 16ea37f..ef14b31 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -119,6 +119,7 @@ const Meeting: React.FC = () => { const [open, setOpen] = useState(false) const [meetingMode, setMeetingMode] = useState('') const [userSearchValue, setUserSearchValue] = useState('') + const [noViewChatList, setNoViewChatList] = useState(0) useEffect(() => { let time = null as any; if (isInit) { @@ -171,6 +172,7 @@ const Meeting: React.FC = () => { setCurrentVideoId(userInfo.account) setUser(userInfo) setIsInit(false) + storage.setItem('noViewChatList', 0) window.addEventListener('customStorageChange', handleCustomStorageChange); window.addEventListener('online', handleNetworkChange); window.addEventListener('offline', handleNetworkChange); @@ -215,6 +217,12 @@ const Meeting: React.FC = () => { onSignalr((item: any) => { switch (item.key) { case 'ReceiveMessage': + let meetingUserChatDom = document.getElementById('meetingUserChat') as HTMLElement; + if (!meetingUserChatDom) { + let storageNoViewChatList = Number(storage.getItem('noViewChatList')) + storage.setItem('noViewChatList', storageNoViewChatList += 1) + setNoViewChatList(storageNoViewChatList) + } setChatList((newChatList: any) => [...newChatList, item]) break; case 'RefreshUserList': @@ -290,12 +298,16 @@ const Meeting: React.FC = () => { userList: statusList.userList ? false : true, userChatList: false, }) + storage.setItem('noViewChatList', 0) + setNoViewChatList(0) break; case '聊天': setStatusList({ userList: false, userChatList: statusList.userChatList ? false : true, }) + storage.setItem('noViewChatList', 0) + setNoViewChatList(0) break; case '共享屏幕': getDesktopCapturerVideo() @@ -722,7 +734,7 @@ const Meeting: React.FC = () => {
: -
+
聊天 { @@ -792,6 +804,7 @@ const Meeting: React.FC = () => { {row.title} {row.title === '成员列表' ?
{roomUserList.length}
: null} + {row.title === '聊天' && noViewChatList > 0 ?
{noViewChatList}
: null}
) })}