forked from gzzfw/frontEnd/gzDyh

zhangyongtian
2024-09-15 e4a0fd2497ccbcbb6a9806fd147e8bf366215d15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import React, { Fragment, useState } from 'react'
import { Image } from '@arco-design/web-react';
import { link } from '@/assets/images';
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: 'inline-block'}}><img src={link} alt="" className="title-file" />{name}</div>
    </Fragment>
  )
}