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

@@ -131,14 +131,23 @@ const Home = () => {
justifyContent: 'center',
alignItems: 'center',
color: '#444',
borderBottom: '1px solid rgba(255,255,255,0.05)'
borderBottom: '1px solid rgba(255,255,255,0.05)',
overflow: 'hidden'
}}>
<motion.div
animate={{ y: [0, -10, 0] }}
transition={{ repeat: Infinity, duration: 3, ease: "easeInOut" }}
>
<RocketOutlined style={{ fontSize: 60, color: '#00b96b' }} />
</motion.div>
{product.static_image_url ? (
<img
src={product.static_image_url}
alt={product.name}
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
/>
) : (
<motion.div
animate={{ y: [0, -10, 0] }}
transition={{ repeat: Infinity, duration: 3, ease: "easeInOut" }}
>
<RocketOutlined style={{ fontSize: 60, color: '#00b96b' }} />
</motion.div>
)}
</div>
}
onClick={() => navigate(`/product/${product.id}`)}

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' }} />
)}