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

42 lines
1013 B
TypeScript

import { get } from '../../utils/request/index'
/** 将体重数字拆成整数 + 小数字符串 */
const splitWeight = (weight: number): { int: number; decimal: string } => {
const str = weight.toFixed(2)
const [intPart, decPart] = str.split('.')
return { int: Number(intPart), decimal: `.${decPart}` }
}
Page({
data: {
record: null,
},
onShow() {
},
onShareAppMessage(): WechatMiniprogram.Page.ICustomShareContent {
return {
title: '智能蓝牙秤',
path: '/pages/home/home',
imageUrl: '/images/share/share.jpg',
}
},
/** 跳转历史数据页 */
onTapHistory() {
wx.switchTab({ url: '/pages/data/data' })
},
/** 跳转设备列表页 */
onTapSwitchDevice() {
wx.switchTab({ url: '/pages/equipment/equipment' })
},
/** 跳转详细报告页 */
onTapDetailedReport() {
wx.navigateTo({ url: '/pages/detailedReport/detailedReport' })
},
})