feat: OCR识别支持拖拽导入

This commit is contained in:
hzm
2026-02-24 08:20:54 +08:00
parent 13992b6155
commit d1bf5db4c5
3 changed files with 106 additions and 6 deletions

View File

@@ -984,9 +984,8 @@ export default function HomePage() {
if (fileInputRef.current) fileInputRef.current.value = '';
};
const handleFilesUpload = async (event) => {
const files = Array.from(event.target.files || []);
if (!files.length) return;
const processFiles = async (files) => {
if (!files?.length) return;
setIsScanning(true);
setScanModalOpen(false); // 关闭选择弹窗
@@ -1129,6 +1128,14 @@ export default function HomePage() {
}
};
const handleFilesUpload = (event) => {
processFiles(Array.from(event.target.files || []));
};
const handleFilesDrop = (files) => {
processFiles(files);
};
const toggleScannedCode = (code) => {
setSelectedScannedCodes(prev => {
const next = new Set(prev);
@@ -4089,6 +4096,7 @@ export default function HomePage() {
<ScanPickModal
onClose={() => setScanModalOpen(false)}
onPick={handleScanPick}
onFilesDrop={handleFilesDrop}
isScanning={isScanning}
/>
)}