fix: 修复OSS图片URL无法正确显示的问题

This commit is contained in:
菜鸟生产 2026-03-18 14:21:58 +08:00
parent a1e7d76bb6
commit c226f00a60
4 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,7 @@
# Version Configuration for Zodiac Collection Management System
# 当前版本号 (语义化版本:主版本。次版本.修订版)
VERSION=1.1.7
VERSION=1.1.8
# 版本代号 (可选)
VERSION_CODENAME="新生"

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>甲辰收藏 v1.1.5</title>
<title>甲辰收藏 v1.1.7</title>
<!-- Favicon -->
<link rel="icon" type="image/x-icon" href="/static/icons/favicon.ico" />

View File

@ -158,7 +158,7 @@ export default function Detail() {
{collection.images.map((img, index) => (
<div key={img.id || index} style={{ position: 'relative' }}>
<img
src={`/${img.path || `uploads/collections/${img.filename}`}`}
src={img.path?.startsWith('http') ? img.path : `/${img.path || `uploads/collections/${img.filename}`}`}
alt={img.originalName || '藏品图片'}
onClick={() => { setCurrentImageIndex(index); setShowImage(true); }}
style={{
@ -291,7 +291,7 @@ export default function Detail() {
{/* 图片 */}
<img
src={`/${collection.images[currentImageIndex].path || `uploads/collections/${collection.images[currentImageIndex].filename}`}`}
src={collection.images[currentImageIndex].path?.startsWith('http') ? collection.images[currentImageIndex].path : `/${collection.images[currentImageIndex].path || `uploads/collections/${collection.images[currentImageIndex].filename}`}`}
alt={collection.images[currentImageIndex].originalName || '藏品图片'}
onClick={(e) => e.stopPropagation()}
style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }}

View File

@ -123,7 +123,7 @@ export default function Edit() {
if (data.images && Array.isArray(data.images)) {
const images = data.images.map(img => ({
file: null,
preview: `/${img.path || `uploads/collections/${img.filename}`}`,
preview: img.path?.startsWith('http') ? img.path : `/${img.path || `uploads/collections/${img.filename}`}`,
name: img.original_name || img.filename,
size: 0,
id: img.id
@ -182,7 +182,7 @@ export default function Edit() {
if (data.images && Array.isArray(data.images)) {
const images = data.images.map(img => ({
file: null,
preview: `/${img.path || `uploads/collections/${img.filename}`}`,
preview: img.path?.startsWith('http') ? img.path : `/${img.path || `uploads/collections/${img.filename}`}`,
name: img.original_name || img.filename,
size: 0,
id: img.id