diff --git a/src/pages/find/find.scss b/src/pages/find/find.scss index f9171b6..aed8e22 100644 --- a/src/pages/find/find.scss +++ b/src/pages/find/find.scss @@ -102,7 +102,7 @@ page { } .siteSide { - width: 160rpx; + width: 120rpx; flex: 0 0 160rpx; display: flex; flex-direction: column; @@ -112,13 +112,13 @@ page { } .navArrow { - width: 34rpx; - height: 34rpx; - border-top: 8rpx solid #e60012; - border-right: 8rpx solid #e60012; + width: 14rpx; + height: 14rpx; + border-top: 5rpx solid #e60012; + border-right: 5rpx solid #e60012; border-radius: 4rpx; transform: rotate(45deg); - margin-right: 8rpx; + margin-right: 6rpx; } .distanceText { diff --git a/src/pages/find/find.tsx b/src/pages/find/find.tsx index e3548ad..69ee6cc 100644 --- a/src/pages/find/find.tsx +++ b/src/pages/find/find.tsx @@ -48,7 +48,7 @@ const formatDistance = (meter: number | undefined) => { const m = Math.max(0, Math.round(meter as number)) if (m < 1000) return `${m}米` const km = m / 1000 - return `${km.toFixed(km >= 10 ? 0 : 1)}公里` + return `${km.toFixed(km >= 10 ? 0 : 1)}km` } const Find = () => { @@ -181,7 +181,7 @@ const Find = () => { loadStores(true)} headHeight={60}> - + {viewList.length === 0 && !loading ? ( @@ -240,7 +240,7 @@ const Find = () => { onNavigate(item)}> - {distanceText ? `距离${distanceText}` : '查看导航'} + {distanceText ? `${distanceText}` : '查看导航'} @@ -249,11 +249,6 @@ const Find = () => { })} - {total > 0 && ( - - 共 {total} 个网点 - - )} )} diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index f8fa72d..ec8062b 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -1,10 +1,13 @@ import Taro, {useShareAppMessage, useShareTimeline} from '@tarojs/taro' import {Image, Swiper, SwiperItem, Text, View} from '@tarojs/components' +import {useEffect, useState} from 'react' import iconShop from '@/assets/tabbar/shop.png' import iconFind from '@/assets/tabbar/find.png' import iconKefu from '@/assets/tabbar/kefu.png' import './index.scss' import navTo from "@/utils/common"; +import {pageCmsArticle} from '@/api/cms/cmsArticle' +import type {CmsArticle} from '@/api/cms/cmsArticle/model' function Home() { useShareTimeline(() => { @@ -41,6 +44,29 @@ function Home() { Taro.showToast({title: '发需求(示例)', icon: 'none'}) } + const FAQ_CATEGORY_ID = 4558 + const [faqList, setFaqList] = useState([]) + + const loadFaq = async () => { + try { + const res = await pageCmsArticle({ + categoryId: FAQ_CATEGORY_ID, + page: 1, + limit: 5, + status: 0 + }) + setFaqList(res?.list || []) + } catch (e) { + console.error('loadFaq error:', e) + setFaqList([]) + Taro.showToast({title: '常见问题加载失败', icon: 'none'}) + } + } + + useEffect(() => { + loadFaq().then() + }, []) + return ( @@ -123,25 +149,32 @@ function Home() { 常见问题解答 - 更多>> + navTo(`/cms/category/index?id=${FAQ_CATEGORY_ID}`)} + > + 更多>> + - {[ - {title: '常见问题一', date: '2025-11-12'}, - {title: '常见问题二', date: '2025-11-12'}, - {title: '常见问题三', date: '2025-11-12'}, - {title: '常见问题四', date: '2025-11-12'}, - {title: '常见问题五', date: '2025-11-12'} - ].map((item, idx, arr) => ( - - {item.title} - {item.date} + {faqList.length > 0 ? ( + faqList.map((item, idx, arr) => ( + item.articleId && navTo(`/cms/detail/index?id=${item.articleId}`)} + > + {item.title} + {(item.createTime || '').slice(0, 10)} + + )) + ) : ( + + 暂无常见问题 + - ))} + )}