Commit 8499954bfe297d6d506143bf168390c21b52cee4

Authored by 史婷婷
2 parents ce0317e7 31819c89

Merge branch 'v1.0' into publish

... ... @@ -13,13 +13,14 @@
13 13 "antd-mobile": "^5.38.1",
14 14 "antd-mobile-icons": "^0.3.0",
15 15 "axios": "^1.7.9",
  16 + "lodash": "^4.17.11",
16 17 "react": "^18.3.1",
17 18 "react-dom": "^18.3.1",
18   - "react-router-dom": "^7.1.1",
19   - "lodash": "^4.17.11"
  19 + "react-router-dom": "^7.1.1"
20 20 },
21 21 "devDependencies": {
22 22 "@eslint/js": "^9.17.0",
  23 + "@types/lodash": "^4.17.7",
23 24 "@types/node": "^22.10.5",
24 25 "@types/react": "^18.3.18",
25 26 "@types/react-dom": "^18.3.5",
... ... @@ -33,7 +34,6 @@
33 34 "postcss-px-to-viewport": "^1.1.1",
34 35 "typescript": "~5.6.2",
35 36 "typescript-eslint": "^8.18.2",
36   - "vite": "^5.3.4",
37   - "@types/lodash": "^4.17.7"
  37 + "vite": "^5.3.4"
38 38 }
39 39 }
... ...
... ... @@ -8,22 +8,21 @@ 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   - setFilePath(props.url);
  15 + const _url = encodeURIComponent(props.url);
  16 + setFilePath(_url);
14 17 }
15 18 },[props.url])
16 19
17   -
18 20 return (
19 21 <div className={'pdfPreview'}>
20   - {/* pdf属性 page 跳转到指定页码,navpanes 控制左侧的缩略图预览导航是否默认打开。0-关闭,1-打开*/}
21   - {/* navpanes=0&scrollbars=0&toolbar=0&statusbar=0 去除缩略图和工具栏 */}
22   - {/* view=FitH,top 为全屏展示 */}
23 22 <iframe
24 23 title="pdf-preview"
25 24 style={{ width: '100%', height: '100%' }}
26   - src={`${filePath}#page=1&navpanes=0&scrollbars=0&toolbar=0&statusbar=0&view=FitH,top`}
  25 + src={`${_origin}/pdf/web/viewer.html?file=${filePath}`}
27 26 />
28 27 </div>
29 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 });
... ...