feat(fe): 其余 8 页 + 三个薄组件套用新设计语言
页面: - record:3×3 emoji 九宫格(184rpx 高、全站最大的点击块)换成图标 + 4 色分类, 和首页的 8 宫格合并成同一套 .quick-grid,此前它俩是同一个东西的两个副本 - record/plan/community:三套横向切换全部换成 seg-tabs - record/plan/community/report/learn:砍掉与 nav-bar 重复的 46rpx 大标题, 每页白赚约 130rpx 首屏 - 时间轴图标改按 HealthRecord.Type 取(9 值枚举,可靠),老数据里的 emoji 只作兜底;写库的 icon 字段一个字符没动 - profile:设置行加分类图标 + 右侧箭头换图标 - community/report:主操作改深色 CTA,btn-primary 继续留给弹层的「保存」 - 6 套空态写法统一成 .empty 组件: - nav-bar 的 ‹ 和 fab 的 "AI" 文字换成图标;fab 从蓝渐变改深色, 和全站唯一主 CTA 的语义对齐 - pet-switch 的「+」换图标;宠物自己的 emoji 是用户数据,保留 pt-icon 开了 virtualHost,组件标签上的 class 不生效,需要定位的地方 (profile 行图标、箭头)都用外层 view 包了一层。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,10 +15,34 @@ function fmtTime(iso) {
|
||||
if (d.toDateString() === y.toDateString()) return '昨天 ' + hm;
|
||||
return d.getMonth() + 1 + '月' + d.getDate() + '日';
|
||||
}
|
||||
// 记录类型 → 配色。和首页快速记录入口用同一套分组:
|
||||
// 体重/疫苗=橙、便便/饮食=绿、异常/用药=蓝、消费/照片=紫
|
||||
const TYPE_TONE = {
|
||||
weight: 'tone-1', vaccine: 'tone-1', deworm: 'tone-1',
|
||||
poop: 'tone-2', food: 'tone-2',
|
||||
symptom: 'tone-3', medicine: 'tone-3',
|
||||
cost: 'tone-4', photo: 'tone-4',
|
||||
};
|
||||
|
||||
// 记一笔的九个入口
|
||||
const RECORD_ITEMS = [
|
||||
{ type: 'weight', icon: 'weight', label: '体重', tone: 'tone-1' },
|
||||
{ type: 'food', icon: 'food', label: '饮食', tone: 'tone-2' },
|
||||
{ type: 'poop', icon: 'poop', label: '便便', tone: 'tone-2' },
|
||||
{ type: 'symptom', icon: 'symptom', label: '异常', tone: 'tone-3' },
|
||||
{ type: 'medicine', icon: 'medicine', label: '用药', tone: 'tone-3' },
|
||||
{ type: 'cost', icon: 'cost', label: '消费', tone: 'tone-4' },
|
||||
{ type: 'vaccine', icon: 'vaccine', label: '疫苗', tone: 'tone-1' },
|
||||
{ type: 'deworm', icon: 'deworm', label: '驱虫', tone: 'tone-1' },
|
||||
{ type: 'photo', icon: 'photo', label: '照片', tone: 'tone-4' },
|
||||
];
|
||||
|
||||
function mapRecord(r) {
|
||||
return {
|
||||
id: r.id,
|
||||
icon: r.icon || '✍️',
|
||||
// 图标按 type 取(9 值枚举,可靠);老数据 icon 字段里的 emoji 只作兜底
|
||||
type: r.type || r.icon || '',
|
||||
tone: TYPE_TONE[r.type] || 'tone-1',
|
||||
title: r.title,
|
||||
desc: fmtTime(r.occurred_at) + (r.description ? '|' + r.description : ''),
|
||||
image: r.image_url || '',
|
||||
@@ -80,6 +104,7 @@ Page({
|
||||
recHasMore: false,
|
||||
recFilters: REC_FILTERS,
|
||||
recFilterIdx: 0,
|
||||
recordItems: RECORD_ITEMS,
|
||||
trendSvg: '',
|
||||
trendStats: null,
|
||||
trendDots: [],
|
||||
@@ -114,8 +139,9 @@ Page({
|
||||
curFilter() {
|
||||
return this.data.recFilters[this.data.recFilterIdx].key;
|
||||
},
|
||||
// 来自 seg-tabs 的 change 事件
|
||||
onFilterTap(e) {
|
||||
const i = Number(e.currentTarget.dataset.index);
|
||||
const i = Number(e.detail.index);
|
||||
if (i === this.data.recFilterIdx) return;
|
||||
this.setData({ recFilterIdx: i }, () => this.loadRecords());
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user