diff --git a/src/pages/ProjectManagePage.tsx b/src/pages/ProjectManagePage.tsx
index bbe84fd..4a72b22 100644
--- a/src/pages/ProjectManagePage.tsx
+++ b/src/pages/ProjectManagePage.tsx
@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react'
import { Plus, Edit, Trash2, Search, Save, X, FolderOpen, Package } from 'lucide-react'
import { open } from '@tauri-apps/plugin-dialog'
+import { convertFileSrc } from '@tauri-apps/api/core'
import { ProjectService, Project } from '../services/projectService'
const ProjectManagePage: React.FC = () => {
@@ -16,6 +17,18 @@ const ProjectManagePage: React.FC = () => {
product_image: ''
})
+ // 辅助函数:转换图片路径为Tauri可访问的URL
+ const getImageSrc = (imagePath: string): string => {
+ if (!imagePath) return ''
+ if (imagePath.startsWith('http')) return imagePath
+ try {
+ return convertFileSrc(imagePath)
+ } catch (error) {
+ console.error('Failed to convert file src:', error)
+ return ''
+ }
+ }
+
useEffect(() => {
loadProjects()
}, [])
@@ -209,7 +222,7 @@ const ProjectManagePage: React.FC = () => {
{project.product_image ? (
<>
{
@@ -400,7 +413,7 @@ const ProjectManagePage: React.FC = () => {
预览: