Commit 31819c898e7d7c2f0db36e913ca7aa77b27ae0c0

Authored by 史婷婷
1 parent 01d3ee63

feat: pdf-安卓访问不了,解决

... ... @@ -8,6 +8,8 @@ interface pdfPreviewProps {
8 8 const pdfPreview = (props: pdfPreviewProps) => {
9 9 const [filePath, setFilePath] = useState<string>();
10 10
  11 + const _origin = window.location.origin;
  12 +
11 13 useEffect(()=>{
12 14 if (props.url) {
13 15 const _url = encodeURIComponent(props.url);
... ... @@ -20,7 +22,7 @@ const pdfPreview = (props: pdfPreviewProps) => {
20 22 <iframe
21 23 title="pdf-preview"
22 24 style={{ width: '100%', height: '100%' }}
23   - src={`https://h5jianke.21tb.com/file/generic_mobile/web/viewer.html?file=${filePath}`}
  25 + src={`${_origin}/pdf/web/viewer.html?file=${filePath}`}
24 26 />
25 27 </div>
26 28 );
... ...
... ... @@ -105,7 +105,7 @@ const ProductionList: React.FC = () => {
105 105 ...it,
106 106 url: results?.[index] || ''
107 107 }
108   - })
  108 + }) || [];
109 109 localStorage.setItem('sxPreViewListStorage', JSON.stringify(sxPreViewList));
110 110 localStorage.setItem('sxListPath', `${location?.pathname}${location?.search}`);
111 111 navigate(`/production/detail?name=${sxPreViewList?.[0]?.name}`, { replace: true });
... ...