218 lines
8.3 KiB
Plaintext
218 lines
8.3 KiB
Plaintext
<view class="hcm-page">
|
|
<!-- Loading -->
|
|
<view wx:if="{{loading}}" class="hcm-page__loading">
|
|
正在加载 active worksheet 数据...
|
|
</view>
|
|
|
|
<block wx:else>
|
|
<!-- Timer Status -->
|
|
<view class="hcm-timer-card">
|
|
<view class="hcm-timer-card__info">
|
|
<text class="hcm-timer-card__title">定时自动刷新</text>
|
|
<text class="hcm-timer-card__desc"
|
|
>每日 22:00 自动更新推荐位数据</text
|
|
>
|
|
</view>
|
|
<view class="hcm-timer-card__right">
|
|
<view
|
|
class="hcm-timer-card__badge {{timerEnabled ? 'hcm-timer-card__badge--on' : 'hcm-timer-card__badge--off'}}">
|
|
<text>{{timerEnabled ? '运行中' : '已暂停'}}</text>
|
|
</view>
|
|
<toy-button
|
|
type="{{timerEnabled ? 'default' : 'green'}}"
|
|
size="mini"
|
|
disabled="{{timerLoading}}"
|
|
bindtap="onToggleTimer">
|
|
{{timerEnabled ? '暂停' : '启动'}}
|
|
</toy-button>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- Featured Section -->
|
|
<view class="hcm-section">
|
|
<view class="hcm-section__header">
|
|
<view>
|
|
<text class="hcm-section__title">今日推荐</text>
|
|
<text class="hcm-section__hint">按下载量排序</text>
|
|
</view>
|
|
<text class="hcm-section__count">{{featured.length}} 个</text>
|
|
</view>
|
|
<view wx:if="{{featured.length}}" class="hcm-item-list">
|
|
<view wx:for="{{featured}}" wx:key="_id" class="hcm-item">
|
|
<image
|
|
wx:if="{{item.previewImg}}"
|
|
class="hcm-item__img"
|
|
src="{{item.previewImg}}"
|
|
mode="aspectFill" />
|
|
<view class="hcm-item__info">
|
|
<text class="hcm-item__title">{{item.title}}</text>
|
|
<text class="hcm-item__id">{{item._id}}</text>
|
|
</view>
|
|
<toy-button
|
|
type="default"
|
|
size="mini"
|
|
data-target="featured"
|
|
data-id="{{item._id}}"
|
|
bindtap="onRemoveItem">
|
|
移除
|
|
</toy-button>
|
|
</view>
|
|
</view>
|
|
<view wx:else class="hcm-section__empty">暂未选择内容</view>
|
|
<toy-button
|
|
type="primary"
|
|
size="small"
|
|
data-target="featured"
|
|
bindtap="onTapAdd">
|
|
添加
|
|
</toy-button>
|
|
</view>
|
|
|
|
<!-- WXML_APPEND_1 -->
|
|
|
|
<!-- Hot Section -->
|
|
<view class="hcm-section">
|
|
<view class="hcm-section__header">
|
|
<view>
|
|
<text class="hcm-section__title">热门推荐</text>
|
|
<text class="hcm-section__hint">按点赞量排序</text>
|
|
</view>
|
|
<text class="hcm-section__count">{{hot.length}} 个</text>
|
|
</view>
|
|
<view wx:if="{{hot.length}}" class="hcm-item-list">
|
|
<view wx:for="{{hot}}" wx:key="_id" class="hcm-item">
|
|
<image
|
|
wx:if="{{item.previewImg}}"
|
|
class="hcm-item__img"
|
|
src="{{item.previewImg}}"
|
|
mode="aspectFill" />
|
|
<view class="hcm-item__info">
|
|
<text class="hcm-item__title">{{item.title}}</text>
|
|
<text class="hcm-item__id">{{item._id}}</text>
|
|
</view>
|
|
<toy-button
|
|
type="default"
|
|
size="mini"
|
|
data-target="hot"
|
|
data-id="{{item._id}}"
|
|
bindtap="onRemoveItem">
|
|
移除
|
|
</toy-button>
|
|
</view>
|
|
</view>
|
|
<view wx:else class="hcm-section__empty">暂未选择内容</view>
|
|
<toy-button
|
|
type="primary"
|
|
size="small"
|
|
data-target="hot"
|
|
bindtap="onTapAdd">
|
|
添加
|
|
</toy-button>
|
|
</view>
|
|
|
|
<!-- Category Sections -->
|
|
<view
|
|
wx:for="{{sections}}"
|
|
wx:key="id"
|
|
class="hcm-section {{index === sections.length - 1 ? 'last' : ''}}">
|
|
<view class="hcm-section__header">
|
|
<text class="hcm-section__title"
|
|
>{{item.icon}} {{item.name}}</text
|
|
>
|
|
<text class="hcm-section__count">{{item.items.length}} 个</text>
|
|
</view>
|
|
<view wx:if="{{item.items.length}}" class="hcm-item-list">
|
|
<view
|
|
wx:for="{{item.items}}"
|
|
wx:for-item="ws"
|
|
wx:key="_id"
|
|
class="hcm-item">
|
|
<image
|
|
wx:if="{{ws.previewImg}}"
|
|
class="hcm-item__img"
|
|
src="{{ws.previewImg}}"
|
|
mode="aspectFill" />
|
|
<view class="hcm-item__info">
|
|
<text class="hcm-item__title">{{ws.title}}</text>
|
|
<text class="hcm-item__id">{{ws._id}}</text>
|
|
</view>
|
|
<toy-button
|
|
type="default"
|
|
size="mini"
|
|
data-target="{{item.id}}"
|
|
data-id="{{ws._id}}"
|
|
bindtap="onRemoveItem">
|
|
移除
|
|
</toy-button>
|
|
</view>
|
|
</view>
|
|
<view wx:else class="hcm-section__empty">暂未选择内容</view>
|
|
<toy-button
|
|
type="primary"
|
|
size="small"
|
|
data-target="{{item.id}}"
|
|
bindtap="onTapAdd">
|
|
添加
|
|
</toy-button>
|
|
</view>
|
|
|
|
<!-- WXML_APPEND_2 -->
|
|
|
|
<!-- Build Button -->
|
|
<view class="hcm-page__build">
|
|
<toy-button
|
|
type="primary"
|
|
width="100%"
|
|
loading="{{building}}"
|
|
disabled="{{building}}"
|
|
bindtap="onBuildTap">
|
|
{{building ? '生成中...' : '更新首页数据'}}
|
|
</toy-button>
|
|
</view>
|
|
</block>
|
|
|
|
<!-- Selector Popup -->
|
|
<view
|
|
wx:if="{{selectorVisible}}"
|
|
class="hcm-selector-mask"
|
|
bindtap="onCloseSelector">
|
|
<view class="hcm-selector" catchtap="">
|
|
<view class="hcm-selector__header">
|
|
<text class="hcm-selector__title"
|
|
>选择内容 - {{selectorTargetLabel}}</text
|
|
>
|
|
<text class="hcm-selector__close" bindtap="onCloseSelector"
|
|
>关闭</text
|
|
>
|
|
</view>
|
|
<scroll-view class="hcm-selector__list" scroll-y>
|
|
<view
|
|
wx:if="{{!selectorItems.length}}"
|
|
class="hcm-selector__empty">
|
|
暂无可选内容
|
|
</view>
|
|
<view
|
|
wx:for="{{selectorItems}}"
|
|
wx:key="_id"
|
|
class="hcm-selector-item"
|
|
data-id="{{item._id}}"
|
|
bindtap="onSelectItem">
|
|
<image
|
|
wx:if="{{item.previewImg}}"
|
|
class="hcm-selector-item__img"
|
|
src="{{item.previewImg}}"
|
|
mode="aspectFill" />
|
|
<view class="hcm-selector-item__info">
|
|
<text class="hcm-selector-item__title"
|
|
>{{item.title}}</text
|
|
>
|
|
<text class="hcm-selector-item__sub"
|
|
>{{item.ageBand}} · {{item._id}}</text
|
|
>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</view>
|
|
</view>
|