开发: 聊天页面修改

This commit is contained in:
zhengw
2023-04-12 10:10:16 +08:00
parent ce3d942371
commit d67758d361
13 changed files with 416 additions and 52 deletions

View File

@@ -1,13 +1,17 @@
import { Image } from 'antd';
import { useState } from 'react';
import { IChatItem } from '../ChatLogsType';
import styles from './index.module.scss';
export const ChatImage: React.FC<IChatItem> = (props) => {
const [visible, setVisible] = useState(false);
function content() {
try {
const msg = JSON.parse(props.chat?.content as string);
return (
<div
className={styles.imgPreview}
style={{
display: 'flex',
color: '#000',
@@ -16,7 +20,13 @@ export const ChatImage: React.FC<IChatItem> = (props) => {
justifyContent: 'center',
}}
>
<img
<Image
preview={{
visible: visible,
onVisibleChange: (value, prevValue, currentIndex) => {
setVisible(value);
},
}}
src={`/api/${msg.path}`}
style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }}
alt=""