import React, { Fragment, useState } from 'react'
|
import { Image } from '@arco-design/web-react';
|
import { IconAttachment } from '@arco-design/web-react/icon';
|
import './index.less';
|
import * as $$ from '../../utils/utility';
|
|
const appUrl = $$.appUrl;
|
|
export default function PreviewImage(props) {
|
const [visible, setVisible] = useState(false)
|
const { name, src, ...rest } = props
|
return (
|
<Fragment>
|
<div style={{ display: 'none' }}>
|
<Image.Preview
|
src={`${appUrl.fileUrl}/${appUrl.sys}${src}`}
|
visible={visible}
|
onVisibleChange={setVisible}
|
{...rest}
|
/>
|
</div>
|
<div onClick={() => { setVisible(true) }} style={{ color: '#1a6fb8', cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '4px' }}><IconAttachment style={{ color: '#1A6FB8' }} /><span>{name}</span></div>
|
</Fragment>
|
)
|
}
|