Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13d23376c2 | ||
|
|
5a6281c9d8 | ||
|
|
5b9a66afc7 |
@@ -16,7 +16,7 @@ interface MemberForm {
|
|||||||
|
|
||||||
/** 员工编号查询接口(页面私有) */
|
/** 员工编号查询接口(页面私有) */
|
||||||
const getEmployeeByWorkNo = (sn: string, workNo: string) =>
|
const getEmployeeByWorkNo = (sn: string, workNo: string) =>
|
||||||
get<any>('weighingScale/v6/getUserInfoByWkno', { sn, workNo })
|
get<any>('weighingScale/v5/getUserInfoByWkno', { sn, workNo })
|
||||||
|
|
||||||
/** 添加/编辑用户接口(页面私有) */
|
/** 添加/编辑用户接口(页面私有) */
|
||||||
const addUser = (data: Record<string, any>) =>
|
const addUser = (data: Record<string, any>) =>
|
||||||
|
|||||||
@@ -159,11 +159,28 @@ const splitWeight = (weight: number): { int: string; decimal: string } => {
|
|||||||
return { int, decimal: `.${dec}` }
|
return { int, decimal: `.${dec}` }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 根据 BMI 计算刻度圆圈位置(百分比) */
|
/**
|
||||||
|
* 刻度轨道结构(rpx):屏宽 750 - basicIndicators 左右 padding 30*2 - 左右 border 4*2 = 682。
|
||||||
|
* BLOCK_GAP 与 less 中 basicIndicatorsTrack 的 gap: 6rpx 保持同步。
|
||||||
|
*/
|
||||||
|
const TRACK_WIDTH = 682
|
||||||
|
const BLOCK_GAP = 6
|
||||||
|
const BLOCK_WIDTH = (TRACK_WIDTH - BLOCK_GAP * 3) / 4
|
||||||
|
|
||||||
|
/** 根据 BMI 计算刻度圆圈圆心位置(百分比),对齐消瘦/正常/超重/肥胖四段分界 18.5/24/28,并计入色块间隙 */
|
||||||
const calcBmiLeft = (bmi?: number): number => {
|
const calcBmiLeft = (bmi?: number): number => {
|
||||||
if (bmi == null || isNaN(bmi)) return 0
|
if (bmi == null || isNaN(bmi)) return 0
|
||||||
const pct = (bmi - 14) / (40 - 14)
|
let left: number
|
||||||
return Math.min(Math.max(pct, 0), 1) * 100
|
if (bmi < 18.5) {
|
||||||
|
left = (bmi / 18.5) * BLOCK_WIDTH
|
||||||
|
} else if (bmi < 24) {
|
||||||
|
left = BLOCK_WIDTH + BLOCK_GAP + ((bmi - 18.5) / (24 - 18.5)) * BLOCK_WIDTH
|
||||||
|
} else if (bmi < 28) {
|
||||||
|
left = BLOCK_WIDTH * 2 + BLOCK_GAP * 2 + ((bmi - 24) / (28 - 24)) * BLOCK_WIDTH
|
||||||
|
} else {
|
||||||
|
left = BLOCK_WIDTH * 3 + BLOCK_GAP * 3 + ((bmi - 28) / (40 - 28)) * BLOCK_WIDTH
|
||||||
|
}
|
||||||
|
return Math.min(Math.max(left / TRACK_WIDTH, 0), 1) * 100
|
||||||
}
|
}
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|||||||
@@ -155,6 +155,10 @@ Page({
|
|||||||
if (!res.confirm) return
|
if (!res.confirm) return
|
||||||
unbindDevice(item.id)
|
unbindDevice(item.id)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
// 取消配对的是当前连接的设备:断开连接并清缓存
|
||||||
|
if (leFuService.isConnected && leFuService.lastRawDevice?.deviceId === item.deviceId) {
|
||||||
|
leFuService.disconnect()
|
||||||
|
}
|
||||||
const cached = wx.getStorageSync('connectDeviceInfo') as Record<string, any> | null
|
const cached = wx.getStorageSync('connectDeviceInfo') as Record<string, any> | null
|
||||||
if (cached?.deviceId === item.deviceId) {
|
if (cached?.deviceId === item.deviceId) {
|
||||||
wx.removeStorageSync('connectDeviceInfo')
|
wx.removeStorageSync('connectDeviceInfo')
|
||||||
@@ -359,6 +363,10 @@ Page({
|
|||||||
if (!res.confirm) return
|
if (!res.confirm) return
|
||||||
unbindDevice()
|
unbindDevice()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
// 取消全部配对:断开当前连接并清缓存
|
||||||
|
if (leFuService.isConnected) {
|
||||||
|
leFuService.disconnect()
|
||||||
|
}
|
||||||
wx.removeStorageSync('connectDeviceInfo')
|
wx.removeStorageSync('connectDeviceInfo')
|
||||||
wx.showToast({ title: '已取消全部配对', icon: 'success' })
|
wx.showToast({ title: '已取消全部配对', icon: 'success' })
|
||||||
this.loadDevices()
|
this.loadDevices()
|
||||||
|
|||||||
Reference in New Issue
Block a user