Files
ttstd_family_care_miniapp/pages/usage-records/index.wxml
T

57 lines
2.2 KiB
Plaintext

<view class="page">
<!-- 近 7 天趋势 -->
<view class="card trend-card">
<text class="trend-title">近 7 天使用时长</text>
<view class="trend-bars">
<view wx:for="{{trend}}" wx:key="key" class="trend-col">
<text class="trend-duration">{{item.duration}}</text>
<view class="trend-bar" style="height: {{item.height}}rpx"></view>
<text class="trend-label">{{item.label}}</text>
</view>
</view>
</view>
<!-- 分段切换(吸顶) -->
<view class="seg-wrap">
<view class="seg">
<view class="seg-item {{tab === 'timeline' ? 'active' : ''}}" data-tab="timeline" bindtap="onTab">按时间</view>
<view class="seg-item {{tab === 'byApp' ? 'active' : ''}}" data-tab="byApp" bindtap="onTab">按应用</view>
</view>
</view>
<!-- 按时间 -->
<block wx:if="{{tab === 'timeline'}}">
<view wx:if="{{!sessions.length && !loading}}" class="empty">暂无使用记录</view>
<block wx:for="{{sessions}}" wx:key="key">
<view wx:if="{{item.dayHeader}}" class="day-header">{{item.dayHeader}}</view>
<view class="card record-row">
<image wx:if="{{item.iconUrl}}" class="app-icon" src="{{item.iconUrl}}" mode="aspectFill" />
<view wx:else class="app-icon app-icon-fallback">📱</view>
<view class="record-body">
<text class="record-title">{{item.appName}}</text>
<text class="record-meta">{{item.timeText}}</text>
</view>
</view>
</block>
<view wx:if="{{loadingMore}}" class="empty small">加载中…</view>
</block>
<!-- 按应用 -->
<block wx:else>
<view wx:if="{{!apps.length}}" class="empty">暂无使用记录</view>
<view wx:for="{{apps}}" wx:key="key" class="card record-row">
<image wx:if="{{item.iconUrl}}" class="app-icon" src="{{item.iconUrl}}" mode="aspectFill" />
<view wx:else class="app-icon app-icon-fallback">📱</view>
<view class="record-body">
<view class="app-line">
<text class="record-title">{{item.appName}}</text>
<text class="app-duration">{{item.duration}}</text>
</view>
<view class="app-track">
<view class="app-fill" style="width: {{item.percent}}%"></view>
</view>
</view>
</view>
</block>
</view>