diff --git a/apps/admin/src/pages/StudentProfile/index.tsx b/apps/admin/src/pages/StudentProfile/index.tsx
index d88fe70..c62b5c3 100644
--- a/apps/admin/src/pages/StudentProfile/index.tsx
+++ b/apps/admin/src/pages/StudentProfile/index.tsx
@@ -1,9 +1,10 @@
import React from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import { Card, Button, Space } from 'antd';
-import { ArrowLeftOutlined, DownloadOutlined } from '@ant-design/icons';
+import { ArrowLeftOutlined, EyeOutlined } from '@ant-design/icons';
import StudentProfileContent from '../../components/StudentProfileContent';
import PermissionButton from '../../components/PermissionButton';
+import api from '../../api';
const StudentProfilePage: React.FC = () => {
const { id } = useParams<{ id: string }>();
@@ -13,9 +14,17 @@ const StudentProfilePage: React.FC = () => {
const studentId = Number(id);
- const handleDownloadReport = () => {
- const token = localStorage.getItem('token');
- window.open(`/api/archive/${studentId}/report?token=${token}`, '_blank');
+ const handlePreviewReport = async () => {
+ try {
+ const { html } = await api.get<{ html: string }>(`/archive/${studentId}/report-html`);
+ const w = window.open('', '_blank');
+ if (w) {
+ w.document.write(html);
+ w.document.close();
+ }
+ } catch (err) {
+ console.error('Failed to load report HTML:', err);
+ }
};
return (
@@ -30,10 +39,10 @@ const StudentProfilePage: React.FC = () => {
}
- onClick={handleDownloadReport}
+ icon={}
+ onClick={handlePreviewReport}
>
- 生成档案报表
+ 预览报告
}
>