feat: 阿里云 OSS 资源桶接入,商品图与icon支持远程基址

This commit is contained in:
2026-08-06 22:42:35 +08:00
parent b1ca212a40
commit 2f5e12d252
13 changed files with 90 additions and 32 deletions
+12 -11
View File
@@ -3,6 +3,7 @@ import Taro from '@tarojs/taro'
import { useState } from 'react'
import './index.scss'
import { CATEGORIES } from '../../utils/productConfig'
import { assetUrl } from '../../utils/asset'
import { useThemeContext } from '../../context/ThemeContext'
import { useSafeArea } from '../../hooks/useSafeArea'
import { useStatusBar } from '../../hooks/useStatusBar'
@@ -10,21 +11,21 @@ import ThemedPageMeta from '../../components/ThemedPageMeta'
// 成品展示配图(从 img 里取对应实物图)
const SHOWCASE_LIST = [
{ title: '毕业纪念笔记本', desc: '全班名字组成校徽', image: '/img/book_small/The1.jpg' },
{ title: '铜质杯垫', desc: '金属质感桌面艺术', image: '/img/cup/The1.jpg' },
{ title: '竹制笔盒', desc: '自然竹纹文房雅器', image: '/img/penbox/The1.jpg' },
{ title: '书本型灯', desc: '温暖光影点亮心意', image: '/img/booklight/The1.jpg' },
{ title: '情侣定制礼', desc: '两个人的名字交织', image: '/img/book_big/The1.jpg' },
{ title: '企业年会礼', desc: '员工名字组成Logo', image: '/img/penbox/The2.jpg' }
{ title: '毕业纪念笔记本', desc: '全班名字组成校徽', image: assetUrl('/img/book_small/The1.jpg') },
{ title: '铜质杯垫', desc: '金属质感桌面艺术', image: assetUrl('/img/cup/The1.jpg') },
{ title: '竹制笔盒', desc: '自然竹纹文房雅器', image: assetUrl('/img/penbox/The1.jpg') },
{ title: '书本型灯', desc: '温暖光影点亮心意', image: assetUrl('/img/booklight/The1.jpg') },
{ title: '情侣定制礼', desc: '两个人的名字交织', image: assetUrl('/img/book_big/The1.jpg') },
{ title: '企业年会礼', desc: '员工名字组成Logo', image: assetUrl('/img/penbox/The2.jpg') }
]
// 品类对应的实物照片映射(首页卡片顶部大图)
const PRODUCT_IMG_MAP: Record<string, string> = {
'notebook-small': '/img/book_small/The1.jpg',
'notebook-large': '/img/book_big/The1.jpg',
'coaster': '/img/cup/The1.jpg',
'penbox': '/img/penbox/The1.jpg',
'booklamp': '/img/booklight/The1.jpg'
'notebook-small': assetUrl('/img/book_small/The1.jpg'),
'notebook-large': assetUrl('/img/book_big/The1.jpg'),
'coaster': assetUrl('/img/cup/The1.jpg'),
'penbox': assetUrl('/img/penbox/The1.jpg'),
'booklamp': assetUrl('/img/booklight/The1.jpg')
}
export default function Index() {