Commit 01d3ee635a0656d68b3bb2d8e98a57db4d73d56b

Authored by 史婷婷
1 parent 63e825f3

feat: 安卓app访问pdf

... ... @@ -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 }
... ...
... ... @@ -10,25 +10,17 @@ const pdfPreview = (props: pdfPreviewProps) => {
10 10
11 11 useEffect(()=>{
12 12 if (props.url) {
13   - // const _url = encodeURIComponent(props.url);
14   - const _url = props.url;
  13 + const _url = encodeURIComponent(props.url);
15 14 setFilePath(_url);
16 15 }
17 16 },[props.url])
18 17
19   - // #viewerContainer margin-bottom: 0;
20   -
21   -
22 18 return (
23 19 <div className={'pdfPreview'}>
24   - {/* pdf属性 page 跳转到指定页码,navpanes 控制左侧的缩略图预览导航是否默认打开。0-关闭,1-打开*/}
25   - {/* navpanes=0&scrollbars=0&toolbar=0&statusbar=0 去除缩略图和工具栏 */}
26   - {/* view=FitH,top 为全屏展示 */}
27 20 <iframe
28 21 title="pdf-preview"
29 22 style={{ width: '100%', height: '100%' }}
30   - src={`${filePath}#page=1&navpanes=0&scrollbars=0&toolbar=0&statusbar=0&view=FitH,top`}
31   - // src={`https://h5jianke.21tb.com/file/generic_mobile/web/viewer.html?file=${filePath}#page=1&navpanes=0&scrollbars=0&toolbar=0&statusbar=0&view=FitH,top`}
  23 + src={`https://h5jianke.21tb.com/file/generic_mobile/web/viewer.html?file=${filePath}`}
32 24 />
33 25 </div>
34 26 );
... ...