forked from gxwebsoft/mp-10550
feat(user): 更新用户界面和功能实现- 默认 修改 UnifiedQRButton类型为 danger- 更新 Banner 组件使用 getCmsAdByCode 获取广告数据
- 新增 CMS 文章查询接口 getCmsArticleByCode - 调整 UserCard 组件界面样式和逻辑-优化 BestSellers 商品展示组件 - 更新 IsDealer 组件支持网站字段配置 - 移除用户页面部分冗余代码和样式 - 增加主题样式支持和背景装饰元素 - 调整用户相关组件层级和定位样式
This commit is contained in:
@@ -3,36 +3,35 @@ import {View} from '@tarojs/components'
|
||||
import {Swiper} from '@nutui/nutui-react-taro'
|
||||
import {CmsAd} from "@/api/cms/cmsAd/model";
|
||||
import {Image} from '@nutui/nutui-react-taro'
|
||||
import {getCmsAd} from "@/api/cms/cmsAd";
|
||||
import {getCmsAdByCode} from "@/api/cms/cmsAd";
|
||||
import navTo from "@/utils/common";
|
||||
import {ShopGoods} from "@/api/shop/shopGoods/model";
|
||||
import {listShopGoods} from "@/api/shop/shopGoods";
|
||||
import {pageCmsArticle} from "@/api/cms/cmsArticle";
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||
|
||||
|
||||
const MyPage = () => {
|
||||
const [carouselData, setCarouselData] = useState<CmsAd>()
|
||||
// const [hotToday, setHotToday] = useState<CmsAd>()
|
||||
// const [groupBuy, setGroupBuy] = useState<CmsAd>()
|
||||
const [hotGoods, setHotGoods] = useState<ShopGoods[]>([])
|
||||
const [hotToday, setHotToday] = useState<CmsAd>()
|
||||
const [item, setItem] = useState<CmsArticle>()
|
||||
|
||||
// 加载数据
|
||||
const loadData = () => {
|
||||
const loadData = async () => {
|
||||
// 轮播图
|
||||
getCmsAd(439).then(data => {
|
||||
setCarouselData(data)
|
||||
})
|
||||
// 今日热卖素材(上层图片)
|
||||
// getCmsAd(444).then(data => {
|
||||
// setHotToday(data)
|
||||
// })
|
||||
// 社区拼团素材(下层图片)
|
||||
// getCmsAd(445).then(data => {
|
||||
// setGroupBuy(data)
|
||||
// })
|
||||
const flash = await getCmsAdByCode('flash')
|
||||
// 今日热卖
|
||||
listShopGoods({categoryId: 4424, limit: 2}).then(data => {
|
||||
setHotGoods(data)
|
||||
})
|
||||
const hotToday = await getCmsAdByCode('hot_today')
|
||||
// 时里动态
|
||||
const news = await pageCmsArticle({limit:1,recommend:1})
|
||||
// 赋值
|
||||
if(flash){
|
||||
setCarouselData(flash)
|
||||
}
|
||||
if(hotToday){
|
||||
setHotToday(hotToday)
|
||||
}
|
||||
if(news && news.list.length > 0){
|
||||
setItem(news.list[0])
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -77,12 +76,12 @@ const MyPage = () => {
|
||||
height: '110px'
|
||||
}}>
|
||||
{
|
||||
hotGoods.map(item => (
|
||||
hotToday?.imageList?.map(item => (
|
||||
<View className={'item flex flex-col mr-4'}>
|
||||
<Image
|
||||
width={70}
|
||||
height={70}
|
||||
src={item.image}
|
||||
src={item.url}
|
||||
mode={'scaleToFill'}
|
||||
lazyLoad={false}
|
||||
style={{
|
||||
@@ -90,7 +89,7 @@ const MyPage = () => {
|
||||
}}
|
||||
onClick={() => navTo('/shop/category/index?id=4424')}
|
||||
/>
|
||||
<View className={'text-xs py-2'}>到手价¥{item.price}</View>
|
||||
<View className={'text-xs py-2 text-orange-600 whitespace-nowrap'}>{item.title || '到手价¥9.9'}</View>
|
||||
</View>
|
||||
))
|
||||
}
|
||||
@@ -103,14 +102,14 @@ const MyPage = () => {
|
||||
<View className={'rounded-lg px-3 pb-3'}>
|
||||
<Image
|
||||
width={'100%'}
|
||||
height={100}
|
||||
src={'https://oss.wsdns.cn/20250919/941c99899e694a7798cab3bb28f1f238.png?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90'}
|
||||
height={106}
|
||||
src={item?.image}
|
||||
mode={'scaleToFill'}
|
||||
lazyLoad={false}
|
||||
style={{
|
||||
borderRadius: '4px'
|
||||
}}
|
||||
onClick={() => navTo('cms/detail/index?id=10109')}
|
||||
onClick={() => navTo('cms/detail/index?id=' + item?.articleId)}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user