feat: 首页、分类页加载数据逻辑重构
This commit is contained in:
@@ -27,14 +27,21 @@
|
||||
<view
|
||||
wx:for="{{featuredItems}}"
|
||||
wx:key="id"
|
||||
class="home-hero-card"
|
||||
class="home-hero-card {{item.skeleton ? 'home-hero-card--skeleton' : ''}}"
|
||||
data-title="{{item.title}}"
|
||||
data-path="{{item.path}}"
|
||||
bindtap="onTapFeatured">
|
||||
<view
|
||||
class="home-hero-card__top"
|
||||
style="background-color: {{item.topBg}}">
|
||||
<text class="home-hero-card__icon">{{item.icon}}</text>
|
||||
bindtap="{{item.skeleton ? '' : 'onTapFeatured'}}">
|
||||
<view class="home-hero-card__top">
|
||||
<image
|
||||
wx:if="{{!item.skeleton && item.previewImg}}"
|
||||
class="home-hero-card__cover"
|
||||
src="{{item.previewImg}}"
|
||||
mode="aspectFill" />
|
||||
<text
|
||||
wx:if="{{!item.skeleton && !item.previewImg}}"
|
||||
class="home-hero-card__icon"
|
||||
>{{item.icon}}</text
|
||||
>
|
||||
<text
|
||||
wx:if="{{item.badge}}"
|
||||
class="home-hero-card__badge"
|
||||
@@ -46,7 +53,9 @@
|
||||
<text class="home-hero-card__title"
|
||||
>{{item.title}}</text
|
||||
>
|
||||
<text class="home-hero-card__meta"
|
||||
<text
|
||||
wx:if="{{!item.skeleton}}"
|
||||
class="home-hero-card__meta"
|
||||
>{{item.ageBand}} · {{item.difficulty}}</text
|
||||
>
|
||||
</view>
|
||||
@@ -98,14 +107,19 @@
|
||||
<view
|
||||
wx:for="{{hotRecommends}}"
|
||||
wx:key="id"
|
||||
class="home-hot-card"
|
||||
class="home-hot-card {{item.skeleton ? 'home-hot-card--skeleton' : ''}}"
|
||||
data-title="{{item.title}}"
|
||||
data-path="{{item.path}}"
|
||||
bindtap="onTapHotRecommend">
|
||||
<view
|
||||
class="home-hot-card__thumb"
|
||||
style="background-color: {{item.topBg}}">
|
||||
<text class="home-hot-card__thumb-emoji"
|
||||
bindtap="{{item.skeleton ? '' : 'onTapHotRecommend'}}">
|
||||
<view class="home-hot-card__thumb">
|
||||
<image
|
||||
wx:if="{{!item.skeleton && item.previewImg}}"
|
||||
class="home-hot-card__thumb-img"
|
||||
src="{{item.previewImg}}"
|
||||
mode="aspectFill" />
|
||||
<text
|
||||
wx:if="{{!item.skeleton && !item.previewImg}}"
|
||||
class="home-hot-card__thumb-emoji"
|
||||
>{{item.icon}}</text
|
||||
>
|
||||
</view>
|
||||
@@ -114,7 +128,9 @@
|
||||
<text class="home-hot-card__desc"
|
||||
>{{item.subtitle}}</text
|
||||
>
|
||||
<view class="home-hot-card__meta">
|
||||
<view
|
||||
wx:if="{{!item.skeleton}}"
|
||||
class="home-hot-card__meta">
|
||||
<text class="home-hot-card__tag"
|
||||
>{{item.ageBand}}</text
|
||||
>
|
||||
@@ -123,7 +139,11 @@
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view class="home-hot-card__action">›</view>
|
||||
<view
|
||||
wx:if="{{!item.skeleton}}"
|
||||
class="home-hot-card__action"
|
||||
>›</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -157,13 +177,11 @@
|
||||
data-title="{{item.title}}"
|
||||
data-path="{{item.path}}"
|
||||
bindtap="onTapTrackCard">
|
||||
<view
|
||||
class="home-track-card__top"
|
||||
style="background-color: {{item.topBg}}">
|
||||
<view class="home-track-card__top">
|
||||
<image
|
||||
wx:if="{{item.img}}"
|
||||
wx:if="{{item.previewImg}}"
|
||||
class="home-track-card__cover"
|
||||
src="{{item.img}}"
|
||||
src="{{item.previewImg}}"
|
||||
mode="widthFix" />
|
||||
<text wx:else class="home-track-card__icon"
|
||||
>{{item.icon}}</text
|
||||
|
||||
Reference in New Issue
Block a user