From 8d308288bbf459c82dc15dcda7194b1e375f31f6 Mon Sep 17 00:00:00 2001 From: liu <2302563948@qq.com> Date: Fri, 14 Aug 2026 15:24:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.less | 1 + src/pages/index/index.tsx | 26 ++++++-------------------- src/services/home.ts | 2 +- 3 files changed, 8 insertions(+), 21 deletions(-) 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 }) }