style(fe): 计划页只留日历和当天安排

去掉完成度卡和完整路线图。这页的用途是「排/看某一天要做什么」,
完成度是个统计(报告页的活),完整路线图和日历在说同一件事、
只是换了个排法——两张卡加起来把日历挤到了第二屏。

跟着清掉 doneCount / allOpen / toggleAll / dateLabel 和一个没人绑的 openSheet
(路线图里的 pk-body 原来绑它,现在那块没了)。

一个前提确认过:删掉路线图不会让节点变孤儿。模板从计划开始日生成 day 0-30,
正好落在本月和下月,两个月都能从日历翻到。只有很旧的计划(开始日在上个月之前)
会有节点翻不到,那些已经是过去的事。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-30 11:12:46 +08:00
parent 9b30bfaaff
commit 2aaae2b917
2 changed files with 1 additions and 41 deletions
+1 -12
View File
@@ -50,7 +50,6 @@ Page({
data: {
pet: {},
plan: null,
doneCount: 0,
cells: [],
monthOff: 0,
monthLabel: '',
@@ -61,7 +60,6 @@ Page({
selDate: '',
selLabel: '',
dayTasks: [],
allOpen: false,
editShow: false,
editId: '',
form: { title: '', date: '', description: '', daily: false },
@@ -97,7 +95,7 @@ Page({
.catch(() => this.setData({ plan: null, cells: [], dayTasks: [] }));
},
apply(plan) {
const tasks = (plan.tasks || []).map((t) => ({ ...t, dateLabel: fmtMD(t.date) }));
const tasks = plan.tasks || [];
const byDate = {};
tasks.forEach((t) => {
if (!t.date) return;
@@ -106,7 +104,6 @@ Page({
this._byDate = byDate;
this.setData({
plan: { ...plan, tasks },
doneCount: tasks.filter((t) => t.done).length,
// 能排的区间:不早于计划开始日,不晚于下月月底。和后端 dayOffset 的校验一致
pickStart: (plan.start_date || '').slice(0, 10),
pickEnd: monthEnd(1),
@@ -151,9 +148,6 @@ Page({
if (d) this.selectDay(d);
},
toggleAll() {
this.setData({ allOpen: !this.data.allOpen });
},
toggleTask(e) {
api
.togglePlanTask(e.currentTarget.dataset.id)
@@ -230,11 +224,6 @@ Page({
});
},
openSheet(e) {
const type = e.currentTarget.dataset.type;
if (!type) return;
this.setData({ sheetType: type, sheetShow: true });
},
closeSheet() {
this.setData({ sheetShow: false });
},
-29
View File
@@ -12,15 +12,6 @@
</view>
<block wx:else>
<view class="card">
<view class="section-head">
<view class="sh-title">{{pet.name}}的 30 天计划</view>
<view class="tag warn">{{plan.completion_pct || 0}}%</view>
</view>
<view class="progress-row"><text>完成度</text><text>{{plan.completion_pct || 0}}%</text></view>
<view class="bar"><view class="bar-fill" style="width:{{plan.completion_pct || 0}}%"></view></view>
</view>
<!-- 月历。按自然月切而不是「从计划开始日起 30 天」:那样窗口会跨两个月,
用户看着 7月26日—8月25日 既不像本月也不像下月,「这个月还剩什么」对不上。
能翻到下月,否则「做下月计划」这件事本身做不了 -->
@@ -64,26 +55,6 @@
<view wx:if="{{!dayTasks.length}}" class="empty">这天还没有安排,点右上角加一件</view>
</view>
<!-- 全部 30 天的路线图,折叠着 -->
<view class="card">
<view class="section-head">
<view class="sh-title">完整路线图</view>
<view class="link" bindtap="toggleAll">{{allOpen ? '收起' : '展开全部'}}</view>
</view>
<block wx:if="{{allOpen}}">
<view wx:for="{{plan.tasks}}" wx:key="id" class="time-block">
<view class="time-label">{{item.day_label}}<text wx:if="{{item.dateLabel}}" class="time-date">{{item.dateLabel}}</text></view>
<view class="plan-task {{item.done ? 'done' : ''}}">
<view class="pk-check" catchtap="toggleTask" data-id="{{item.id}}">
<pt-icon wx:if="{{item.done}}" name="check" size="{{22}}"></pt-icon>
</view>
<view class="pk-body"><text class="pk-b">{{item.title}}</text><view class="pk-p">{{item.description}}</view></view>
</view>
</view>
<view wx:if="{{!plan.tasks.length}}" class="empty">暂无计划</view>
</block>
<view wx:else class="tiny">共 {{plan.tasks.length || 0}} 件事,已完成 {{doneCount}} 件</view>
</view>
</block>
</view>
</scroll-view>