feat(auth): access token 缩到 2 小时 + refresh token 机制 #3

Merged
Blizzard merged 58 commits from feat/dev into main 2026-07-30 10:18:07 +00:00
2 changed files with 1 additions and 41 deletions
Showing only changes of commit 2aaae2b917 - Show all commits
+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>