/** * 图片 URL 处理工具函数 */ import { API_ORIGIN } from '@/config/app' /** * 解析图片 URL,为相对路径添加域名前缀 */ export function resolveImageUrl(url?: string): string { if (!url) return '' if (url.startsWith('http://') || url.startsWith('https://') || url.startsWith('data:')) { return url } const normalized = url.startsWith('/') ? url : `/${url}` if (normalized.startsWith('/uploads/')) { return API_ORIGIN + normalized } return url } export function getImageBaseUrl(): string { return API_ORIGIN }