mini
This commit is contained in:
@@ -1,138 +1,223 @@
|
||||
.page-container {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.loading-screen, .error-screen {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
height: 100vh;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.detail-img {
|
||||
width: 100%;
|
||||
display: block;
|
||||
.glass-panel {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.info-section {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #00f0ff;
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 28px;
|
||||
color: #00b96b;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.specs {
|
||||
display: flex;
|
||||
background: rgba(255,255,255,0.05);
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
.hero-section {
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.spec-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
border-right: 1px solid rgba(255,255,255,0.1);
|
||||
|
||||
&:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
.image-container {
|
||||
width: 100%;
|
||||
min-height: 600px;
|
||||
background: radial-gradient(circle at center, #1a1a1a, #000);
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.hero-img {
|
||||
width: 100%;
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.placeholder-box {
|
||||
.icon-bolt { font-size: 100px; }
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 14px;
|
||||
.hero-overlay {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 60%;
|
||||
background: linear-gradient(to top, #000 10%, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
.hero-content {
|
||||
padding: 0 30px;
|
||||
margin-top: -100px; // Pull up over image
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
.hero-title {
|
||||
font-size: 48px;
|
||||
font-weight: 900;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
margin-bottom: 15px;
|
||||
text-shadow: 0 0 20px rgba(0,0,0,0.8);
|
||||
}
|
||||
|
||||
.hero-desc {
|
||||
font-size: 28px;
|
||||
color: #ccc;
|
||||
line-height: 1.5;
|
||||
display: block;
|
||||
margin-bottom: 25px;
|
||||
text-shadow: 0 0 10px rgba(0,0,0,0.8);
|
||||
}
|
||||
|
||||
.tags-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
|
||||
.tag {
|
||||
padding: 8px 20px;
|
||||
border-radius: 30px;
|
||||
font-size: 24px;
|
||||
backdrop-filter: blur(10px);
|
||||
|
||||
&.cyan { background: rgba(0, 240, 255, 0.15); color: #00f0ff; border: 1px solid rgba(0, 240, 255, 0.3); }
|
||||
&.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
|
||||
&.purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
margin-bottom: 20px;
|
||||
.stats-card {
|
||||
margin: 0 30px 40px;
|
||||
border-radius: 24px;
|
||||
padding: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
|
||||
.section-title {
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
margin-bottom: 10px;
|
||||
display: block;
|
||||
border-left: 3px solid #00f0ff;
|
||||
padding-left: 10px;
|
||||
.stat-item {
|
||||
text-align: center;
|
||||
.stat-label { font-size: 24px; color: #888; display: block; margin-bottom: 10px; }
|
||||
.stat-value { font-size: 36px; font-weight: bold; color: #fff; }
|
||||
.price { color: #00b96b; text-shadow: 0 0 10px rgba(0, 185, 107, 0.3); }
|
||||
.low-stock { color: #ff4d4f; }
|
||||
}
|
||||
|
||||
.divider { width: 1px; height: 60px; background: rgba(255,255,255,0.1); }
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 14px;
|
||||
color: #ccc;
|
||||
line-height: 1.6;
|
||||
.features-section {
|
||||
padding: 0 30px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
margin-bottom: 40px;
|
||||
|
||||
.feature-card {
|
||||
padding: 30px;
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
.feature-icon-box {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
margin-right: 25px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(255,255,255,0.05);
|
||||
border-radius: 16px;
|
||||
|
||||
.f-icon { font-size: 40px; color: #00f0ff; }
|
||||
.f-icon-img { width: 50px; height: 50px; }
|
||||
}
|
||||
|
||||
.feature-text {
|
||||
flex: 1;
|
||||
.f-title { font-size: 30px; font-weight: bold; color: #fff; margin-bottom: 10px; display: block; }
|
||||
.f-desc { font-size: 24px; color: #aaa; line-height: 1.5; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.feature-item {
|
||||
margin-bottom: 15px;
|
||||
|
||||
.f-title {
|
||||
font-size: 15px;
|
||||
color: #00f0ff;
|
||||
margin-bottom: 5px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.f-desc {
|
||||
font-size: 13px;
|
||||
color: #bbb;
|
||||
}
|
||||
.detail-image-section {
|
||||
width: 100%;
|
||||
margin-bottom: 40px;
|
||||
.long-detail-img { width: 100%; display: block; }
|
||||
}
|
||||
|
||||
.footer-spacer { height: 160px; }
|
||||
|
||||
.bottom-bar {
|
||||
background: #111;
|
||||
padding: 10px 20px;
|
||||
border-top: 1px solid rgba(255,255,255,0.1);
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 20px 30px;
|
||||
z-index: 100;
|
||||
border-top-left-radius: 30px;
|
||||
border-top-right-radius: 30px;
|
||||
background: rgba(20, 20, 20, 0.95); // Darker for contrast
|
||||
|
||||
.btn-container {
|
||||
.action-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
height: 100px;
|
||||
|
||||
.cart-icon-btn {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.btn-cart, .btn-buy {
|
||||
flex: 1;
|
||||
border: none;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
border-radius: 22px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.btn-cart {
|
||||
background: #333;
|
||||
}
|
||||
|
||||
.btn-buy {
|
||||
background: #00b96b;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 20px;
|
||||
|
||||
.icon { font-size: 40px; margin-bottom: 5px; }
|
||||
.label { font-size: 20px; color: #888; }
|
||||
}
|
||||
|
||||
.btn-add-cart, .btn-buy-now {
|
||||
flex: 1;
|
||||
height: 80px;
|
||||
line-height: 80px;
|
||||
border-radius: 40px;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
margin: 0;
|
||||
|
||||
&::after { border: none; }
|
||||
}
|
||||
|
||||
.btn-add-cart {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-buy-now {
|
||||
background: linear-gradient(90deg, #00b96b, #00f0ff);
|
||||
color: #000;
|
||||
box-shadow: 0 5px 20px rgba(0, 185, 107, 0.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.safe-area-bottom {
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
padding-bottom: calc(20px + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(20px + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ export default function Detail() {
|
||||
const router = useRouter()
|
||||
const { id } = router.params
|
||||
const [product, setProduct] = useState<any>(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
|
||||
useLoad(() => {
|
||||
if (id) fetchDetail(id)
|
||||
@@ -19,6 +20,9 @@ export default function Detail() {
|
||||
setProduct(res)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,50 +33,91 @@ export default function Detail() {
|
||||
})
|
||||
}
|
||||
|
||||
if (!product) return <View className='loading'>Loading...</View>
|
||||
if (loading) return <View className='loading-screen'><Text>Loading...</Text></View>
|
||||
if (!product) return <View className='error-screen'><Text>Product Not Found</Text></View>
|
||||
|
||||
return (
|
||||
<View className='page-container'>
|
||||
<ScrollView scrollY className='content'>
|
||||
<Image src={product.detail_image_url || product.static_image_url || 'https://via.placeholder.com/400x400'} mode='widthFix' className='detail-img' />
|
||||
|
||||
<View className='info-section'>
|
||||
<Text className='title'>{product.name}</Text>
|
||||
<Text className='price'>¥{product.price}</Text>
|
||||
|
||||
<View className='specs'>
|
||||
<View className='spec-item'>
|
||||
<Text className='label'>芯片</Text>
|
||||
<Text className='value'>{product.chip_type}</Text>
|
||||
</View>
|
||||
<View className='spec-item'>
|
||||
<Text className='label'>Flash</Text>
|
||||
<Text className='value'>{product.flash_size}MB</Text>
|
||||
</View>
|
||||
<View className='spec-item'>
|
||||
<Text className='label'>RAM</Text>
|
||||
<Text className='value'>{product.ram_size}MB</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='desc'>
|
||||
<Text className='section-title'>产品介绍</Text>
|
||||
<Text className='text'>{product.description}</Text>
|
||||
{/* Hero Section */}
|
||||
<View className='hero-section'>
|
||||
<View className='image-container'>
|
||||
{product.detail_image_url || product.static_image_url ? (
|
||||
<Image src={product.detail_image_url || product.static_image_url} mode='widthFix' className='hero-img' />
|
||||
) : (
|
||||
<View className='placeholder-box'>
|
||||
<Text className='icon-bolt'>⚡</Text>
|
||||
</View>
|
||||
)}
|
||||
<View className='hero-overlay' />
|
||||
</View>
|
||||
|
||||
{product.features && product.features.map((f, idx) => (
|
||||
<View key={idx} className='feature-item'>
|
||||
<Text className='f-title'>• {f.title}</Text>
|
||||
<Text className='f-desc'>{f.description}</Text>
|
||||
</View>
|
||||
))}
|
||||
<View className='hero-content'>
|
||||
<Text className='hero-title'>{product.name}</Text>
|
||||
<Text className='hero-desc'>{product.description}</Text>
|
||||
|
||||
<View className='tags-row'>
|
||||
<View className='tag cyan'><Text>{product.chip_type}</Text></View>
|
||||
{product.has_camera && <View className='tag blue'><Text>高清摄像头</Text></View>}
|
||||
{product.has_microphone && <View className='tag purple'><Text>阵列麦克风</Text></View>}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Stats Section */}
|
||||
<View className='stats-card glass-panel'>
|
||||
<View className='stat-item'>
|
||||
<Text className='stat-label'>售价</Text>
|
||||
<Text className='stat-value price'>¥{product.price}</Text>
|
||||
</View>
|
||||
<View className='divider' />
|
||||
<View className='stat-item'>
|
||||
<Text className='stat-label'>库存</Text>
|
||||
<Text className={`stat-value ${product.stock < 10 ? 'low-stock' : ''}`}>{product.stock}件</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Features Section */}
|
||||
<View className='features-section'>
|
||||
{product.features && product.features.length > 0 ? (
|
||||
product.features.map((f, idx) => (
|
||||
<View key={idx} className='feature-card glass-panel'>
|
||||
<View className='feature-icon-box'>
|
||||
{f.icon_url ? <Image src={f.icon_url} className='f-icon-img' /> : <Text className='f-icon'>★</Text>}
|
||||
</View>
|
||||
<View className='feature-text'>
|
||||
<Text className='f-title'>{f.title}</Text>
|
||||
<Text className='f-desc'>{f.description}</Text>
|
||||
</View>
|
||||
</View>
|
||||
))
|
||||
) : (
|
||||
<View className='feature-card glass-panel'>
|
||||
<Text className='f-title'>极致性能释放</Text>
|
||||
<Text className='f-desc'>{product.chip_type} 强劲核心,提供强大的边缘计算算力支持。</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* Detail Image */}
|
||||
{product.detail_image_url && (
|
||||
<View className='detail-image-section'>
|
||||
<Image src={product.detail_image_url} mode='widthFix' className='long-detail-img' />
|
||||
</View>
|
||||
)}
|
||||
|
||||
<View className='footer-spacer' />
|
||||
</ScrollView>
|
||||
|
||||
<View className='bottom-bar safe-area-bottom'>
|
||||
<View className='btn-container'>
|
||||
<Button className='btn-cart' onClick={() => Taro.showToast({title: '加入购物车', icon:'none'})}>加入购物车</Button>
|
||||
<Button className='btn-buy' onClick={buyNow}>立即购买</Button>
|
||||
{/* Bottom Bar */}
|
||||
<View className='bottom-bar glass-panel safe-area-bottom'>
|
||||
<View className='action-row'>
|
||||
<View className='cart-icon-btn' onClick={() => Taro.switchTab({ url: '/pages/cart/cart' })}>
|
||||
<Text className='icon'>🛒</Text>
|
||||
<Text className='label'>购物车</Text>
|
||||
</View>
|
||||
<Button className='btn-add-cart' onClick={() => Taro.showToast({title: '加入购物车', icon:'none'})}>加入购物车</Button>
|
||||
<Button className='btn-buy-now' onClick={buyNow}>立即购买</Button>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user