文件搜索优化

This commit is contained in:
yj 2024-08-20 14:48:49 +08:00
parent c568567b94
commit d020a62464
1 changed files with 7 additions and 18 deletions

View File

@ -41,7 +41,7 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
let userInfo = JSON.parse(storage.getItem('user') as string)
setUser(userInfo)
getRoomFile()
}, [fileList.pageIndex]);
}, [fileList.pageIndex, fileList.keyword]);
// 获取共享文件列表
const getRoomFile = async (): Promise<void> => {
await GetRoomFile({
@ -95,30 +95,19 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
style={{ width: '200px' }}
prefix={<SearchOutlined style={{ color: 'white' }} />}
onChange={(e) => {
setFileList({
...fileList,
keyword: e.target.value
})
}}
onPressEnter={() => {
if (fileList.pageIndex === 1) {
getRoomFile()
} else {
setFileList({
...fileList,
pageIndex: 1
})
}
}}
onBlur={() => {
if (fileList.pageIndex === 1) {
getRoomFile()
setFileList({
...fileList,
keyword: e.target.value,
})
} else {
setFileList({
...fileList,
keyword: e.target.value,
pageIndex: 1
})
}
}}
/>
<ReloadOutlined title='刷新' onClick={() => {