Files
bodyWeight/miniprogram/pages/measurementReport/measurementReport.ts
T

71 lines
1.3 KiB
TypeScript

/** 测量报告数据 */
interface WeightRecord {
/** 体重整数部分 */
weight: number
/** 体重小数部分,含小数点,如 ".20" */
weightDecimal: string
/** 测量时间显示,如 "今日 07:30" */
date: string
/** 与上次相比差值(负=减轻,正=增重) */
diff: number
/** 身高(cm) */
height: number
/** BMI 值 */
bmi: number
/** BMI 评级标签,如 "标准" */
bmiLabel: string
/** 标准体重(kg) */
stdWeight: number
/** 体脂率(%) */
bodyFat: number
/** 体脂肪(kg) */
bodyFatMass: number
/** 基础代谢(kcal) */
bmr: number
}
/**
* 测量报告页
* 展示单次测量的详细数据报告
*/
Page({
data: {
// 报告数据
record: {
weight: 68,
weightDecimal: '.20',
date: '今日 07:30',
diff: -0.3,
height: 176,
bmi: 22.4,
bmiLabel: '标准',
stdWeight: 67.2,
bodyFat: 22.3,
bodyFatMass: 52.1,
bmr: 1652
} as WeightRecord
},
onLoad(options) {
// TODO: 根据 options.id 获取报告详情
},
onReady() {},
onShow() {},
onHide() {},
onUnload() {},
/**
* 分享报告
*/
onShareAppMessage(): WechatMiniprogram.Page.ICustomShareContent {
return {
title: `${this.data.report.userName}的测量报告`,
path: '/pages/measurementReport/measurementReport'
}
}
})