Files
sundynix-pets/pets-fe/pages/tasks/tasks.wxml
T
Blizzard c2b51f96e0
ci-cd / verify (push) Successful in 6s
ci-cd / deploy (push) Skipped
Fix capsule-aligned navigation and refresh mini program typography
2026-10-04 10:30:17 +08:00

141 lines
4.1 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.
<page-layout id="page-layout" title="今日小任务">
<view class="screen">
<view class="summary">
<view>这一天也要照顾好它们</view>
<strong>
{{done}}
<text>/ {{tasks.length}}</text>
</strong>
<view class="progress">
<view style="width:{{tasks.length?done/tasks.length*100:0}}%"></view>
</view>
</view>
<view class="row">
<text class="section-title">{{date}} 的日常</text>
<text class="add" bindtap="open">+ 添加任务</text>
</view>
<view class="date-nav">
<text data-days="-1" bindtap="changeDay">‹ 前一天</text>
<text bindtap="showToday">回到今天</text>
<text data-days="1" bindtap="changeDay">后一天 ›</text>
</view>
<view class="card list">
<view wx:for="{{tasks}}" wx:key="id" class="task">
<view
class="check {{item.completed?'done':''}}"
data-index="{{index}}"
bindtap="toggle"
>
{{item.completed?'✓':''}}
</view>
<view class="icon">
<app-icon kind="{{item.category}}" size="36" />
</view>
<view class="info" data-index="{{index}}" bindtap="edit">
<strong>{{item.title}}</strong>
<text>
{{item.petName}} · {{item.time_of_day}} ·
{{item.repeat_rule==='daily'?'每天':item.repeat_rule==='weekdays'?'工作日':'周末'}}
</text>
<text>点此编辑</text>
</view>
<text class="remove" data-index="{{index}}" bindtap="remove">×</text>
</view>
<view wx:if="{{!tasks.length}}" class="empty">
从喝水、喂食开始,安排温柔的小日常
</view>
</view>
<button class="primary" bindtap="open">+ 新建日常任务</button>
</view>
</page-layout>
<view wx:if="{{showForm}}" class="overlay">
<view class="sheet">
<view class="row">
<strong>{{editingId?'编辑小任务':'新建小任务'}}</strong>
<text bindtap="close">×</text>
</view>
<view class="field">
<view class="field-label">任务名称</view>
<input
placeholder="比如:更换饮水"
value="{{title}}"
data-key="title"
bindinput="field"
/>
</view>
<view class="field">
<view class="field-label">照顾谁</view>
<picker
range="{{pets}}"
range-key="name"
value="{{petIndex}}"
bindchange="petChange"
>
<view class="picker">{{pets[petIndex].name||'请先添加宠物'}}</view>
</picker>
</view>
<view class="field">
<view class="field-label">类型</view>
<radio-group bindchange="categoryChange">
<label>
<radio value="food" checked="{{category==='food'}}" color="#194f42" />
喂食
</label>
<label>
<radio
value="water"
checked="{{category==='water'}}"
color="#194f42"
/>
喝水
</label>
<label>
<radio
value="other"
checked="{{category==='other'}}"
color="#194f42"
/>
其他
</label>
</radio-group>
</view>
<view class="field">
<view class="field-label">时间</view>
<picker mode="time" value="{{time_of_day}}" bindchange="timeChange">
<view class="picker">{{time_of_day}}</view>
</picker>
</view>
<view class="field">
<view class="field-label">重复</view>
<radio-group bindchange="repeatChange">
<label>
<radio
value="daily"
checked="{{repeat_rule==='daily'}}"
color="#194f42"
/>
每天
</label>
<label>
<radio
value="weekdays"
checked="{{repeat_rule==='weekdays'}}"
color="#194f42"
/>
工作日
</label>
<label>
<radio
value="weekends"
checked="{{repeat_rule==='weekends'}}"
color="#194f42"
/>
周末
</label>
</radio-group>
</view>
<button class="primary" bindtap="save" disabled="{{saving}}">保存任务</button>
</view>
</view>
<tab-bar current="/pages/tasks/tasks" />