This commit is contained in:
xx
2026-02-28 15:09:53 +08:00
parent e37d605e38
commit d451cb1172
9 changed files with 725 additions and 277 deletions

View File

@@ -1,5 +1,7 @@
# React + TypeScript + Vite # React + TypeScript + Vite
`cp node_modules/pdfjs-dist/build/pdf.worker.min.mjs public/pdf.worker.min.mjs`
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available: Currently, two official plugins are available:

946
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,7 @@
}, },
"dependencies": { "dependencies": {
"axios": "^1.13.2", "axios": "^1.13.2",
"pdfjs-dist": "^5.4.449", "pdfjs-dist": "^4.4.168",
"react": "^19.2.0", "react": "^19.2.0",
"react-dom": "^19.2.0", "react-dom": "^19.2.0",
"react-router-dom": "^7.9.6" "react-router-dom": "^7.9.6"

View File

@@ -7,8 +7,8 @@ const API_CONFIG = {
INTERNAL_URL: 'http://10.1.5.118:8077/platform-api', INTERNAL_URL: 'http://10.1.5.118:8077/platform-api',
// 外网地址HTTPS // 外网地址HTTPS
EXTERNAL_URL: 'http://apihis.circleharmonyhospital.cn:8982/platform-api', EXTERNAL_URL: 'http://apihis.circleharmonyhospital.cn:8982/platform-api',
BASE_URL: import.meta.env.NODE_ENV === 'development' BASE_URL: import.meta.env.MODE === 'development'
? 'http://10.1.5.118:8077/platform-api' ? '/platform-api'
: 'http://apihis.circleharmonyhospital.cn:8982/platform-api', : 'http://apihis.circleharmonyhospital.cn:8982/platform-api',
TIMEOUT: 120000, TIMEOUT: 120000,
}; };

View File

@@ -1186,7 +1186,17 @@ export const ExamAddonPanel = ({ client, onGoToSign }: ExamAddonPanelProps) => {
className='mt-0.5 w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500' className='mt-0.5 w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500'
/> />
<div className='flex-1 min-w-0'> <div className='flex-1 min-w-0'>
<div className='font-semibold text-[14px] text-gray-900'>{item.name}</div> <div
className='font-semibold text-[14px] text-gray-900'
style={{
display: '-webkit-box',
WebkitLineClamp: 2,
WebkitBoxOrient: 'vertical',
overflow: 'hidden',
}}
>
{item.name}
</div>
</div> </div>
</div> </div>

View File

@@ -1,13 +1,11 @@
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import * as pdfjsLib from 'pdfjs-dist'; import * as pdfjsLib from 'pdfjs-dist';
import pdfjsWorker from 'pdfjs-dist/build/pdf.worker.min.mjs?url';
import { getDaojiandanPdf as getDaojiandanPdfApi, submitDaojiandanSign, editDaojiandanPrintStatus } from '../../api'; import { getDaojiandanPdf as getDaojiandanPdfApi, submitDaojiandanSign, editDaojiandanPrintStatus } from '../../api';
import type { ExamClient } from '../../data/mockData'; import type { ExamClient } from '../../data/mockData';
import type { SignaturePadHandle } from '../ui'; import type { SignaturePadHandle } from '../ui';
import { Button, SignaturePad } from '../ui'; import { Button, SignaturePad } from '../ui';
// Polyfill for Promise.withResolvers
if (typeof (Promise as any).withResolvers === 'undefined') { if (typeof (Promise as any).withResolvers === 'undefined') {
(Promise as any).withResolvers = function <T>() { (Promise as any).withResolvers = function <T>() {
let resolve!: (value: T | PromiseLike<T>) => void; let resolve!: (value: T | PromiseLike<T>) => void;
@@ -20,8 +18,14 @@ if (typeof (Promise as any).withResolvers === 'undefined') {
}; };
} }
// 配置 PDF.js worker if (typeof (Promise as any).try === 'undefined') {
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsWorker; (Promise as any).try = function (fn: () => any) {
return new Promise((resolve) => resolve(fn()));
};
}
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.mjs';
export const ExamPrintPanel = ({ client }: { client: ExamClient }) => { export const ExamPrintPanel = ({ client }: { client: ExamClient }) => {
const [pdfUrl, setPdfUrl] = useState<string | null>(null); const [pdfUrl, setPdfUrl] = useState<string | null>(null);

View File

@@ -1,6 +1,6 @@
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import * as pdfjsLib from 'pdfjs-dist'; import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf.mjs';
import pdfjsWorker from 'pdfjs-dist/build/pdf.worker.min.mjs?url'; import pdfWorkerSrc from 'pdfjs-dist/build/pdf.worker.min.mjs?url';
import type { OutputTongyishuFileInfo, OutputTijianPdfFileInfo, OutputPhysicalExamItemInfo } from '../../api'; import type { OutputTongyishuFileInfo, OutputTijianPdfFileInfo, OutputPhysicalExamItemInfo } from '../../api';
import { import {
@@ -20,7 +20,6 @@ import {
import type { SignaturePadHandle } from '../ui'; import type { SignaturePadHandle } from '../ui';
import { Button, SignaturePad } from '../ui'; import { Button, SignaturePad } from '../ui';
// Polyfill for Promise.withResolvers
if (typeof (Promise as any).withResolvers === 'undefined') { if (typeof (Promise as any).withResolvers === 'undefined') {
(Promise as any).withResolvers = function <T>() { (Promise as any).withResolvers = function <T>() {
let resolve!: (value: T | PromiseLike<T>) => void; let resolve!: (value: T | PromiseLike<T>) => void;
@@ -33,8 +32,13 @@ if (typeof (Promise as any).withResolvers === 'undefined') {
}; };
} }
// 配置 PDF.js worker if (typeof (Promise as any).try === 'undefined') {
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsWorker; (Promise as any).try = function (fn: () => any) {
return new Promise((resolve) => resolve(fn()));
};
}
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfWorkerSrc;
interface ExamSignPanelProps { interface ExamSignPanelProps {
examId?: number; examId?: number;

View File

@@ -180,7 +180,7 @@ export const HomeSection = () => {
</Card> </Card>
)} )}
<div className='grid grid-cols-2 gap-4 pb-4'> <div className='grid grid-cols-2 gap-4 pb-10'>
<Card> <Card>
<CardHeader>B1 </CardHeader> <CardHeader>B1 </CardHeader>
<CardContent> <CardContent>

6
src/vite-env.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="vite/client" />
declare module '*?url' {
const src: string;
export default src;
}