diff --git a/src/pages/index/index.less b/src/pages/index/index.less index de508b3..9d8e736 100644 --- a/src/pages/index/index.less +++ b/src/pages/index/index.less @@ -137,6 +137,7 @@ border-radius: 20rpx; overflow: hidden; margin-bottom: 16rpx; + box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04); &:last-child { margin-bottom: 0; diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 8ec6eab..0a00ae1 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -38,7 +38,6 @@ function getStatusBarHeight(): number { } export default function IndexPage() { - const token = useAuthStore(s => s.token) const addItem = useCartStore(s => s.addItem) /** 首页配置(轮播图 / 宫格导航 / 促销卡片) */ @@ -48,17 +47,14 @@ export default function IndexPage() { /** 搜索框输入 */ const [keyword, setKeyword] = useState('') - const loggedIn = !!token const statusBarHeight = useMemo(() => getStatusBarHeight(), []) useDidShow(() => { - if (loggedIn) { - loadHomeConfig() - loadRecommend() - } + loadHomeConfig() + loadRecommend() }) - /** 首页配置聚合数据(需登录) */ + /** 首页配置聚合数据 */ const loadHomeConfig = useCallback(async () => { try { const res = await getHomeConfigApi() @@ -68,7 +64,7 @@ export default function IndexPage() { } }, []) - /** 推荐商品(默认排序第一页) */ + /** 推荐商品 */ const loadRecommend = useCallback(async () => { try { const res = await getProductListApi({ page: 1, pageSize: 10 }) @@ -235,17 +231,7 @@ export default function IndexPage() { goProduct()}>查看更多 › - {!loggedIn ? ( - - 登录后查看商品与价格 - Taro.navigateTo({ url: '/pages/login/index' })} - > - 去登录 - - - ) : products.length === 0 ? ( + { products.length === 0 ? ( 暂无商品 @@ -266,7 +252,7 @@ export default function IndexPage() { {product.price !== null ? ( ¥{product.price} ) : ( - 价格待定 + 登陆后查看价格 )} handleQuickAdd(product, e)}> diff --git a/src/services/home.ts b/src/services/home.ts index a2650d5..4a7f57d 100644 --- a/src/services/home.ts +++ b/src/services/home.ts @@ -40,5 +40,5 @@ export interface HomeConfig { /** 首页配置(轮播图 + 宫格导航 + 促销卡片):GET /mini/home */ export function getHomeConfigApi() { - return get('/mini/home') + return get('/mini/home', { skipToken: true }) }