Files
sundynix-pets/pets-fe/pages/home/home.wxml
T
Blizzard 42aea10101
ci-cd / verify (push) Successful in 5s
ci-cd / deploy (push) Skipped
Add immediate startup login and loading states for mini program home
2026-10-05 11:03:33 +08:00

100 lines
3.6 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.
<startup-state wx:if="{{phase==='auth' || phase==='auth-error'}}" error="{{error}}" bind:retry="load" />
<page-layout wx:else id="page-layout" title="{{locationName}}" subtitle="{{headerSubtitle}}" location="{{true}}" bind:locationtap="refreshEnvironment">
<view class="screen">
<home-skeleton wx:if="{{loading && !ready}}" />
<view wx:elif="{{!ready && error}}" class="card home-error">
<app-icon kind="paw" size="54" />
<view class="error-title">暂时没能准备好首页</view>
<view class="muted">{{error}}</view>
<button class="primary" bindtap="load">重新加载</button>
</view>
<block wx:else>
<view wx:if="{{error}}" class="refresh-error"><text>更新失败,保留上次的日常记录</text><text class="link" bindtap="load">重试</text></view>
<view wx:elif="{{loading}}" class="refresh-hint">正在更新今天的小日常…</view>
<view class="hero">
<view class="hero-copy">
<text class="hero-small">今日的主角</text>
<text class="hero-title">出门走走吧</text>
<text class="hero-meta">一起出发,收集今天的小快乐</text>
<view class="hero-caption">● 陪伴它们的每一天,都值得记录</view>
</view>
<image src="/assets/corgi-family-five.png" mode="aspectFit" />
</view>
<view class="row heading">
<text class="section-title">带它们出去走走</text>
<text class="link" bindtap="goWalks">遛狗记录 ›</text>
</view>
<view class="card walk-card">
<view class="walk-intro">
<view class="walk-art"><app-icon size="74" /></view>
<view>
<view class="walk-title">今天的风刚刚好</view>
<view class="muted">选择同行的狗狗,一起出门转转。</view>
</view>
</view>
<view wx:if="{{!pets.length}}" class="first-pet">
<view class="first-pet-title">认识你的第一位毛孩子</view>
<view class="muted">先建立档案,再一起出门收集小快乐。</view>
<button class="primary start" bindtap="addPet">添加毛孩子</button>
</view>
<block wx:else>
<view class="picker-label">这次带谁?可以多选</view>
<pet-picker pets="{{pets}}" selected="{{selected}}" bind:change="pick" />
<button class="primary start" bindtap="start">开始遛狗 →</button>
</block>
</view>
<view class="stats">
<view>
<text>本月遛狗</text>
<strong>
{{walkCount}}
<small>次</small>
</strong>
</view>
<view>
<text>一起出发</text>
<strong>
{{selected.length}}
<small>只</small>
</strong>
</view>
<view>
<text>今日任务</text>
<strong>
{{tasks.length}}
<small>项</small>
</strong>
</view>
</view>
<view class="row heading">
<text class="section-title">今天要做的事</text>
<text class="link" bindtap="goTasks">全部任务 ›</text>
</view>
<view class="card tasks">
<view
wx:for="{{tasks}}"
wx:key="id"
class="task"
data-id="{{item.id}}"
bindtap="complete"
>
<view class="check {{item.completed?'done':''}}">
{{item.completed?'✓':''}}
</view>
<view class="task-icon">
<app-icon kind="{{item.category}}" size="36" />
</view>
<view class="task-main">
<text class="task-name">{{item.title}}</text>
<text class="muted">{{item.time_of_day}}</text>
</view>
</view>
<view wx:if="{{!tasks.length}}" class="empty">
今天还没有任务,给狗狗安排一件小事吧
</view>
</view>
</block>
</view>
</page-layout>
<tab-bar wx:if="{{ready}}" current="/pages/home/home" />