fix: uploads
This commit is contained in:
@@ -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">
|
||||||
|
|||||||
Reference in New Issue
Block a user