新增 文件拖入操作和评分功能和优化筛选
This commit is contained in:
1 parent
491a56ef1d
commit
85e7711c1a
15 files changed
+1283
-72
No files matched your search
@@ -14,6 +14,7 @@
|
||||
"crypto": "^1.0.1",
|
||||
"express": "^4.18.2",
|
||||
"glob": "^10.3.10",
|
||||
"multer": "^2.0.0-rc.4",
|
||||
"p-limit": "^7.2.0",
|
||||
"sharp": "^0.33.0",
|
||||
"socket.io": "^4.6.0",
|
||||
|
||||
+5
-1
@@ -57,7 +57,9 @@ function createApp(dependencies) {
|
||||
|
||||
const fileService = new FileService(dbPool, configManager);
|
||||
|
||||
// 将服务注入到 app 中,供路由使用
|
||||
// 将服务和依赖注入到 app 中,供路由使用
|
||||
app.set('configManager', configManager);
|
||||
app.set('dbPool', dbPool);
|
||||
app.set('libraryService', libraryService);
|
||||
app.set('imageService', imageService);
|
||||
app.set('scanService', scanService);
|
||||
@@ -68,11 +70,13 @@ function createApp(dependencies) {
|
||||
const imageRouter = require('./routes/image');
|
||||
const scanRouter = require('./routes/scan');
|
||||
const fileRouter = require('./routes/file');
|
||||
const uploadRouter = require('./routes/upload');
|
||||
|
||||
app.use('/api/library', libraryRouter);
|
||||
app.use('/api/image', imageRouter);
|
||||
app.use('/api/scan', scanRouter);
|
||||
app.use('/api/file', fileRouter);
|
||||
app.use('/api/upload', uploadRouter);
|
||||
|
||||
// 健康检查
|
||||
app.get('/api/health', (req, res) => {
|
||||
|
||||
@@ -167,4 +167,30 @@ router.get('/original/:libraryId/*', (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 更新图片评分
|
||||
* PUT /api/image/rating
|
||||
* Body: { libraryId, paths: [string], rating: number }
|
||||
*/
|
||||
router.put('/rating', asyncHandler(async (req, res) => {
|
||||
const { libraryId, paths, rating } = req.body;
|
||||
|
||||
if (!libraryId || !paths || !Array.isArray(paths) || paths.length === 0) {
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
message: '缺少必要参数: libraryId, paths'
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof rating !== 'number' || rating < 0 || rating > 5) {
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
message: '评分必须是 0-5 之间的整数'
|
||||
});
|
||||
}
|
||||
|
||||
const result = await imageService.updateRating(libraryId, paths, rating);
|
||||
res.json({ success: true, data: result });
|
||||
}));
|
||||
|
||||
module.exports = router;
|
||||
@@ -0,0 +1,231 @@
|
||||
/**
|
||||
* 文件上传路由
|
||||
* 支持拖拽上传图片到指定文件夹
|
||||
*/
|
||||
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const multer = require('multer');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { asyncHandler } = require('../middleware/errorHandler');
|
||||
const { processImage } = require('../../utils/scanner');
|
||||
|
||||
// 配置 multer 使用内存存储
|
||||
const storage = multer.memoryStorage();
|
||||
const upload = multer({
|
||||
storage: storage,
|
||||
limits: {
|
||||
fileSize: 100 * 1024 * 1024, // 100MB
|
||||
}
|
||||
// 移除文件格式限制,让扫描逻辑自动处理
|
||||
});
|
||||
|
||||
/**
|
||||
* 上传图片到指定文件夹
|
||||
* POST /api/upload
|
||||
* FormData: { libraryId, targetFolder, files[], conflictAction? }
|
||||
* conflictAction: 'skip' | 'replace' | 'rename'
|
||||
*/
|
||||
router.post('/', upload.array('files', 50), asyncHandler(async (req, res) => {
|
||||
console.log('📤 收到上传请求');
|
||||
console.log(' libraryId:', req.body.libraryId);
|
||||
console.log(' targetFolder:', req.body.targetFolder);
|
||||
console.log(' conflictAction:', req.body.conflictAction);
|
||||
console.log(' 文件数量:', req.files?.length);
|
||||
|
||||
const { libraryId, targetFolder, conflictAction } = req.body;
|
||||
const files = req.files;
|
||||
|
||||
if (!libraryId) {
|
||||
console.error('❌ 缺少 libraryId 参数');
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
error: '缺少 libraryId 参数'
|
||||
});
|
||||
}
|
||||
|
||||
if (!files || files.length === 0) {
|
||||
console.error('❌ 没有上传文件');
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
error: '没有上传文件'
|
||||
});
|
||||
}
|
||||
|
||||
// 获取依赖
|
||||
const dbPool = req.app.get('dbPool');
|
||||
const configManager = req.app.get('configManager');
|
||||
|
||||
if (!dbPool || !configManager) {
|
||||
console.error('❌ 服务未初始化');
|
||||
return res.status(500).json({
|
||||
success: false,
|
||||
error: '服务未初始化'
|
||||
});
|
||||
}
|
||||
|
||||
// 获取素材库配置
|
||||
const config = configManager.load();
|
||||
const library = config.libraries.find(lib => lib.id === libraryId);
|
||||
|
||||
if (!library) {
|
||||
console.error('❌ 素材库不存在:', libraryId);
|
||||
return res.status(404).json({
|
||||
success: false,
|
||||
error: '素材库不存在'
|
||||
});
|
||||
}
|
||||
|
||||
// 获取数据库实例
|
||||
const db = dbPool.acquire(library.path);
|
||||
const libraryPath = library.path;
|
||||
const targetPath = targetFolder
|
||||
? path.join(libraryPath, targetFolder)
|
||||
: libraryPath;
|
||||
|
||||
// 确保目标文件夹存在
|
||||
if (!fs.existsSync(targetPath)) {
|
||||
fs.mkdirSync(targetPath, { recursive: true });
|
||||
}
|
||||
|
||||
const results = {
|
||||
success: [],
|
||||
failed: [],
|
||||
conflicts: [] // 改为 conflicts,与粘贴逻辑一致
|
||||
};
|
||||
|
||||
// 用于后台处理的文件列表
|
||||
const filesToProcess = [];
|
||||
|
||||
// 第一阶段:保存文件(根据 conflictAction 处理冲突)
|
||||
for (const file of files) {
|
||||
try {
|
||||
// 修复中文文件名乱码:multer 默认使用 latin1 编码,需要转换为 utf8
|
||||
let filename = Buffer.from(file.originalname, 'latin1').toString('utf8');
|
||||
let filePath = path.join(targetPath, filename);
|
||||
|
||||
// 检查文件是否已存在
|
||||
if (fs.existsSync(filePath)) {
|
||||
// 如果没有指定冲突处理方式,收集冲突信息返回给前端
|
||||
if (!conflictAction) {
|
||||
const relativePath = targetFolder
|
||||
? path.join(targetFolder, filename).replace(/\\/g, '/')
|
||||
: filename;
|
||||
results.conflicts.push({
|
||||
name: filename,
|
||||
path: relativePath
|
||||
});
|
||||
console.log(`⚠️ 冲突: ${filename} (文件已存在)`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 根据 conflictAction 处理冲突
|
||||
if (conflictAction === 'skip') {
|
||||
console.log(`⏭️ 跳过: ${filename} (文件已存在)`);
|
||||
continue;
|
||||
} else if (conflictAction === 'replace') {
|
||||
// 覆盖:删除旧文件
|
||||
console.log(`🔄 覆盖: ${filename}`);
|
||||
fs.unlinkSync(filePath);
|
||||
} else if (conflictAction === 'rename') {
|
||||
// 重命名:生成新文件名
|
||||
const ext = path.extname(filename);
|
||||
const nameWithoutExt = filename.substring(0, filename.length - ext.length);
|
||||
let counter = 1;
|
||||
let newFilename = filename;
|
||||
let newFilePath = filePath;
|
||||
|
||||
while (fs.existsSync(newFilePath)) {
|
||||
newFilename = `${nameWithoutExt} (${counter})${ext}`;
|
||||
newFilePath = path.join(targetPath, newFilename);
|
||||
counter++;
|
||||
}
|
||||
|
||||
filename = newFilename;
|
||||
filePath = newFilePath;
|
||||
console.log(`📝 重命名: ${file.originalname} → ${filename}`);
|
||||
}
|
||||
}
|
||||
|
||||
// 写入文件(同步,快速)
|
||||
fs.writeFileSync(filePath, file.buffer);
|
||||
console.log(`📥 已保存: ${filename} (${(file.size / 1024).toFixed(2)} KB)`);
|
||||
|
||||
// 计算相对路径(使用最终的文件名)
|
||||
const relativePath = targetFolder
|
||||
? path.join(targetFolder, filename).replace(/\\/g, '/')
|
||||
: filename;
|
||||
|
||||
results.success.push({
|
||||
filename,
|
||||
path: relativePath,
|
||||
size: file.size
|
||||
});
|
||||
|
||||
// 添加到待处理列表(只处理图片文件)
|
||||
const ext = path.extname(filename).toLowerCase();
|
||||
const imageExts = ['.jpg', '.jpeg', '.png', '.webp', '.gif', '.bmp', '.tiff', '.svg'];
|
||||
if (imageExts.includes(ext)) {
|
||||
filesToProcess.push({ filePath, filename });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`❌ 保存失败: ${file.originalname}`, error);
|
||||
results.failed.push({
|
||||
filename: file.originalname,
|
||||
error: error.message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 第二阶段:后台异步处理图片(生成缩略图、提取元数据)
|
||||
// 不阻塞响应,让前端可以立即刷新
|
||||
if (filesToProcess.length > 0) {
|
||||
setImmediate(async () => {
|
||||
console.log(`🔄 开始后台处理 ${filesToProcess.length} 个图片...`);
|
||||
for (const { filePath, filename } of filesToProcess) {
|
||||
try {
|
||||
await processImage(filePath, libraryPath, db.db);
|
||||
console.log(`✅ 已处理: ${filename}`);
|
||||
} catch (processError) {
|
||||
console.error(`❌ 处理图片失败: ${filename}`, processError.message);
|
||||
}
|
||||
}
|
||||
console.log(`✅ 后台处理完成`);
|
||||
});
|
||||
}
|
||||
|
||||
// 更新文件夹图片计数
|
||||
if (targetFolder && results.success.length > 0) {
|
||||
try {
|
||||
console.log(`📊 更新文件夹计数: ${targetFolder}`);
|
||||
const updateStmt = db.db.prepare(`
|
||||
UPDATE folders
|
||||
SET image_count = (
|
||||
SELECT COUNT(*) FROM images WHERE folder = ? OR folder LIKE ?
|
||||
),
|
||||
last_scan = ?
|
||||
WHERE path = ?
|
||||
`);
|
||||
updateStmt.run(
|
||||
targetFolder,
|
||||
targetFolder + '/%',
|
||||
Date.now(),
|
||||
targetFolder
|
||||
);
|
||||
console.log(`✅ 文件夹计数已更新`);
|
||||
} catch (error) {
|
||||
console.error('❌ 更新文件夹计数失败:', error);
|
||||
console.error(' 错误详情:', error.stack);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`📋 上传结果: 成功 ${results.success.length}, 失败 ${results.failed.length}, 冲突 ${results.conflicts.length}`);
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
data: results
|
||||
});
|
||||
}));
|
||||
|
||||
module.exports = router;
|
||||
@@ -162,6 +162,52 @@ class ImageService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新图片评分
|
||||
*/
|
||||
async updateRating(libraryId, paths, rating) {
|
||||
const library = this._getLibrary(libraryId);
|
||||
const db = this.dbPool.acquire(library.path);
|
||||
|
||||
try {
|
||||
const imageModel = new ImageModel(db.db);
|
||||
const results = {
|
||||
success: [],
|
||||
failed: []
|
||||
};
|
||||
|
||||
// 批量更新
|
||||
for (const imagePath of paths) {
|
||||
try {
|
||||
const stmt = db.db.prepare('UPDATE images SET rating = ? WHERE path = ?');
|
||||
const result = stmt.run(rating, imagePath);
|
||||
|
||||
if (result.changes > 0) {
|
||||
results.success.push(imagePath);
|
||||
} else {
|
||||
results.failed.push({ path: imagePath, error: '图片不存在' });
|
||||
}
|
||||
} catch (error) {
|
||||
results.failed.push({ path: imagePath, error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
// 更新数据库修改时间
|
||||
if (results.success.length > 0) {
|
||||
db.updateLastModified();
|
||||
}
|
||||
|
||||
return {
|
||||
updated: results.success.length,
|
||||
failed: results.failed.length,
|
||||
success: results.success,
|
||||
failed: results.failed
|
||||
};
|
||||
} finally {
|
||||
this.dbPool.release(library.path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取素材库对象
|
||||
* @private
|
||||
|
||||
@@ -65,3 +65,14 @@ export function getOriginalUrl(libraryId, path) {
|
||||
export async function openInExplorer(libraryId, path) {
|
||||
return api.post(`/image/${libraryId}/open-file`, { path });
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新图片评分(支持批量)
|
||||
*/
|
||||
export async function updateRating(libraryId, paths, rating) {
|
||||
return api.put('/image/rating', {
|
||||
libraryId,
|
||||
paths: Array.isArray(paths) ? paths : [paths],
|
||||
rating
|
||||
});
|
||||
}
|
||||
@@ -105,5 +105,37 @@ export const fileAPI = {
|
||||
folderPath
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 上传文件到指定文件夹
|
||||
* @param {string} libraryId - 素材库ID
|
||||
* @param {string} targetFolder - 目标文件夹路径(可选,默认根目录)
|
||||
* @param {File[]} files - 待上传的文件数组
|
||||
* @param {Function} onProgress - 进度回调函数 (progressEvent) => {}
|
||||
* @param {string} conflictAction - 冲突处理方式: 'skip'|'replace'|'rename'
|
||||
*/
|
||||
async upload(libraryId, targetFolder, files, onProgress, conflictAction) {
|
||||
const formData = new FormData();
|
||||
formData.append('libraryId', libraryId);
|
||||
if (targetFolder) {
|
||||
formData.append('targetFolder', targetFolder);
|
||||
}
|
||||
if (conflictAction) {
|
||||
formData.append('conflictAction', conflictAction);
|
||||
}
|
||||
|
||||
// 添加所有文件
|
||||
for (const file of files) {
|
||||
formData.append('files', file);
|
||||
}
|
||||
|
||||
const response = await axios.post(`${API_BASE}/api/upload`, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
onUploadProgress: onProgress
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
};
|
||||
@@ -138,7 +138,7 @@ export const menuItems = {
|
||||
}),
|
||||
move: (action) => ({
|
||||
icon: <Move size={16} />,
|
||||
label: '移动到...',
|
||||
label: '移动到',
|
||||
action
|
||||
}),
|
||||
copy: (action) => ({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect, useMemo, useRef } from 'react';
|
||||
import { Sun, Moon, Search, Filter, Sliders, RefreshCw } from 'lucide-react';
|
||||
import { Sun, Moon, Search, Filter, Sliders, RefreshCw, Star } from 'lucide-react';
|
||||
import { useLibraryStore } from '../stores/useLibraryStore';
|
||||
import { useImageStore } from '../stores/useImageStore';
|
||||
import { useUIStore } from '../stores/useUIStore';
|
||||
@@ -23,7 +23,8 @@ function Header() {
|
||||
// 从全局 store 获取筛选状态
|
||||
const selectedFormats = filters.formats || [];
|
||||
const selectedSizes = filters.sizes || [];
|
||||
const selectedOrientation = filters.orientation || '';
|
||||
const selectedOrientations = filters.orientations || [];
|
||||
const selectedRatings = filters.ratings || [];
|
||||
|
||||
// 检测移动端
|
||||
useEffect(() => {
|
||||
@@ -172,13 +173,15 @@ function Header() {
|
||||
// 分析原始图片列表,生成可选项(基于 originalImages,不受筛选影响)
|
||||
const filterOptions = useMemo(() => {
|
||||
if (originalImages.length === 0) {
|
||||
return { formats: [], sizes: [], hasHorizontal: false, hasVertical: false };
|
||||
return { formats: [], sizes: [], hasHorizontal: false, hasVertical: false, hasSquare: false, ratings: [] };
|
||||
}
|
||||
|
||||
const formats = new Set();
|
||||
const sizes = [];
|
||||
const ratings = new Set();
|
||||
let hasHorizontal = false;
|
||||
let hasVertical = false;
|
||||
let hasSquare = false;
|
||||
|
||||
originalImages.forEach(img => {
|
||||
// 格式
|
||||
@@ -187,9 +190,20 @@ function Header() {
|
||||
}
|
||||
// 文件大小
|
||||
sizes.push(img.size / 1024);
|
||||
// 横竖图
|
||||
if (img.width > img.height) hasHorizontal = true;
|
||||
if (img.height > img.width) hasVertical = true;
|
||||
|
||||
// 方向检测
|
||||
const aspectRatio = img.width / img.height;
|
||||
if (aspectRatio > 1.05) {
|
||||
hasHorizontal = true; // 横图
|
||||
} else if (aspectRatio < 0.95) {
|
||||
hasVertical = true; // 竖图
|
||||
} else {
|
||||
hasSquare = true; // 方图(宽高比在0.95-1.05之间)
|
||||
}
|
||||
|
||||
// 评分统计
|
||||
const rating = img.rating || 0;
|
||||
ratings.add(rating);
|
||||
});
|
||||
|
||||
// 计算文件大小范围
|
||||
@@ -199,7 +213,9 @@ function Header() {
|
||||
formats: Array.from(formats).sort(),
|
||||
sizes: sizeRanges,
|
||||
hasHorizontal,
|
||||
hasVertical
|
||||
hasVertical,
|
||||
hasSquare,
|
||||
ratings: Array.from(ratings).sort((a, b) => b - a) // 评分降序排列
|
||||
};
|
||||
}, [originalImages]);
|
||||
|
||||
@@ -219,13 +235,22 @@ function Header() {
|
||||
};
|
||||
|
||||
const toggleOrientation = (orientation) => {
|
||||
const newOrientation = selectedOrientation === orientation ? '' : orientation;
|
||||
setFilters({ orientation: newOrientation });
|
||||
const newOrientations = selectedOrientations.includes(orientation)
|
||||
? selectedOrientations.filter(o => o !== orientation)
|
||||
: [...selectedOrientations, orientation];
|
||||
setFilters({ orientations: newOrientations });
|
||||
};
|
||||
|
||||
const toggleRating = (rating) => {
|
||||
const newRatings = selectedRatings.includes(rating)
|
||||
? selectedRatings.filter(r => r !== rating)
|
||||
: [...selectedRatings, rating];
|
||||
setFilters({ ratings: newRatings });
|
||||
};
|
||||
|
||||
// 清除筛选
|
||||
const clearFilters = () => {
|
||||
setFilters({ formats: [], sizes: [], orientation: '' });
|
||||
setFilters({ formats: [], sizes: [], orientations: [], ratings: [] });
|
||||
};
|
||||
|
||||
const handleThumbnailHeightChange = async (height) => {
|
||||
@@ -257,11 +282,14 @@ function Header() {
|
||||
const availableSizes = filterOptions.sizes.map(size => ({ label: size }));
|
||||
const availableOrientations = [
|
||||
{ value: 'horizontal', label: '横图' },
|
||||
{ value: 'vertical', label: '竖图' }
|
||||
{ value: 'vertical', label: '竖图' },
|
||||
{ value: 'square', label: '方图' }
|
||||
].filter(o =>
|
||||
(o.value === 'horizontal' && filterOptions.hasHorizontal) ||
|
||||
(o.value === 'vertical' && filterOptions.hasVertical)
|
||||
(o.value === 'vertical' && filterOptions.hasVertical) ||
|
||||
(o.value === 'square' && filterOptions.hasSquare)
|
||||
);
|
||||
const availableRatings = filterOptions.ratings;
|
||||
|
||||
// 移动端布局
|
||||
if (isMobile) {
|
||||
@@ -320,13 +348,13 @@ function Header() {
|
||||
<button
|
||||
onClick={() => setShowFilters(!showFilters)}
|
||||
className={`p-2 border rounded-lg ${
|
||||
selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientation
|
||||
selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientations.length > 0 || selectedRatings.length > 0
|
||||
? 'border-blue-500 bg-blue-50 dark:bg-blue-500/20'
|
||||
: 'border-gray-300 dark:border-gray-600'
|
||||
}`}
|
||||
>
|
||||
<Filter className={`w-5 h-5 ${
|
||||
selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientation
|
||||
selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientations.length > 0 || selectedRatings.length > 0
|
||||
? 'text-blue-600 dark:text-blue-300'
|
||||
: 'text-gray-600 dark:text-gray-400'
|
||||
}`} />
|
||||
@@ -412,7 +440,7 @@ function Header() {
|
||||
</div>
|
||||
|
||||
{/* 方向筛选 */}
|
||||
<div>
|
||||
<div className="mb-3">
|
||||
<div className="text-xs text-gray-500 dark:text-gray-400 mb-2">方向</div>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{availableOrientations.map(orientation => (
|
||||
@@ -420,7 +448,7 @@ function Header() {
|
||||
key={orientation.value}
|
||||
onClick={() => toggleOrientation(orientation.value)}
|
||||
className={`px-3 py-1 text-xs rounded-full ${
|
||||
selectedOrientation === orientation.value
|
||||
selectedOrientations.includes(orientation.value)
|
||||
? 'bg-blue-500 text-white'
|
||||
: 'bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300'
|
||||
}`}
|
||||
@@ -430,6 +458,36 @@ function Header() {
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 评分筛选 */}
|
||||
{availableRatings.length > 0 && (
|
||||
<div>
|
||||
<div className="text-xs text-gray-500 dark:text-gray-400 mb-2">评分</div>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{[5, 4, 3, 2, 1, 0].filter(r => availableRatings.includes(r)).map(rating => (
|
||||
<button
|
||||
key={rating}
|
||||
onClick={() => toggleRating(rating)}
|
||||
className={`px-2 py-1 text-xs rounded-full flex items-center gap-1 ${
|
||||
selectedRatings.includes(rating)
|
||||
? 'bg-blue-500 text-white'
|
||||
: 'bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300'
|
||||
}`}
|
||||
>
|
||||
{rating > 0 ? (
|
||||
<>
|
||||
{[...Array(rating)].map((_, i) => (
|
||||
<Star key={i} size={12} className="fill-current" />
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<span>未评分</span>
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
@@ -460,22 +518,22 @@ function Header() {
|
||||
<button
|
||||
onClick={() => setShowFilters(!showFilters)}
|
||||
className={`relative p-2 border rounded-lg transition-colors ${
|
||||
selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientation
|
||||
selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientations.length > 0 || selectedRatings.length > 0
|
||||
? 'border-blue-500 dark:border-blue-400 bg-blue-50 dark:bg-blue-500/20 hover:bg-blue-100 dark:hover:bg-blue-500/30'
|
||||
: 'border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700'
|
||||
}`}
|
||||
title={
|
||||
selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientation
|
||||
selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientations.length > 0 || selectedRatings.length > 0
|
||||
? '筛选(已启用)'
|
||||
: '筛选'
|
||||
}
|
||||
>
|
||||
<Filter className={`w-5 h-5 ${
|
||||
selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientation
|
||||
selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientations.length > 0 || selectedRatings.length > 0
|
||||
? 'text-blue-600 dark:text-blue-300'
|
||||
: 'text-gray-600 dark:text-gray-400'
|
||||
}`} />
|
||||
{(selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientation) && (
|
||||
{(selectedFormats.length > 0 || selectedSizes.length > 0 || selectedOrientations.length > 0 || selectedRatings.length > 0) && (
|
||||
<span
|
||||
className="absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full"
|
||||
style={{ backgroundColor: '#3b82f6' }}
|
||||
@@ -534,8 +592,8 @@ function Header() {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* 三列布局 */}
|
||||
<div className="grid grid-cols-3 gap-4">
|
||||
{/* 四列布局 */}
|
||||
<div className="grid grid-cols-4 gap-4">
|
||||
{/* 格式筛选 */}
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2">格式</label>
|
||||
@@ -584,39 +642,61 @@ function Header() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 横竖图筛选 */}
|
||||
{/* 图片方向筛选 */}
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2">图片方向</label>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
{filterOptions.hasHorizontal && (
|
||||
<button
|
||||
onClick={() => toggleOrientation('horizontal')}
|
||||
className={`px-3 py-1.5 text-xs rounded transition-colors text-left ${
|
||||
selectedOrientation === 'horizontal'
|
||||
? 'bg-blue-500 text-white'
|
||||
: 'bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-500'
|
||||
}`}
|
||||
>
|
||||
横图
|
||||
</button>
|
||||
)}
|
||||
{filterOptions.hasVertical && (
|
||||
<button
|
||||
onClick={() => toggleOrientation('vertical')}
|
||||
className={`px-3 py-1.5 text-xs rounded transition-colors text-left ${
|
||||
selectedOrientation === 'vertical'
|
||||
? 'bg-blue-500 text-white'
|
||||
: 'bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-500'
|
||||
}`}
|
||||
>
|
||||
竖图
|
||||
</button>
|
||||
)}
|
||||
{!filterOptions.hasHorizontal && !filterOptions.hasVertical && (
|
||||
{availableOrientations.length > 0 ? (
|
||||
availableOrientations.map(orientation => (
|
||||
<button
|
||||
key={orientation.value}
|
||||
onClick={() => toggleOrientation(orientation.value)}
|
||||
className={`px-3 py-1.5 text-xs rounded transition-colors text-left ${
|
||||
selectedOrientations.includes(orientation.value)
|
||||
? 'bg-blue-500 text-white'
|
||||
: 'bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-500'
|
||||
}`}
|
||||
>
|
||||
{orientation.label}
|
||||
</button>
|
||||
))
|
||||
) : (
|
||||
<span className="text-xs text-gray-400 py-2">暂无方向数据</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 评分筛选 */}
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2">评分</label>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
{availableRatings.length > 0 ? (
|
||||
[5, 4, 3, 2, 1, 0].filter(r => availableRatings.includes(r)).map(rating => (
|
||||
<button
|
||||
key={rating}
|
||||
onClick={() => toggleRating(rating)}
|
||||
className={`px-3 py-1.5 text-xs rounded transition-colors text-left flex items-center gap-1.5 ${
|
||||
selectedRatings.includes(rating)
|
||||
? 'bg-blue-500 text-white'
|
||||
: 'bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-500'
|
||||
}`}
|
||||
>
|
||||
{rating > 0 ? (
|
||||
<>
|
||||
{[...Array(rating)].map((_, i) => (
|
||||
<Star key={i} size={14} className="fill-current" />
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<span>未评分</span>
|
||||
)}
|
||||
</button>
|
||||
))
|
||||
) : (
|
||||
<span className="text-xs text-gray-400 py-2">暂无评分数据</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,7 @@ import requestManager, { RequestType } from '../services/requestManager';
|
||||
import FileViewer from './FileViewer';
|
||||
import ContextMenu, { menuItems } from './ContextMenu';
|
||||
import UndoToast from './UndoToast';
|
||||
import RatingToast from './RatingToast';
|
||||
import FolderSelector from './FolderSelector';
|
||||
import ConflictDialog from './ConflictDialog';
|
||||
|
||||
@@ -69,12 +70,13 @@ function ImageWaterfall() {
|
||||
|
||||
// 前端筛选逻辑:基于 filters 过滤图片
|
||||
const filteredImages = useMemo(() => {
|
||||
const { formats, sizes, orientation } = filters;
|
||||
const { formats, sizes, orientations, ratings } = filters;
|
||||
|
||||
// 如果没有任何筛选条件,直接返回原始图片
|
||||
if ((!formats || formats.length === 0) &&
|
||||
(!sizes || sizes.length === 0) &&
|
||||
!orientation) {
|
||||
(!orientations || orientations.length === 0) &&
|
||||
(!ratings || ratings.length === 0)) {
|
||||
return images;
|
||||
}
|
||||
|
||||
@@ -101,11 +103,31 @@ function ImageWaterfall() {
|
||||
if (!matchesSize) return false;
|
||||
}
|
||||
|
||||
// 横竖图筛选
|
||||
if (orientation === 'horizontal') {
|
||||
if (img.width <= img.height) return false;
|
||||
} else if (orientation === 'vertical') {
|
||||
if (img.height <= img.width) return false;
|
||||
// 方向筛选(多选)
|
||||
if (orientations && orientations.length > 0) {
|
||||
const aspectRatio = img.width / img.height;
|
||||
let matchesOrientation = false;
|
||||
|
||||
for (const orientation of orientations) {
|
||||
if (orientation === 'horizontal' && aspectRatio > 1.05) {
|
||||
matchesOrientation = true;
|
||||
break;
|
||||
} else if (orientation === 'vertical' && aspectRatio < 0.95) {
|
||||
matchesOrientation = true;
|
||||
break;
|
||||
} else if (orientation === 'square' && aspectRatio >= 0.95 && aspectRatio <= 1.05) {
|
||||
matchesOrientation = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matchesOrientation) return false;
|
||||
}
|
||||
|
||||
// 评分筛选(多选)
|
||||
if (ratings && ratings.length > 0) {
|
||||
const imgRating = img.rating || 0;
|
||||
if (!ratings.includes(imgRating)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -121,11 +143,14 @@ function ImageWaterfall() {
|
||||
const [contextMenu, setContextMenu] = useState({ isOpen: false, position: null, image: null });
|
||||
const [undoToast, setUndoToast] = useState({ isVisible: false, message: '', count: 0 });
|
||||
const [undoHistory, setUndoHistory] = useState([]); // 撤销历史栈,支持多次撤销
|
||||
const [ratingToast, setRatingToast] = useState({ isVisible: false, rating: 0, count: 0 }); // 评分提醒
|
||||
const [showFolderSelector, setShowFolderSelector] = useState(false); // 显示文件夹选择器
|
||||
const [moveItems, setMoveItems] = useState([]); // 待移动的项
|
||||
const [editingFilename, setEditingFilename] = useState(''); // 编辑中的文件名
|
||||
const editInputRef = useRef(null); // 编辑输入框引用
|
||||
const [conflictDialog, setConflictDialog] = useState({ isOpen: false, conflicts: [], pendingPaste: null }); // 冲突对话框
|
||||
const [conflictDialog, setConflictDialog] = useState({ isOpen: false, conflicts: [], pendingPaste: null, pendingUpload: null }); // 冲突对话框
|
||||
const [isDraggingOver, setIsDraggingOver] = useState(false); // 拖拽悬停状态
|
||||
const [uploadProgress, setUploadProgress] = useState({ isUploading: false, percent: 0, current: 0, total: 0 }); // 上传进度
|
||||
|
||||
// 剪贴板状态
|
||||
const { copyToClipboard, getClipboard, hasClipboard } = useClipboardStore();
|
||||
@@ -136,6 +161,23 @@ function ImageWaterfall() {
|
||||
setUndoToast({ isVisible: false, message: '', count: 0 });
|
||||
}, [selectedFolder]);
|
||||
|
||||
// 全局阻止浏览器默认的拖放行为(防止浏览器打开文件)
|
||||
useEffect(() => {
|
||||
const preventDefaults = (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
// 阻止整个文档的默认拖放行为
|
||||
document.addEventListener('dragover', preventDefaults);
|
||||
document.addEventListener('drop', preventDefaults);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('dragover', preventDefaults);
|
||||
document.removeEventListener('drop', preventDefaults);
|
||||
};
|
||||
}, []);
|
||||
|
||||
// 全局快捷键监听 - Del 键删除, Ctrl+Z 撤销, F2/Enter 重命名, Ctrl+C 复制, Ctrl+V 粘贴
|
||||
useEffect(() => {
|
||||
const handleGlobalKeyDown = async (e) => {
|
||||
@@ -182,6 +224,26 @@ function ImageWaterfall() {
|
||||
e.preventDefault();
|
||||
await handleQuickDelete();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 数字键 1-5 → 快速评分
|
||||
if (['1', '2', '3', '4', '5'].includes(e.key)) {
|
||||
if (selectedImages.length > 0 || selectedImage) {
|
||||
e.preventDefault();
|
||||
const rating = parseInt(e.key);
|
||||
await handleQuickRating(rating);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 数字键 0 → 取消评分
|
||||
if (e.key === '0') {
|
||||
if (selectedImages.length > 0 || selectedImage) {
|
||||
e.preventDefault();
|
||||
await handleQuickRating(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -584,6 +646,57 @@ function ImageWaterfall() {
|
||||
});
|
||||
};
|
||||
|
||||
// 快速评分(数字键 0-5)
|
||||
const handleQuickRating = async (rating) => {
|
||||
const imagesToRate = selectedImages.length > 0
|
||||
? selectedImages
|
||||
: selectedImage
|
||||
? [selectedImage]
|
||||
: [];
|
||||
|
||||
if (imagesToRate.length === 0) return;
|
||||
|
||||
try {
|
||||
const paths = imagesToRate.map(img => img.path);
|
||||
await imageAPI.updateRating(currentLibraryId, paths, rating);
|
||||
|
||||
// 更新本地状态
|
||||
const updatedImages = images.map(img => {
|
||||
if (paths.includes(img.path)) {
|
||||
return { ...img, rating };
|
||||
}
|
||||
return img;
|
||||
});
|
||||
setImages(updatedImages);
|
||||
|
||||
// 更新选中状态
|
||||
if (selectedImage && paths.includes(selectedImage.path)) {
|
||||
useImageStore.getState().setSelectedImage({ ...selectedImage, rating });
|
||||
}
|
||||
if (selectedImages.length > 0) {
|
||||
const updatedSelected = selectedImages.map(img => {
|
||||
if (paths.includes(img.path)) {
|
||||
return { ...img, rating };
|
||||
}
|
||||
return img;
|
||||
});
|
||||
useImageStore.getState().setSelectedImages(updatedSelected);
|
||||
}
|
||||
|
||||
// 显示评分提醒
|
||||
setRatingToast({
|
||||
isVisible: true,
|
||||
rating,
|
||||
count: imagesToRate.length
|
||||
});
|
||||
|
||||
console.log(`⭐ 已将 ${imagesToRate.length} 张图片评为 ${rating} 星`);
|
||||
} catch (error) {
|
||||
console.error('评分失败:', error);
|
||||
alert('评分失败: ' + (error.message || '未知错误'));
|
||||
}
|
||||
};
|
||||
|
||||
// 快速删除(乐观更新,立即响应)
|
||||
const handleQuickDelete = async () => {
|
||||
const items = selectedImages.length > 0
|
||||
@@ -980,18 +1093,244 @@ function ImageWaterfall() {
|
||||
|
||||
// 处理冲突对话框的选择
|
||||
const handleConflictResolve = useCallback(async (action) => {
|
||||
const { pendingPaste } = conflictDialog;
|
||||
if (!pendingPaste) return;
|
||||
|
||||
setConflictDialog({ isOpen: false, conflicts: [], pendingPaste: null });
|
||||
await executePaste(pendingPaste.items, pendingPaste.targetFolder, action);
|
||||
}, [conflictDialog, executePaste]);
|
||||
const { pendingPaste, pendingUpload } = conflictDialog;
|
||||
|
||||
// 关闭对话框
|
||||
setConflictDialog({ isOpen: false, conflicts: [], pendingPaste: null, pendingUpload: null });
|
||||
|
||||
if (pendingPaste) {
|
||||
// 粘贴冲突
|
||||
await executePaste(pendingPaste.items, pendingPaste.targetFolder, action);
|
||||
} else if (pendingUpload) {
|
||||
// 上传冲突 - 重新上传并带上 conflictAction 参数
|
||||
console.log(`处理上传冲突: ${action}`);
|
||||
|
||||
if (action === 'skip') {
|
||||
// 跳过:不再上传
|
||||
console.log('用户选择跳过上传');
|
||||
return;
|
||||
}
|
||||
|
||||
// 开始上传
|
||||
setUploadProgress({ isUploading: true, percent: 0, current: 0, total: pendingUpload.files.length });
|
||||
|
||||
try {
|
||||
const result = await fileAPI.upload(
|
||||
currentLibraryId,
|
||||
pendingUpload.targetFolder,
|
||||
pendingUpload.files,
|
||||
(progressEvent) => {
|
||||
const percent = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
||||
setUploadProgress(prev => ({ ...prev, percent }));
|
||||
},
|
||||
action // 传递 conflictAction
|
||||
);
|
||||
|
||||
// 上传完成
|
||||
setUploadProgress({ isUploading: false, percent: 100, current: result.data.success.length, total: pendingUpload.files.length });
|
||||
|
||||
// 显示结果提示
|
||||
const successCount = result.data.success?.length || 0;
|
||||
const failedCount = result.data.failed?.length || 0;
|
||||
|
||||
let message = `上传完成: 成功 ${successCount} 个`;
|
||||
if (failedCount > 0) message += `, 失败 ${failedCount} 个`;
|
||||
|
||||
setUndoToast({
|
||||
isVisible: true,
|
||||
message: message,
|
||||
count: successCount
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
setUndoToast({ isVisible: false, message: '', count: 0 });
|
||||
setUploadProgress({ isUploading: false, percent: 0, current: 0, total: 0 });
|
||||
}, 3000);
|
||||
|
||||
// 立即刷新当前文件夹的图片列表
|
||||
if (successCount > 0) {
|
||||
const params = { folder: selectedFolder || '' };
|
||||
const response = await imageAPI.search(currentLibraryId, params);
|
||||
setImages(response.images);
|
||||
|
||||
// 刷新文件夹列表
|
||||
const foldersRes = await imageAPI.getFolders(currentLibraryId);
|
||||
setFolders(foldersRes.folders);
|
||||
|
||||
// 2秒后再刷新一次,确保缩略图已生成
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
const response2 = await imageAPI.search(currentLibraryId, params);
|
||||
setImages(response2.images);
|
||||
console.log('✅ 缩略图刷新完成');
|
||||
} catch (err) {
|
||||
console.error('刷新缩略图失败:', err);
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('上传失败:', error);
|
||||
setUploadProgress({ isUploading: false, percent: 0, current: 0, total: 0 });
|
||||
alert('上传失败: ' + (error.response?.data?.error || error.message || '未知错误'));
|
||||
}
|
||||
}
|
||||
}, [conflictDialog, executePaste, currentLibraryId, selectedFolder, setImages, setFolders]);
|
||||
|
||||
// 取消冲突对话框
|
||||
const handleConflictCancel = useCallback(() => {
|
||||
setConflictDialog({ isOpen: false, conflicts: [], pendingPaste: null });
|
||||
setConflictDialog({ isOpen: false, conflicts: [], pendingPaste: null, pendingUpload: null });
|
||||
}, []);
|
||||
|
||||
// 拖放事件处理 - 拖拽进入
|
||||
const handleDragEnter = useCallback((e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// 关键修复:只检测外部文件拖入,排除应用内部拖动
|
||||
const types = e.dataTransfer.types;
|
||||
// 外部文件拖入的特征:包含 Files 且不包含 application/json
|
||||
const hasFiles = types.includes('Files');
|
||||
const hasJson = types.includes('application/json');
|
||||
|
||||
if (hasFiles && !hasJson) {
|
||||
setIsDraggingOver(true);
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 拖放事件处理 - 拖拽悬停
|
||||
const handleDragOver = useCallback((e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// 检查是否为外部文件
|
||||
const types = e.dataTransfer.types;
|
||||
const hasFiles = types.includes('Files');
|
||||
const hasJson = types.includes('application/json');
|
||||
|
||||
if (hasFiles && !hasJson) {
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
} else {
|
||||
e.dataTransfer.dropEffect = 'none';
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 拖放事件处理 - 拖拽离开(立即取消提示)
|
||||
const handleDragLeave = useCallback((e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// 关键修复:离开容器区域立即取消提示
|
||||
const rect = containerRef.current?.getBoundingClientRect();
|
||||
if (rect) {
|
||||
const x = e.clientX;
|
||||
const y = e.clientY;
|
||||
// 检查鼠标是否离开容器区域
|
||||
if (x < rect.left || x > rect.right || y < rect.top || y > rect.bottom) {
|
||||
setIsDraggingOver(false);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 拖放事件处理 - 文件放下
|
||||
const handleDrop = useCallback(async (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setIsDraggingOver(false);
|
||||
|
||||
if (!currentLibraryId) {
|
||||
alert('请先选择素材库');
|
||||
return;
|
||||
}
|
||||
|
||||
const files = Array.from(e.dataTransfer.files);
|
||||
if (files.length === 0) return;
|
||||
|
||||
console.log(`📤 准备上传 ${files.length} 个文件到: ${selectedFolder || '根目录'}`);
|
||||
|
||||
// 开始上传(不过滤格式,让后端处理)
|
||||
setUploadProgress({ isUploading: true, percent: 0, current: 0, total: files.length });
|
||||
|
||||
try {
|
||||
const result = await fileAPI.upload(
|
||||
currentLibraryId,
|
||||
selectedFolder || '',
|
||||
files,
|
||||
(progressEvent) => {
|
||||
const percent = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
||||
setUploadProgress(prev => ({ ...prev, percent }));
|
||||
}
|
||||
);
|
||||
|
||||
// 上传完成
|
||||
setUploadProgress({ isUploading: false, percent: 100, current: result.data.success.length, total: files.length });
|
||||
|
||||
// 检查是否有冲突
|
||||
const conflicts = result.data.conflicts || [];
|
||||
if (conflicts.length > 0) {
|
||||
// 有冲突,显示冲突对话框
|
||||
console.log(`⚠️ 检测到 ${conflicts.length} 个文件冲突`);
|
||||
setConflictDialog({
|
||||
isOpen: true,
|
||||
conflicts: conflicts,
|
||||
pendingUpload: {
|
||||
files: files.filter(f => {
|
||||
const filename = f.name;
|
||||
return conflicts.some(c => c.name === filename);
|
||||
}),
|
||||
targetFolder: selectedFolder || ''
|
||||
}
|
||||
});
|
||||
setUploadProgress({ isUploading: false, percent: 0, current: 0, total: 0 });
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示结果提示
|
||||
const successCount = result.data.success?.length || 0;
|
||||
const failedCount = result.data.failed?.length || 0;
|
||||
|
||||
let message = `上传完成: 成功 ${successCount} 个`;
|
||||
if (failedCount > 0) message += `, 失败 ${failedCount} 个`;
|
||||
|
||||
setUndoToast({
|
||||
isVisible: true,
|
||||
message: message,
|
||||
count: successCount
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
setUndoToast({ isVisible: false, message: '', count: 0 });
|
||||
setUploadProgress({ isUploading: false, percent: 0, current: 0, total: 0 });
|
||||
}, 3000);
|
||||
|
||||
// 立即刷新当前文件夹的图片列表(不等待后台处理)
|
||||
if (successCount > 0) {
|
||||
// 立即刷新,让用户看到文件(缩略图可能还在生成中)
|
||||
const params = { folder: selectedFolder || '' };
|
||||
const response = await imageAPI.search(currentLibraryId, params);
|
||||
setImages(response.images);
|
||||
|
||||
// 刷新文件夹列表
|
||||
const foldersRes = await imageAPI.getFolders(currentLibraryId);
|
||||
setFolders(foldersRes.folders);
|
||||
|
||||
// 2秒后再刷新一次,确保缩略图已生成
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
const response2 = await imageAPI.search(currentLibraryId, params);
|
||||
setImages(response2.images);
|
||||
console.log('✅ 缩略图刷新完成');
|
||||
} catch (err) {
|
||||
console.error('刷新缩略图失败:', err);
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('上传失败:', error);
|
||||
setUploadProgress({ isUploading: false, percent: 0, current: 0, total: 0 });
|
||||
alert('上传失败: ' + (error.response?.data?.error || error.message || '未知错误'));
|
||||
}
|
||||
}, [currentLibraryId, selectedFolder, setImages, setFolders]);
|
||||
|
||||
// 开始重命名
|
||||
const handleStartRename = useCallback((image) => {
|
||||
if (!image) return;
|
||||
@@ -1242,17 +1581,112 @@ function ImageWaterfall() {
|
||||
// 加载中时显示空容器,避免闪烁"暂无图片"
|
||||
if (!filteredImages.length && imageLoadingState.isLoading) {
|
||||
return (
|
||||
<div ref={containerRef} className="h-full overflow-hidden" />
|
||||
<div
|
||||
ref={containerRef}
|
||||
className="h-full overflow-hidden relative"
|
||||
onDragEnter={handleDragEnter}
|
||||
onDragOver={handleDragOver}
|
||||
onDragLeave={handleDragLeave}
|
||||
onDrop={handleDrop}
|
||||
>
|
||||
{/* 拖拽提示覆盖层 */}
|
||||
{isDraggingOver && (
|
||||
<div className="absolute inset-0 z-50 bg-blue-500 bg-opacity-20 border-4 border-dashed border-blue-500 flex items-center justify-center pointer-events-none">
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg p-8 shadow-2xl">
|
||||
<div className="text-center">
|
||||
<div className="text-6xl mb-4">📤</div>
|
||||
<p className="text-xl font-semibold text-gray-800 dark:text-gray-200 mb-2">
|
||||
拖放图片到这里
|
||||
</p>
|
||||
<p className="text-sm text-gray-500 dark:text-gray-400">
|
||||
支持 JPG、PNG、GIF、WebP 等格式
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 上传进度提示 */}
|
||||
{uploadProgress.isUploading && (
|
||||
<div className="absolute top-4 right-4 z-40 bg-white dark:bg-gray-800 rounded-lg shadow-xl p-4 min-w-[300px]">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
正在上传...
|
||||
</span>
|
||||
<span className="text-sm text-gray-500 dark:text-gray-400">
|
||||
{uploadProgress.percent}%
|
||||
</span>
|
||||
</div>
|
||||
<div className="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2">
|
||||
<div
|
||||
className="bg-blue-500 h-2 rounded-full transition-all duration-300"
|
||||
style={{ width: `${uploadProgress.percent}%` }}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-2 text-xs text-gray-500 dark:text-gray-400 text-right">
|
||||
共 {uploadProgress.total} 个文件
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// 真正没有图片时才显示提示
|
||||
if (!filteredImages.length) {
|
||||
return (
|
||||
<div ref={containerRef} className="flex items-center justify-center h-full text-gray-500 dark:text-gray-400">
|
||||
<div
|
||||
ref={containerRef}
|
||||
className="flex items-center justify-center h-full text-gray-500 dark:text-gray-400 relative"
|
||||
onDragEnter={handleDragEnter}
|
||||
onDragOver={handleDragOver}
|
||||
onDragLeave={handleDragLeave}
|
||||
onDrop={handleDrop}
|
||||
>
|
||||
{/* 拖拽提示覆盖层 */}
|
||||
{isDraggingOver && (
|
||||
<div className="absolute inset-0 z-50 bg-blue-500 bg-opacity-20 border-4 border-dashed border-blue-500 flex items-center justify-center pointer-events-none">
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg p-8 shadow-2xl">
|
||||
<div className="text-center">
|
||||
<div className="text-6xl mb-4">📤</div>
|
||||
<p className="text-xl font-semibold text-gray-800 dark:text-gray-200 mb-2">
|
||||
拖放图片到这里
|
||||
</p>
|
||||
<p className="text-sm text-gray-500 dark:text-gray-400">
|
||||
支持 JPG、PNG、GIF、WebP 等格式
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 上传进度提示 */}
|
||||
{uploadProgress.isUploading && (
|
||||
<div className="absolute top-4 right-4 z-40 bg-white dark:bg-gray-800 rounded-lg shadow-xl p-4 min-w-[300px]">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
正在上传...
|
||||
</span>
|
||||
<span className="text-sm text-gray-500 dark:text-gray-400">
|
||||
{uploadProgress.percent}%
|
||||
</span>
|
||||
</div>
|
||||
<div className="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2">
|
||||
<div
|
||||
className="bg-blue-500 h-2 rounded-full transition-all duration-300"
|
||||
style={{ width: `${uploadProgress.percent}%` }}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-2 text-xs text-gray-500 dark:text-gray-400 text-right">
|
||||
共 {uploadProgress.total} 个文件
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="text-center">
|
||||
<p className="text-lg mb-2">暂无图片</p>
|
||||
<p className="text-sm">请添加素材库或调整搜索条件</p>
|
||||
<p className="text-xs mt-4 text-gray-400">可以直接拖拽文件到这里上传</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -1266,7 +1700,54 @@ function ImageWaterfall() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div ref={containerRef} className="h-full overflow-hidden">
|
||||
<div
|
||||
ref={containerRef}
|
||||
className="h-full overflow-hidden relative"
|
||||
onDragEnter={handleDragEnter}
|
||||
onDragOver={handleDragOver}
|
||||
onDragLeave={handleDragLeave}
|
||||
onDrop={handleDrop}
|
||||
>
|
||||
{/* 拖拽提示覆盖层 */}
|
||||
{isDraggingOver && (
|
||||
<div className="absolute inset-0 z-50 bg-blue-500 bg-opacity-20 border-4 border-dashed border-blue-500 flex items-center justify-center pointer-events-none">
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg p-8 shadow-2xl">
|
||||
<div className="text-center">
|
||||
<div className="text-6xl mb-4">📤</div>
|
||||
<p className="text-xl font-semibold text-gray-800 dark:text-gray-200 mb-2">
|
||||
拖放图片到这里
|
||||
</p>
|
||||
<p className="text-sm text-gray-500 dark:text-gray-400">
|
||||
支持 JPG、PNG、GIF、WebP 等格式
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 上传进度提示 */}
|
||||
{uploadProgress.isUploading && (
|
||||
<div className="absolute top-4 right-4 z-40 bg-white dark:bg-gray-800 rounded-lg shadow-xl p-4 min-w-[300px]">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
正在上传...
|
||||
</span>
|
||||
<span className="text-sm text-gray-500 dark:text-gray-400">
|
||||
{uploadProgress.percent}%
|
||||
</span>
|
||||
</div>
|
||||
<div className="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2">
|
||||
<div
|
||||
className="bg-blue-500 h-2 rounded-full transition-all duration-300"
|
||||
style={{ width: `${uploadProgress.percent}%` }}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-2 text-xs text-gray-500 dark:text-gray-400 text-right">
|
||||
共 {uploadProgress.total} 个文件
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<PhotoProvider
|
||||
images={providerImages}
|
||||
visible={photoIndex >= 0}
|
||||
@@ -1356,6 +1837,14 @@ function ImageWaterfall() {
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* 评分提醒 */}
|
||||
<RatingToast
|
||||
isVisible={ratingToast.isVisible}
|
||||
rating={ratingToast.rating}
|
||||
count={ratingToast.count}
|
||||
onClose={() => setRatingToast({ isVisible: false, rating: 0, count: 0 })}
|
||||
/>
|
||||
|
||||
{/* 文件夹选择器 */}
|
||||
{showFolderSelector && (
|
||||
<FolderSelector
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import { useState } from 'react';
|
||||
import { Star } from 'lucide-react';
|
||||
|
||||
/**
|
||||
* 评分星星组件
|
||||
* 支持悬浮预览和点击评分
|
||||
*/
|
||||
function RatingStars({ rating, onChange, size = 20, disabled = false }) {
|
||||
const [hoverRating, setHoverRating] = useState(0);
|
||||
|
||||
const displayRating = hoverRating || rating || 0;
|
||||
|
||||
const handleClick = (star) => {
|
||||
if (disabled) return;
|
||||
// 点击已选中的星星则取消评分
|
||||
const newRating = rating === star ? 0 : star;
|
||||
onChange?.(newRating);
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className="flex items-center gap-1"
|
||||
onMouseLeave={() => setHoverRating(0)}
|
||||
>
|
||||
{[1, 2, 3, 4, 5].map((star) => {
|
||||
const isFilled = star <= displayRating;
|
||||
const isHovering = hoverRating > 0 && star <= hoverRating;
|
||||
|
||||
return (
|
||||
<button
|
||||
key={star}
|
||||
type="button"
|
||||
disabled={disabled}
|
||||
className={`
|
||||
transition-all duration-150
|
||||
${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer hover:scale-110'}
|
||||
${isHovering ? 'animate-pulse' : ''}
|
||||
`}
|
||||
onMouseEnter={() => !disabled && setHoverRating(star)}
|
||||
onClick={() => handleClick(star)}
|
||||
title={`${star} 星`}
|
||||
>
|
||||
<Star
|
||||
size={size}
|
||||
className={`
|
||||
transition-colors duration-150
|
||||
${isFilled
|
||||
? 'fill-yellow-400 text-yellow-400'
|
||||
: 'fill-none text-gray-300 dark:text-gray-600'
|
||||
}
|
||||
${isHovering ? 'drop-shadow-lg' : ''}
|
||||
`}
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
|
||||
{/* 评分文字提示 */}
|
||||
{displayRating > 0 && (
|
||||
<span className="ml-2 text-sm text-gray-600 dark:text-gray-400">
|
||||
{displayRating} 星
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default RatingStars;
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* 评分提醒 Toast 组件
|
||||
* 按下数字键快速评分后显示提醒
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { Star } from 'lucide-react';
|
||||
|
||||
function RatingToast({ isVisible, rating, count, onClose, duration = 2000 }) {
|
||||
useEffect(() => {
|
||||
if (!isVisible) return;
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
onClose();
|
||||
}, duration);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [isVisible, rating, count, duration, onClose]);
|
||||
|
||||
if (!isVisible) return null;
|
||||
|
||||
return (
|
||||
<div className="fixed bottom-20 left-1/2 transform -translate-x-1/2 z-50 animate-slide-up">
|
||||
<div className="bg-gray-900 dark:bg-gray-800 text-white rounded-lg shadow-2xl px-6 py-4 flex items-center gap-3 min-w-[200px]">
|
||||
<div className="flex items-center gap-1">
|
||||
{[...Array(rating)].map((_, i) => (
|
||||
<Star
|
||||
key={i}
|
||||
size={16}
|
||||
className="fill-yellow-400 text-yellow-400"
|
||||
/>
|
||||
))}
|
||||
{[...Array(5 - rating)].map((_, i) => (
|
||||
<Star
|
||||
key={i + rating}
|
||||
size={16}
|
||||
className="fill-none text-gray-600"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<span className="text-sm font-medium">
|
||||
{rating === 0 ? '已取消评分' : `已评 ${rating} 星`}
|
||||
{count > 1 ? ` (${count} 张)` : ''}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default RatingToast;
|
||||
@@ -7,10 +7,11 @@ import { useScanStore } from '../stores/useScanStore';
|
||||
import { useClipboardStore } from '../stores/useClipboardStore';
|
||||
import { imageAPI, fileAPI } from '../api';
|
||||
import JSZip from 'jszip';
|
||||
import RatingStars from './RatingStars';
|
||||
|
||||
function RightPanel() {
|
||||
const { currentLibraryId } = useLibraryStore();
|
||||
const { selectedImage, selectedImages, selectedFolder, selectedFolderItem, images, setSelectedImage, updateImage } = useImageStore();
|
||||
const { selectedImage, selectedImages, selectedFolder, selectedFolderItem, images, setSelectedImage, setSelectedImages, updateImage } = useImageStore();
|
||||
const { setMobileView, isResizingPanels, resizingSide } = useUIStore();
|
||||
const { copyToClipboard } = useClipboardStore();
|
||||
const [isMobile, setIsMobile] = useState(false);
|
||||
@@ -25,6 +26,7 @@ function RightPanel() {
|
||||
const [isEditingFilename, setIsEditingFilename] = useState(false);
|
||||
const [editingFilename, setEditingFilename] = useState('');
|
||||
const filenameInputRef = useRef(null);
|
||||
const [isUpdatingRating, setIsUpdatingRating] = useState(false);
|
||||
|
||||
// 计算实际选中的图片数量(合并 selectedImage 和 selectedImages)
|
||||
const actualSelectedCount = (() => {
|
||||
@@ -180,6 +182,44 @@ function RightPanel() {
|
||||
setEditingFilename('');
|
||||
};
|
||||
|
||||
// 更新评分(支持单选和多选)
|
||||
const handleRatingChange = async (newRating) => {
|
||||
const imagesToRate = getImagesToProcess();
|
||||
if (imagesToRate.length === 0) return;
|
||||
|
||||
setIsUpdatingRating(true);
|
||||
try {
|
||||
const paths = imagesToRate.map(img => img.path);
|
||||
await imageAPI.updateRating(currentLibraryId, paths, newRating);
|
||||
|
||||
// 更新本地状态 - images 数组
|
||||
imagesToRate.forEach(img => {
|
||||
updateImage(img.path, { rating: newRating });
|
||||
});
|
||||
|
||||
// 关键修复:同时更新选中状态,确保详情面板立即显示最新评分
|
||||
if (selectedImage && paths.includes(selectedImage.path)) {
|
||||
setSelectedImage({ ...selectedImage, rating: newRating });
|
||||
}
|
||||
if (selectedImages.length > 0) {
|
||||
const updatedSelectedImages = selectedImages.map(img => {
|
||||
if (paths.includes(img.path)) {
|
||||
return { ...img, rating: newRating };
|
||||
}
|
||||
return img;
|
||||
});
|
||||
setSelectedImages(updatedSelectedImages);
|
||||
}
|
||||
|
||||
console.log(`✅ 已更新 ${paths.length} 张图片的评分为 ${newRating} 星`);
|
||||
} catch (error) {
|
||||
console.error('更新评分失败:', error);
|
||||
alert('更新评分失败: ' + (error.message || '未知错误'));
|
||||
} finally {
|
||||
setIsUpdatingRating(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 检测移动端
|
||||
useEffect(() => {
|
||||
const checkMobile = () => {
|
||||
@@ -1079,6 +1119,35 @@ function RightPanel() {
|
||||
<span className="text-gray-500 dark:text-gray-400">数量:</span>
|
||||
<p className="text-gray-900 dark:text-gray-100">{stats.count} 张图片</p>
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-gray-500 dark:text-gray-400">评分:</span>
|
||||
<div className="mt-1">
|
||||
<RatingStars
|
||||
rating={(() => {
|
||||
const images = getImagesToProcess();
|
||||
const ratings = images.map(img => img.rating || 0);
|
||||
const uniqueRatings = [...new Set(ratings)];
|
||||
// 如果所有图片评分相同,显示该评分;否则显示 0
|
||||
return uniqueRatings.length === 1 ? uniqueRatings[0] : 0;
|
||||
})()}
|
||||
onChange={handleRatingChange}
|
||||
disabled={isUpdatingRating}
|
||||
/>
|
||||
</div>
|
||||
{(() => {
|
||||
const images = getImagesToProcess();
|
||||
const ratings = images.map(img => img.rating || 0);
|
||||
const uniqueRatings = [...new Set(ratings)];
|
||||
if (uniqueRatings.length > 1) {
|
||||
return (
|
||||
<p className="text-xs text-gray-400 dark:text-gray-500 mt-1">
|
||||
已选择的图片评分不一致,点击星星可批量设置评分
|
||||
</p>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
})()}
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-gray-500 dark:text-gray-400">尺寸范围:</span>
|
||||
<p className="text-gray-900 dark:text-gray-100">
|
||||
@@ -1167,6 +1236,16 @@ function RightPanel() {
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-gray-500 dark:text-gray-400">评分:</span>
|
||||
<div className="mt-1">
|
||||
<RatingStars
|
||||
rating={selectedImage.rating || 0}
|
||||
onChange={handleRatingChange}
|
||||
disabled={isUpdatingRating}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-gray-500 dark:text-gray-400">尺寸:</span>
|
||||
<p className="text-gray-900 dark:text-gray-100">{selectedImage.width} × {selectedImage.height}</p>
|
||||
|
||||
@@ -22,8 +22,9 @@ export const useImageStore = create((set, get) => ({
|
||||
searchKeywords: '',
|
||||
filters: {
|
||||
formats: [],
|
||||
sizes: [], // 文件大小范围筛选
|
||||
orientation: '', // 横竖图筛选: 'horizontal' | 'vertical' | ''
|
||||
sizes: [], // 文件大小范围筛选
|
||||
orientations: [], // 图片方向筛选(多选): ['horizontal', 'vertical', 'square']
|
||||
ratings: [], // 评分筛选(多选): [0, 1, 2, 3, 4, 5]
|
||||
},
|
||||
|
||||
// 原始图片列表(用于生成筛选选项,不受筛选影响)
|
||||
@@ -89,7 +90,8 @@ export const useImageStore = create((set, get) => ({
|
||||
filters: {
|
||||
formats: [],
|
||||
sizes: [],
|
||||
orientation: ''
|
||||
orientations: [],
|
||||
ratings: []
|
||||
}
|
||||
}),
|
||||
|
||||
|
||||
Generated
+92
@@ -25,6 +25,7 @@
|
||||
"crypto": "^1.0.1",
|
||||
"express": "^4.18.2",
|
||||
"glob": "^10.3.10",
|
||||
"multer": "^2.0.0-rc.4",
|
||||
"p-limit": "^7.2.0",
|
||||
"sharp": "^0.33.0",
|
||||
"socket.io": "^4.6.0",
|
||||
@@ -1998,6 +1999,12 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/append-field": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/append-field/-/append-field-1.0.0.tgz",
|
||||
"integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/arg": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/arg/-/arg-5.0.2.tgz",
|
||||
@@ -2303,6 +2310,23 @@
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/busboy": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmmirror.com/busboy/-/busboy-1.6.0.tgz",
|
||||
"integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
|
||||
"dependencies": {
|
||||
"streamsearch": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||
@@ -2528,6 +2552,21 @@
|
||||
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/concat-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/concat-stream/-/concat-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==",
|
||||
"engines": [
|
||||
"node >= 6.0"
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"inherits": "^2.0.3",
|
||||
"readable-stream": "^3.0.2",
|
||||
"typedarray": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/confbox": {
|
||||
"version": "0.1.8",
|
||||
"resolved": "https://registry.npmmirror.com/confbox/-/confbox-0.1.8.tgz",
|
||||
@@ -4208,6 +4247,18 @@
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/mkdirp": {
|
||||
"version": "0.5.6",
|
||||
"resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-0.5.6.tgz",
|
||||
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.6"
|
||||
},
|
||||
"bin": {
|
||||
"mkdirp": "bin/cmd.js"
|
||||
}
|
||||
},
|
||||
"node_modules/mkdirp-classic": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmmirror.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
|
||||
@@ -4278,6 +4329,24 @@
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/multer": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/multer/-/multer-2.0.2.tgz",
|
||||
"integrity": "sha512-u7f2xaZ/UG8oLXHvtF/oWTRvT44p9ecwBBqTwgJVq0+4BW1g8OW01TyMEGWBHbyMOYVHXslaut7qEQ1meATXgw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"append-field": "^1.0.0",
|
||||
"busboy": "^1.6.0",
|
||||
"concat-stream": "^2.0.0",
|
||||
"mkdirp": "^0.5.6",
|
||||
"object-assign": "^4.1.1",
|
||||
"type-is": "^1.6.18",
|
||||
"xtend": "^4.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mz": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmmirror.com/mz/-/mz-2.7.0.tgz",
|
||||
@@ -5875,6 +5944,14 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/streamsearch": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/streamsearch/-/streamsearch-1.1.0.tgz",
|
||||
"integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
@@ -6350,6 +6427,12 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/typedarray": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmmirror.com/typedarray/-/typedarray-0.0.6.tgz",
|
||||
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ufo": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmmirror.com/ufo/-/ufo-1.6.1.tgz",
|
||||
@@ -6795,6 +6878,15 @@
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xtend": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/xtend/-/xtend-4.0.2.tgz",
|
||||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||
|
||||
Reference in new issue
Block a user