144 lines
4.3 KiB
Plaintext
144 lines
4.3 KiB
Plaintext
<scroll-view class="page-scroll" scroll-y="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}">
|
||
<view class="screen">
|
||
<safe-top />
|
||
<view class="eyebrow">LITTLE THINGS, BIG LOVE</view>
|
||
<view class="title">今日小任务</view>
|
||
<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">
|
||
{{item.category==='water'?'💧':item.category==='food'?'🥣':'🐾'}}
|
||
</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>
|
||
</scroll-view>
|
||
<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" />
|