From b41deedd00c047e50c21ceadbc8119c204d11808 Mon Sep 17 00:00:00 2001 From: xianyi Date: Mon, 5 Jan 2026 15:33:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=8A=A0=E9=A1=B9PDF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/exam/ExamAddonPanel.tsx | 33 +++----------------------- 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/src/components/exam/ExamAddonPanel.tsx b/src/components/exam/ExamAddonPanel.tsx index e00e4da..2ad487c 100644 --- a/src/components/exam/ExamAddonPanel.tsx +++ b/src/components/exam/ExamAddonPanel.tsx @@ -1,7 +1,7 @@ import { useEffect, useMemo, useState, useRef } from 'react'; import type { ExamClient } from '../../data/mockData'; -import { searchPhysicalExamAddItem, getAddItemCustomerInfo, getChannelCompanyList, createNativePaymentQrcode, checkNativePaymentStatus, submitAddItemBillSign } from '../../api'; +import { searchPhysicalExamAddItem, getAddItemCustomerInfo, getChannelCompanyList, createNativePaymentQrcode, checkNativePaymentStatus, getAddItemBillPdf } from '../../api'; import { Button, Input } from '../ui'; import { cls } from '../../utils/cls'; import nozImage from '../../assets/image/noz.png'; @@ -358,43 +358,16 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => { }; }, []); - // 创建空白签名图片(用于自动生成PDF) - const createBlankSignature = (): Promise => { - return new Promise((resolve) => { - const canvas = document.createElement('canvas'); - canvas.width = 400; - canvas.height = 200; - const ctx = canvas.getContext('2d'); - if (ctx) { - // 创建白色背景 - ctx.fillStyle = '#FFFFFF'; - ctx.fillRect(0, 0, canvas.width, canvas.height); - } - canvas.toBlob((blob) => { - if (blob) { - resolve(blob); - } else { - // 如果转换失败,创建一个空的 Blob - resolve(new Blob([], { type: 'image/png' })); - } - }, 'image/png'); - }); - }; - // 获取加项PDF const fetchAddItemBillPdf = async (examId: number) => { try { - // 创建空白签名 - const blankSignature = await createBlankSignature(); - // 调用接口获取加项PDF - const res = await submitAddItemBillSign({ + const res = await getAddItemBillPdf({ exam_id: examId, - sign_file: blankSignature, }); if (res.Status === 200 && res.Data?.pdf_url) { - // 保存加项PDF信息 + // 保存加项PDF信息到localStorage setAddItemBillPdf(examId, { pdf_name: res.Data.pdf_name || '加项单', pdf_url: res.Data.pdf_url,