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
9 changed files with 7 additions and 32 deletions
Showing only changes of commit 29d2cd3faf - Show all commits
-4
View File
@@ -29,10 +29,6 @@
"pagePath": "pages/home/home",
"text": "首页"
},
{
"pagePath": "pages/record/record",
"text": "记录"
},
{
"pagePath": "pages/report/report",
"text": "报告"
@@ -126,7 +126,6 @@ Component({
optSel: {},
dateVals: { vaccine: '', deworm: '' },
// 通用简易记录(洗护/清洁那 15 种共用)
typeGroups: [],
isSimple: false,
simpleLabel: '',
simpleDate: '',
@@ -226,7 +225,6 @@ Component({
}
// 是否走通用简易表单。缓存热的时候是同步的;万一没热就按「不是」处理,
// 那 9 种的分支写死在 wxml 里不依赖这份缓存,不会因此打不开
if (type === 'quickRecord') patch.typeGroups = recordTypes.groups() || [];
const simple = recordTypes.isSimple(type);
patch.isSimple = simple;
if (simple) {
@@ -253,23 +253,6 @@ module.exports.sel = function (map, key, index, def) {
<button class="btn btn-primary btn-block" bindtap="onSave">保存记录</button>
</block>
<!-- 快速记录:首页 FAB 打开的 24 项选择器。
点某一项后在同一个弹层里 setType 切到那个表单,不关不跳 -->
<block wx:elif="{{innerType === 'quickRecord'}}">
<view class="sheet-h3">记一笔</view>
<view class="sheet-p">选一件刚做完的事,几秒记完。</view>
<view wx:for="{{typeGroups}}" wx:key="key" class="tg {{item.tone}}">
<view class="tg-head"><view class="tg-bar"></view>{{item.label}}<text class="tg-n">{{item.items.length}}</text></view>
<view class="quick-grid cols-3">
<view wx:for="{{item.items}}" wx:for-item="t" wx:key="code" class="quick {{item.tone}}"
data-type="{{t.code}}" bindtap="goSheet">
<pt-icon name="{{t.icon}}" size="{{44}}" fallback="note"></pt-icon>{{t.label}}
</view>
</view>
</view>
<view wx:if="{{!typeGroups.length}}" class="empty">还没有配置可记事项</view>
</block>
<!-- 提醒中心 -->
<block wx:elif="{{innerType === 'reminders'}}">
<view class="sheet-h3">提醒中心</view>
-1
View File
@@ -1,6 +1,5 @@
const LIST = [
{ pagePath: '/pages/home/home', text: '首页', icon: 'home' },
{ pagePath: '/pages/record/record', text: '记录', icon: 'record' },
{ pagePath: '/pages/report/report', text: '报告', icon: 'report' },
{ pagePath: '/pages/community/community', text: '社区', icon: 'community' },
{ pagePath: '/pages/mine/mine', text: '我的', icon: 'user' },
+1 -1
View File
@@ -19,7 +19,7 @@ Page({
},
// 从文章跳到对应的记录入口
goRecord() {
wx.switchTab({ url: '/pages/record/record' });
wx.navigateTo({ url: '/pages/record/record' });
},
onShareAppMessage() {
const a = this.data.article;
+4 -3
View File
@@ -298,9 +298,10 @@ Page({
onEditPet() {
this.openSheetType('editPet');
},
// 右下角悬浮键:打开 24 项记录选择器(原来是跳 AI 聊天页)
// 右下角悬浮键:进记录页。原来做成弹层里的选择器,弹层装 24 项太挤了;
// 记录页顶部本来就是那个宫格,再单独建一个只放宫格的页面等于维护两份
onQuickRecord() {
this.openSheetType('quickRecord');
wx.navigateTo({ url: '/pages/record/record' });
},
goSettings() {
wx.navigateTo({ url: '/pages/settings/settings' });
@@ -315,7 +316,7 @@ Page({
else this.goLearn();
},
goRecord() {
wx.switchTab({ url: '/pages/record/record' });
wx.navigateTo({ url: '/pages/record/record' });
},
onShareAppMessage() {
return { title: '肉垫计划 · 每天照顾好毛孩子', path: '/pages/home/home' };
-2
View File
@@ -1,7 +1,6 @@
const store = require('../../utils/store.js');
const api = require('../../utils/api.js');
const { toastErr } = require('../../utils/ui.js');
const { syncTabBar } = require('../../utils/tabbar.js');
const recordTypes = require('../../utils/recordTypes.js');
function pad(n) {
@@ -123,7 +122,6 @@ Page({
if (this._unsub) this._unsub();
},
onShow() {
syncTabBar(this);
this.loadTypes();
store
.ready()
+1 -1
View File
@@ -1,4 +1,4 @@
<nav-bar title="快速记录"></nav-bar>
<nav-bar title="记录" show-back="{{true}}"></nav-bar>
<view class="top-bar"><pet-switch bind:add="onAddPet"></pet-switch></view>
+1 -1
View File
@@ -47,7 +47,7 @@ Page({
wx.navigateTo({ url: `/pages/relations/relations?id=${uid}&kind=${e.currentTarget.dataset.kind}` });
},
goRecord() {
wx.switchTab({ url: '/pages/record/record' });
wx.navigateTo({ url: '/pages/record/record' });
},
onPickAvatar() {
upload