diff --git a/python_core/services/resource_category_manager.py b/python_core/services/resource_category_manager.py index 829df85..e27bb8c 100644 --- a/python_core/services/resource_category_manager.py +++ b/python_core/services/resource_category_manager.py @@ -53,57 +53,7 @@ class ResourceCategoryManager: def _create_default_categories(self) -> List[ResourceCategory]: """创建默认分类""" - now = datetime.now().isoformat() - default_categories = [ - ResourceCategory( - id=str(uuid.uuid4()), - title="人物视频", - ai_prompt="包含人物、人脸、人体的视频素材", - color="#FF6B6B", - created_at=now, - updated_at=now - ), - ResourceCategory( - id=str(uuid.uuid4()), - title="风景视频", - ai_prompt="自然风景、城市景观、建筑物的视频素材", - color="#4ECDC4", - created_at=now, - updated_at=now - ), - ResourceCategory( - id=str(uuid.uuid4()), - title="动物视频", - ai_prompt="动物、宠物、野生动物的视频素材", - color="#45B7D1", - created_at=now, - updated_at=now - ), - ResourceCategory( - id=str(uuid.uuid4()), - title="音乐音效", - ai_prompt="背景音乐、音效、声音素材", - color="#96CEB4", - created_at=now, - updated_at=now - ), - ResourceCategory( - id=str(uuid.uuid4()), - title="文字图片", - ai_prompt="文字、标题、图标、图形素材", - color="#FFEAA7", - created_at=now, - updated_at=now - ), - ResourceCategory( - id=str(uuid.uuid4()), - title="特效素材", - ai_prompt="转场、特效、动画、滤镜素材", - color="#DDA0DD", - created_at=now, - updated_at=now - ) - ] + default_categories = [] self._save_categories(default_categories) return default_categories @@ -123,7 +73,7 @@ class ResourceCategoryManager: def get_all_categories(self) -> List[Dict]: """获取所有分类""" - return [asdict(category) for category in self.categories if category.is_active] + return [asdict(category) for category in self.categories] def get_category_by_id(self, category_id: str) -> Optional[Dict]: """根据ID获取分类""" @@ -192,9 +142,7 @@ class ResourceCategoryManager: results = [] for category in self.categories: - if (category.is_active and - (keyword in category.title.lower() or - keyword in category.ai_prompt.lower())): + if (keyword in category.title.lower() or keyword in category.ai_prompt.lower()): results.append(asdict(category)) return results diff --git a/src/pages/ProjectManagePage.tsx b/src/pages/ProjectManagePage.tsx index c68b8f8..52b8492 100644 --- a/src/pages/ProjectManagePage.tsx +++ b/src/pages/ProjectManagePage.tsx @@ -203,70 +203,79 @@ const ProjectManagePage: React.FC = () => { {/* 项目列表 */}
{filteredProjects.map((project) => ( -
- {/* 项目标题 */} -
-

{project.name}

- -
- - - -
+
+ {/* 商品图片 */} +
+ {project.product_image ? ( + <> + {project.product_name { + const target = e.target as HTMLImageElement + target.style.display = 'none' + const fallback = target.parentElement?.querySelector('.image-fallback') as HTMLElement + if (fallback) { + fallback.style.display = 'flex' + } + }} + /> +
+ +
+ + ) : ( +
+ +
+ )}
- {/* 项目信息 */} -
- {/* 本地目录 */} -
-

本地目录:

-

- {project.local_directory} -

+
+ {/* 项目标题 */} +
+

{project.name}

+ +
+ + + +
- {/* 商品信息 */} - {project.product_name && ( -
-

商品名:

-

{project.product_name}

-
- )} - - {/* 商品图片 */} - {project.product_image && ( -
-

商品图片:

-
- -

- {project.product_image.split('/').pop()} -

+ {/* 项目信息 */} +
+ {/* 商品信息 */} + {project.product_name && ( +
+

商品名:

+

{project.product_name}

-
- )} + )} - {/* 创建时间 */} -
- 创建于 {new Date(project.created_at).toLocaleDateString()} + {/* 创建时间 */} +
+ 创建于 {new Date(project.created_at).toLocaleDateString()} +
@@ -391,16 +400,19 @@ const ProjectManagePage: React.FC = () => {

预览:

商品图片预览 { const target = e.target as HTMLImageElement target.style.display = 'none' - target.nextElementSibling!.classList.remove('hidden') + const fallback = target.parentElement?.querySelector('.fallback-text') as HTMLElement + if (fallback) { + fallback.style.display = 'block' + } }} /> -
+
无法预览