11.18 修改获取下载路径的方法,让页面内pdf组件正常获取文件链接

This commit is contained in:
jl-zhoujl2
2022-11-18 17:22:37 +08:00
parent bb9013a612
commit fe5f9dbb2d
4 changed files with 45 additions and 10 deletions

View File

@ -3,7 +3,7 @@ import { Modal, Button } from 'antd';
import PDF from 'react-pdf-js';
import ProCard from '@ant-design/pro-card';
import FileDown from '@/utils/Download';
import { getDownloadFileUrl, getFileListByBid } from '../DownloadUtils';
import { getFileListByBid, useDownLoadUrl } from '../DownloadUtils';
/**
* Pdf Modal弹窗公共组件
* 2021.8.25 zhoujianlong 根据定标结果通知书的弹出窗口改造初始版本,增加备注
@ -17,6 +17,7 @@ interface PdfModalProps {
const PdfModal: React.FC<PdfModalProps> = (props) => {
const { fileId, downLoadFileName, modalVisible, onCancel } = props;
const [url] = useDownLoadUrl(fileId);
const [page, setPage] = useState<number>(1); //页码
const [pages, setPages] = useState<number>(0); //总页数
const [fileExist, setFileExist] = useState<string>('0'); //0未验证1验证后有2验证后没有
@ -93,10 +94,10 @@ const PdfModal: React.FC<PdfModalProps> = (props) => {
<ProCard layout="center" direction="column" ghost>
{fileExist == '0' ? (
<div />
) : fileExist == '1' ? (
) : fileExist == '1' ? url != "" && (
<>
<PDF
file={getDownloadFileUrl(fileId)}
file={url}
scale={1.6}
onDocumentComplete={onDocumentComplete}
page={page}