-
-
-
+
+
+
-
-
- {{ i }}
-
+
@@ -266,13 +278,71 @@
+
+
+
加载中...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- {{ product.productName ? product.productName.substring(0, 2) : '产品' }}
+
+
+
+
+
+
@@ -300,6 +306,34 @@ const onCategoryChange = () => {
getProducts()
}
+// 处理图片路径
+const getFileAccessHttpUrl = (path: string) => {
+ if (!path) return ''
+
+ // 如果已经是完整的HTTP URL或blob URL,直接返回
+ if (path.startsWith('http://') || path.startsWith('https://') || path.startsWith('blob:')) {
+ return path
+ }
+
+ // 如果是相对路径,转换为静态资源URL
+ if (path.startsWith('/')) {
+ return `http://localhost:8080/jeecg-boot/sys/common/static${path}`
+ }
+
+ // 为产品图片添加默认路径
+ return `http://localhost:8080/jeecg-boot/sys/common/static/${path}`
+}
+
+// 图片加载错误处理
+const handleImageError = (event: Event) => {
+ const img = event.target as HTMLImageElement
+ img.style.display = 'none'
+ const placeholder = img.nextElementSibling as HTMLElement
+ if (placeholder) {
+ placeholder.style.display = 'flex'
+ }
+}
+
// 生命周期
onMounted(() => {
getCategories()
@@ -405,7 +439,22 @@ onMounted(() => {
.product-image {
position: relative;
width: 100%;
- height: 200px;
+ height: 250px;
+ border-radius: 12px;
+ overflow: hidden;
+ background: linear-gradient(135deg, #f8f9fa, #e9ecef);
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+}
+
+.product-cover-image {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ transition: all 0.3s ease;
+}
+
+.product-cover-image:hover {
+ transform: scale(1.05);
}
.image-placeholder {
@@ -414,7 +463,17 @@ onMounted(() => {
display: flex;
align-items: center;
justify-content: center;
- background: var(--background-light);
+ background: linear-gradient(135deg, #f8f9fa, #e9ecef);
+ border: 2px dashed #dee2e6;
+}
+
+.image-placeholder svg {
+ opacity: 0.6;
+ transition: opacity 0.3s ease;
+}
+
+.product-image:hover .image-placeholder svg {
+ opacity: 0.8;
}
.product-badges {