fix: use 3Dmodule zip

This commit is contained in:
xiaoma
2026-02-02 21:03:41 +08:00
parent 69c8a88571
commit b83d9377c0
4 changed files with 145 additions and 12 deletions

View File

@@ -64,6 +64,17 @@ const ProductDetail = () => {
const getModelPaths = (p) => {
if (!p) return null;
// 优先使用后台配置的 3D 模型 URL
if (p.model_3d_url) {
return { obj: p.model_3d_url };
}
// 如果有静态图,且没有特定的 3D 模型 URL则优先显示静态图不进入下方的通用 3D 模板匹配
if (p.static_image_url) {
return null;
}
const text = (p.name + p.description).toLowerCase();
if (text.includes('mini')) {
@@ -117,6 +128,8 @@ const ProductDetail = () => {
}}>
{modelPaths ? (
<ModelViewer objPath={modelPaths.obj} mtlPath={modelPaths.mtl} />
) : product.static_image_url ? (
<img src={product.static_image_url} alt={product.name} style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }} />
) : (
<ThunderboltOutlined style={{ fontSize: 120, color: '#00b96b' }} />
)}