fix: uploads

This commit is contained in:
2026-03-14 21:57:07 +08:00
parent 5c096ae753
commit 6ebf03d351

View File

@@ -20,6 +20,8 @@ import {
} from 'antd'; } from 'antd';
import { import {
CloudUploadOutlined, CloudUploadOutlined,
CameraOutlined,
PictureOutlined,
ScanOutlined, ScanOutlined,
MergeCellsOutlined, MergeCellsOutlined,
ApartmentOutlined, ApartmentOutlined,
@@ -182,58 +184,7 @@ const Workspace: React.FC = () => {
}, },
]; ];
return ( const handleBeforeUpload = (file: File) => {
<div>
<Card style={{ marginBottom: 24 }}>
<Row justify="space-between" align="middle">
<Col>
<Space direction="vertical" size={4}>
<Space>
<Typography.Title level={4} style={{ margin: 0 }}>
{currentCase.title}
</Typography.Title>
<Tag color="orange"></Tag>
</Space>
<Typography.Text type="secondary">
{currentCase.caseNo} · {currentCase.handler} · {currentCase.victimName}
</Typography.Text>
</Space>
</Col>
<Col>
<Statistic
title="当前识别被骗金额"
value={currentCase.totalAmount}
precision={2}
prefix="¥"
valueStyle={{ color: '#cf1322', fontSize: 28 }}
/>
</Col>
</Row>
</Card>
<Card style={{ marginBottom: 24 }}>
<Steps
current={currentStep}
items={steps}
/>
</Card>
<Row gutter={24}>
<Col span={16}>
<Card
title="快速上传截图"
style={{ marginBottom: 24 }}
extra={
<Typography.Text type="secondary">
JPG/PNG
</Typography.Text>
}
>
<Dragger
multiple
accept="image/*"
showUploadList={false}
beforeUpload={(file) => {
if (!batchActiveRef.current) { if (!batchActiveRef.current) {
batchActiveRef.current = true; batchActiveRef.current = true;
batchCounterRef.current = { success: 0, failed: 0 }; batchCounterRef.current = { success: 0, failed: 0 };
@@ -246,7 +197,7 @@ const Workspace: React.FC = () => {
} }
const localId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`; const localId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
const previewUrl = URL.createObjectURL(file as File); const previewUrl = URL.createObjectURL(file);
setUploadingCount((c) => { setUploadingCount((c) => {
const next = c + 1; const next = c + 1;
message.open({ message.open({
@@ -267,7 +218,7 @@ const Workspace: React.FC = () => {
previewUrl, previewUrl,
}, },
]); ]);
uploadImages(id, [file as File]) uploadImages(id, [file])
.then((uploaded) => { .then((uploaded) => {
const uploadedImage = uploaded?.[0]; const uploadedImage = uploaded?.[0];
setUploadBatchItems((prev) => setUploadBatchItems((prev) =>
@@ -320,7 +271,78 @@ const Workspace: React.FC = () => {
}); });
}); });
return false; return false;
}} };
return (
<div>
<Card style={{ marginBottom: 24 }}>
<Row justify="space-between" align="middle">
<Col>
<Space direction="vertical" size={4}>
<Space>
<Typography.Title level={4} style={{ margin: 0 }}>
{currentCase.title}
</Typography.Title>
<Tag color="orange"></Tag>
</Space>
<Typography.Text type="secondary">
{currentCase.caseNo} · {currentCase.handler} · {currentCase.victimName}
</Typography.Text>
</Space>
</Col>
<Col>
<Statistic
title="当前识别被骗金额"
value={currentCase.totalAmount}
precision={2}
prefix="¥"
valueStyle={{ color: '#cf1322', fontSize: 28 }}
/>
</Col>
</Row>
</Card>
<Card style={{ marginBottom: 24 }}>
<Steps
current={currentStep}
items={steps}
/>
</Card>
<Row gutter={24}>
<Col span={16}>
<Card
title="快速上传截图"
style={{ marginBottom: 24 }}
extra={
<Typography.Text type="secondary">
/
</Typography.Text>
}
>
<Space wrap style={{ marginBottom: 12 }}>
<Upload
accept="image/*"
capture="environment"
showUploadList={false}
beforeUpload={(file) => handleBeforeUpload(file as File)}
>
<Button icon={<CameraOutlined />}></Button>
</Upload>
<Upload
multiple
accept="image/*"
showUploadList={false}
beforeUpload={(file) => handleBeforeUpload(file as File)}
>
<Button icon={<PictureOutlined />}></Button>
</Upload>
</Space>
<Dragger
multiple
accept="image/*"
showUploadList={false}
beforeUpload={(file) => handleBeforeUpload(file as File)}
style={{ padding: '20px 0' }} style={{ padding: '20px 0' }}
> >
<p className="ant-upload-drag-icon"> <p className="ant-upload-drag-icon">