feat:收藏下载页优化loading逻辑

This commit is contained in:
R524809
2026-05-07 10:30:39 +08:00
parent c0b1bfddb0
commit 0737c6165e
6 changed files with 201 additions and 88 deletions
+48 -47
View File
@@ -25,7 +25,12 @@
<!-- 收藏的题型 -->
<block wx:if="{{activeTab === 'favorites'}}">
<view wx:if="{{favoriteList.length === 0}}" class="fav-empty">
<view wx:if="{{favLoading}}" class="fav-loading">
<text
class="toy-icon toy-icon-loading fav-loading__icon"
aria-hidden="true"></text>
</view>
<view wx:elif="{{favoriteList.length === 0}}" class="fav-empty">
<text class="fav-empty__emoji">🦆</text>
<text class="fav-empty__msg">鸭丫还没找到收藏呢</text>
<text class="fav-empty__sub">去发现好玩的练习纸吧~</text>
@@ -33,11 +38,12 @@
去发现
</button>
</view>
<view wx:else class="fav-list">
<view wx:elif="{{favoriteList.length > 0}}" class="fav-list">
<block wx:for="{{favoriteList}}" wx:key="id">
<view
wx:if="{{item.variant === 'standard'}}"
class="fav-card fav-card--row">
class="fav-card fav-card--row"
data-path="{{item.path}}"
bindtap="onCardTap">
<image
class="fav-card__thumb"
src="{{item.thumb}}"
@@ -86,42 +92,6 @@
color="#b02500" />
</view>
</view>
<view
wx:elif="{{item.variant === 'featured'}}"
class="fav-card fav-card--bento">
<view class="fav-bento__content">
<text class="fav-card__title fav-bento__title"
>{{item.title}}</text
>
<text class="fav-bento__meta"
>{{item.metaLine}}</text
>
<view class="fav-bento__tags">
<text
wx:for="{{item.tags}}"
wx:for-item="tag"
wx:key="*this"
class="fav-bento__tag"
># {{tag}}</text
>
</view>
</view>
<van-icon
class="fav-bento__deco"
name="font-o"
size="200rpx"
color="rgba(108, 90, 0, 0.12)" />
<view
class="fav-bento__heart"
data-id="{{item.id}}"
catchtap="onRemoveFavorite"
aria-role="button">
<van-icon
name="like"
size="40rpx"
color="#b02500" />
</view>
</view>
</block>
</view>
<view wx:if="{{favoriteList.length > 0}}" class="fav-cta">
@@ -134,8 +104,13 @@
<!-- 下载历史 -->
<block wx:if="{{activeTab === 'downloads'}}">
<view wx:if="{{dlLoading}}" class="fav-loading">
<text
class="toy-icon toy-icon-loading fav-loading__icon"
aria-hidden="true"></text>
</view>
<view
wx:if="{{downloadSections.length === 0}}"
wx:elif="{{downloadSections.length === 0}}"
class="fav-empty">
<van-icon
name="clock"
@@ -147,7 +122,7 @@
去发现
</button>
</view>
<view wx:else class="fav-dl">
<view wx:elif="{{downloadSections.length > 0}}" class="fav-dl">
<block
wx:for="{{downloadSections}}"
wx:for-item="section"
@@ -160,7 +135,9 @@
wx:for="{{section.items}}"
wx:for-item="row"
wx:key="id"
class="fav-dl-row {{row.placeholder === 'draw' ? 'fav-dl-row--muted' : ''}}">
class="fav-dl-row {{row.placeholder === 'draw' ? 'fav-dl-row--muted' : ''}}"
data-path="{{row.path}}"
bindtap="onCardTap">
<view
wx:if="{{row.placeholder === 'draw'}}"
class="fav-dl-row__thumb fav-dl-row__thumb--ph">
@@ -178,6 +155,30 @@
<text class="fav-dl-row__title"
>{{row.title}}</text
>
<view class="fav-card__meta">
<text class="fav-card__meta-text"
>{{row.metaLine}}</text
>
<view
class="fav-card__stars"
aria-label="{{row.stars}} 星">
<van-icon
wx:if="{{row.stars >= 1}}"
name="star"
size="22rpx"
color="#d4a900" />
<van-icon
wx:if="{{row.stars >= 2}}"
name="star"
size="22rpx"
color="#d4a900" />
<van-icon
wx:if="{{row.stars >= 3}}"
name="star"
size="22rpx"
color="#d4a900" />
</view>
</view>
<view class="fav-dl-row__meta">
<van-icon
name="clock"
@@ -197,10 +198,10 @@
class="fav-dl-row__more"
data-id="{{row.id}}"
catchtap="onDownloadMore">
<van-icon
name="ellipsis"
size="40rpx"
color="#7c766a" />
<toy-icon
name="arrow-right"
size="36rpx"
color="#2b2b2b" />
</view>
</view>
</view>