refactor(fe): 记录从 tab 降级成页面,tabBar 减到 4 个
## tabBar 首页 / 报告 / 社区 / 我的。记录不再是 tab。 因为高亮是 tabBar 组件按当前路由自己算的(Phase A 那次改的),删一个 tab 只需要动 LIST 一处,四个页面一行都没改。 ## 快速记录独立成页 —— 但没有新建页面 弹层里塞 24 项确实挤(用户原话「很丑」)。撤掉上一版加的 quickRecord 分支。 **pages/record/record 本身就是那个页面**:它顶部已经是 24 项 4 组宫格, 下面接着健康洞察、体重趋势、健康时间轴。再单独建一个只放宫格的页面,等于同一个 宫格维护两份,而且那页除了宫格什么都没有,进去点一下就得退出来。 所以把它从 tab 降级成二级页:nav 标题从「快速记录」改成「记录」+ 返回键, 移除 tabBar 同步。首页右下角悬浮键直接跳它,落地就是宫格。 pet-switch 保留 —— 时间轴/趋势/洞察都是按宠物看的,而且计划页作为二级页 也是这么处理的,一致。 ## 入口 首页悬浮键 → 记录页(全部 24 项) 首页「快速记录」卡 → 8 个高频项直接开表单,「更多」→ 记录页 文章页 / 设置页 → 记录页 三处 switchTab 改成 navigateTo(记录页已经不是 tab,switchTab 会静默失败)。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,10 +29,6 @@
|
|||||||
"pagePath": "pages/home/home",
|
"pagePath": "pages/home/home",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"pagePath": "pages/record/record",
|
|
||||||
"text": "记录"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"pagePath": "pages/report/report",
|
"pagePath": "pages/report/report",
|
||||||
"text": "报告"
|
"text": "报告"
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ Component({
|
|||||||
optSel: {},
|
optSel: {},
|
||||||
dateVals: { vaccine: '', deworm: '' },
|
dateVals: { vaccine: '', deworm: '' },
|
||||||
// 通用简易记录(洗护/清洁那 15 种共用)
|
// 通用简易记录(洗护/清洁那 15 种共用)
|
||||||
typeGroups: [],
|
|
||||||
isSimple: false,
|
isSimple: false,
|
||||||
simpleLabel: '',
|
simpleLabel: '',
|
||||||
simpleDate: '',
|
simpleDate: '',
|
||||||
@@ -226,7 +225,6 @@ Component({
|
|||||||
}
|
}
|
||||||
// 是否走通用简易表单。缓存热的时候是同步的;万一没热就按「不是」处理,
|
// 是否走通用简易表单。缓存热的时候是同步的;万一没热就按「不是」处理,
|
||||||
// 那 9 种的分支写死在 wxml 里不依赖这份缓存,不会因此打不开
|
// 那 9 种的分支写死在 wxml 里不依赖这份缓存,不会因此打不开
|
||||||
if (type === 'quickRecord') patch.typeGroups = recordTypes.groups() || [];
|
|
||||||
const simple = recordTypes.isSimple(type);
|
const simple = recordTypes.isSimple(type);
|
||||||
patch.isSimple = simple;
|
patch.isSimple = simple;
|
||||||
if (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>
|
<button class="btn btn-primary btn-block" bindtap="onSave">保存记录</button>
|
||||||
</block>
|
</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'}}">
|
<block wx:elif="{{innerType === 'reminders'}}">
|
||||||
<view class="sheet-h3">提醒中心</view>
|
<view class="sheet-h3">提醒中心</view>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
const LIST = [
|
const LIST = [
|
||||||
{ pagePath: '/pages/home/home', text: '首页', icon: 'home' },
|
{ pagePath: '/pages/home/home', text: '首页', icon: 'home' },
|
||||||
{ pagePath: '/pages/record/record', text: '记录', icon: 'record' },
|
|
||||||
{ pagePath: '/pages/report/report', text: '报告', icon: 'report' },
|
{ pagePath: '/pages/report/report', text: '报告', icon: 'report' },
|
||||||
{ pagePath: '/pages/community/community', text: '社区', icon: 'community' },
|
{ pagePath: '/pages/community/community', text: '社区', icon: 'community' },
|
||||||
{ pagePath: '/pages/mine/mine', text: '我的', icon: 'user' },
|
{ pagePath: '/pages/mine/mine', text: '我的', icon: 'user' },
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ Page({
|
|||||||
},
|
},
|
||||||
// 从文章跳到对应的记录入口
|
// 从文章跳到对应的记录入口
|
||||||
goRecord() {
|
goRecord() {
|
||||||
wx.switchTab({ url: '/pages/record/record' });
|
wx.navigateTo({ url: '/pages/record/record' });
|
||||||
},
|
},
|
||||||
onShareAppMessage() {
|
onShareAppMessage() {
|
||||||
const a = this.data.article;
|
const a = this.data.article;
|
||||||
|
|||||||
@@ -298,9 +298,10 @@ Page({
|
|||||||
onEditPet() {
|
onEditPet() {
|
||||||
this.openSheetType('editPet');
|
this.openSheetType('editPet');
|
||||||
},
|
},
|
||||||
// 右下角悬浮键:打开 24 项记录选择器(原来是跳 AI 聊天页)
|
// 右下角悬浮键:进记录页。原来做成弹层里的选择器,弹层装 24 项太挤了;
|
||||||
|
// 记录页顶部本来就是那个宫格,再单独建一个只放宫格的页面等于维护两份
|
||||||
onQuickRecord() {
|
onQuickRecord() {
|
||||||
this.openSheetType('quickRecord');
|
wx.navigateTo({ url: '/pages/record/record' });
|
||||||
},
|
},
|
||||||
goSettings() {
|
goSettings() {
|
||||||
wx.navigateTo({ url: '/pages/settings/settings' });
|
wx.navigateTo({ url: '/pages/settings/settings' });
|
||||||
@@ -315,7 +316,7 @@ Page({
|
|||||||
else this.goLearn();
|
else this.goLearn();
|
||||||
},
|
},
|
||||||
goRecord() {
|
goRecord() {
|
||||||
wx.switchTab({ url: '/pages/record/record' });
|
wx.navigateTo({ url: '/pages/record/record' });
|
||||||
},
|
},
|
||||||
onShareAppMessage() {
|
onShareAppMessage() {
|
||||||
return { title: '肉垫计划 · 每天照顾好毛孩子', path: '/pages/home/home' };
|
return { title: '肉垫计划 · 每天照顾好毛孩子', path: '/pages/home/home' };
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
const store = require('../../utils/store.js');
|
const store = require('../../utils/store.js');
|
||||||
const api = require('../../utils/api.js');
|
const api = require('../../utils/api.js');
|
||||||
const { toastErr } = require('../../utils/ui.js');
|
const { toastErr } = require('../../utils/ui.js');
|
||||||
const { syncTabBar } = require('../../utils/tabbar.js');
|
|
||||||
const recordTypes = require('../../utils/recordTypes.js');
|
const recordTypes = require('../../utils/recordTypes.js');
|
||||||
|
|
||||||
function pad(n) {
|
function pad(n) {
|
||||||
@@ -123,7 +122,6 @@ Page({
|
|||||||
if (this._unsub) this._unsub();
|
if (this._unsub) this._unsub();
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
syncTabBar(this);
|
|
||||||
this.loadTypes();
|
this.loadTypes();
|
||||||
store
|
store
|
||||||
.ready()
|
.ready()
|
||||||
|
|||||||
@@ -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>
|
<view class="top-bar"><pet-switch bind:add="onAddPet"></pet-switch></view>
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ Page({
|
|||||||
wx.navigateTo({ url: `/pages/relations/relations?id=${uid}&kind=${e.currentTarget.dataset.kind}` });
|
wx.navigateTo({ url: `/pages/relations/relations?id=${uid}&kind=${e.currentTarget.dataset.kind}` });
|
||||||
},
|
},
|
||||||
goRecord() {
|
goRecord() {
|
||||||
wx.switchTab({ url: '/pages/record/record' });
|
wx.navigateTo({ url: '/pages/record/record' });
|
||||||
},
|
},
|
||||||
onPickAvatar() {
|
onPickAvatar() {
|
||||||
upload
|
upload
|
||||||
|
|||||||
Reference in New Issue
Block a user