- /**
- * 获取完整的图片URL
- * @param {string|object} image 图片文件ID、文件展示对象或完整地址
- * @returns {string} 完整的图片URL
- */
- export function getImageUrl(image) {
- if (!image) return ''
- if (typeof image === 'object') return image.thumbnail_url || image.url || ''
- if (/^(https?:)?\/\//i.test(image) || image.startsWith('/')) return image
- return `/file/${encodeURIComponent(image)}`
- }
|