Files
ttstd_family_care_miniapp/pages/wallpaper/index.wxml
T

100 lines
3.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<view class="page">
<view class="segment">
<view
class="segment-item {{segment === 0 ? 'active' : ''}}"
data-index="0"
bindtap="onSegmentTap"
>单个</view>
<view
class="segment-item {{segment === 1 ? 'active' : ''}}"
data-index="1"
bindtap="onSegmentTap"
>轮换</view>
</view>
<!-- 单个:一张壁纸图 + 底部「更换」按钮 -->
<block wx:if="{{segment === 0}}">
<view class="card preview-card">
<view class="preview-frame">
<image
wx:if="{{singleImage && singleImage.src}}"
class="preview-img"
src="{{singleImage.src}}"
mode="aspectFill"
data-url="{{singleImage.src}}"
bindtap="onPreview"
binderror="onImageError"
/>
<view wx:else class="preview-empty">
<text class="preview-empty-icon">🖼️</text>
<text class="preview-empty-text">
{{loading ? '加载中…' : '暂无壁纸,点击「更换」选择图片'}}
</text>
</view>
</view>
</view>
<view
class="primary-btn {{uploading || loading ? 'disabled' : ''}}"
bindtap="onChangeSingle"
>{{uploading ? '上传中…' : '更换'}}</view>
</block>
<!-- 轮换:图片列表(最多 7 张),支持调整顺序,末尾为「新增」入口 -->
<block wx:else>
<view class="rotation-tip">
<text>最多只能添加 {{maxRotation}} 张壁纸({{rotationItems.length}}/{{maxRotation}})</text>
<text wx:if="{{rotationItems.length > 1}}" class="rotation-tip-sub">使用箭头可调整展示顺序</text>
</view>
<view wx:if="{{!rotationItems.length}}" class="rotation-empty">
<text class="preview-empty-icon">🖼️</text>
<text class="preview-empty-text">
{{loading ? '加载中…' : '暂无壁纸,点击「新增」添加'}}
</text>
<view
class="primary-btn add-btn {{uploading || loading ? 'disabled' : ''}}"
bindtap="onAddRotation"
>新增</view>
</view>
<block wx:else>
<view wx:for="{{rotationItems}}" wx:key="key" class="rotation-item">
<image
class="rotation-img"
src="{{item.src}}"
mode="aspectFill"
data-url="{{item.src}}"
bindtap="onPreview"
/>
<view
class="rotation-remove"
data-index="{{index}}"
catchtap="onRemoveRotation"
>✕</view>
<view class="rotation-moves">
<view
class="move-btn {{index === 0 ? 'disabled' : ''}}"
data-index="{{index}}"
data-offset="{{-1}}"
catchtap="onMove"
>↑</view>
<view
class="move-btn {{index === rotationItems.length - 1 ? 'disabled' : ''}}"
data-index="{{index}}"
data-offset="{{1}}"
catchtap="onMove"
>↓</view>
</view>
</view>
<view
wx:if="{{rotationItems.length < maxRotation}}"
class="add-tile {{uploading || loading ? 'disabled' : ''}}"
bindtap="onAddRotation"
>
<text class="add-tile-plus">+</text>
<text>新增</text>
</view>
</block>
</block>
</view>