feat: 手动刷新对话页面
This commit is contained in:
@@ -78,7 +78,9 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
|||||||
tabRef.current != null && setTabItemSelected(tabRef.current!.value as string)
|
tabRef.current != null && setTabItemSelected(tabRef.current!.value as string)
|
||||||
})
|
})
|
||||||
|
|
||||||
useAsyncEffect(async () => {
|
async function getChatInfoAndInit() {
|
||||||
|
setMessagesList([])
|
||||||
|
page.current = 0
|
||||||
const re = await Client.invoke('Chat.getInfo', {
|
const re = await Client.invoke('Chat.getInfo', {
|
||||||
token: data.access_token,
|
token: data.access_token,
|
||||||
target: target,
|
target: target,
|
||||||
@@ -101,7 +103,8 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
|||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
})
|
})
|
||||||
}, 300)
|
}, 300)
|
||||||
}, [target])
|
}
|
||||||
|
useAsyncEffect(getChatInfoAndInit, [target])
|
||||||
|
|
||||||
const page = React.useRef(0)
|
const page = React.useRef(0)
|
||||||
async function loadMore() {
|
async function loadMore() {
|
||||||
@@ -222,6 +225,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
|||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
addFile(file.type, file.name, file)
|
addFile(file.type, file.name, file)
|
||||||
}
|
}
|
||||||
|
uploadChatAvatarRef.current!.value = ''
|
||||||
})
|
})
|
||||||
useEventListener(uploadChatAvatarRef, 'change', async (_e) => {
|
useEventListener(uploadChatAvatarRef, 'change', async (_e) => {
|
||||||
const file = uploadChatAvatarRef.current!.files?.[0] as File
|
const file = uploadChatAvatarRef.current!.files?.[0] as File
|
||||||
@@ -232,6 +236,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
|||||||
target: target,
|
target: target,
|
||||||
avatar: file
|
avatar: file
|
||||||
})
|
})
|
||||||
|
uploadChatAvatarRef.current!.value = ''
|
||||||
|
|
||||||
if (checkApiSuccessOrSncakbar(re, "修改失败")) return
|
if (checkApiSuccessOrSncakbar(re, "修改失败")) return
|
||||||
snackbar({
|
snackbar({
|
||||||
@@ -283,6 +288,11 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
|||||||
<div style={{
|
<div style={{
|
||||||
flexGrow: '1',
|
flexGrow: '1',
|
||||||
}}></div>
|
}}></div>
|
||||||
|
<mdui-button-icon icon="refresh" onClick={() => getChatInfoAndInit()} style={{
|
||||||
|
alignSelf: 'center',
|
||||||
|
marginLeft: '5px',
|
||||||
|
marginRight: '5px',
|
||||||
|
}}></mdui-button-icon>
|
||||||
<mdui-button-icon icon="info" onClick={() => openChatInfoDialog(chatInfo)} style={{
|
<mdui-button-icon icon="info" onClick={() => openChatInfoDialog(chatInfo)} style={{
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
marginLeft: '5px',
|
marginLeft: '5px',
|
||||||
|
|||||||
Reference in New Issue
Block a user