fix: 修复蓝牙连接误报与 WiFi 列表获取问题,完善一键添加本人
- connectedDevice 忽略 connect 过程中的 UNAVAILABLE 抖动,避免误报蓝牙关闭 - getWifiList 加 settled 保护,onStartSearch 加防重入 - userManagement 一键添加本人(仅加后台、不下发设备) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
b4d3a034ba
commit
dbb2ab8423
@@ -1,4 +1,4 @@
|
||||
import { get, post, del } from '../../utils/request/index'
|
||||
import { get, post, del, put } from '../../utils/request/index'
|
||||
import { leFuService } from '../../lefu/index'
|
||||
import type { SyncUserData } from '../../lefu/index'
|
||||
import { calcAge } from '../../utils/idCard/index'
|
||||
@@ -72,6 +72,10 @@ const markSynced = (data: { sn: string; list: string[] }) =>
|
||||
const deleteMember = (id: string) =>
|
||||
del('weighingScale/v6/del/user', { id }, { loading: false })
|
||||
|
||||
/** 添加设备成员(本人) */
|
||||
const addSelfUser = (data: Record<string, any>) =>
|
||||
put('weighingScale/v6/edit/user', data)
|
||||
|
||||
/** equipment 页传入的目标设备 */
|
||||
let targetDevice: { sn: string; deviceId: string; name: string; connected: boolean; connectDeviceInfo: string } | null = null
|
||||
|
||||
@@ -413,9 +417,36 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
/** 一键添加本人 */
|
||||
/** 一键添加本人:仅调接口把当前登录用户添加为设备成员,不下发设备 */
|
||||
onTapAddSelf() {
|
||||
// 一键添加本人(待接入)
|
||||
const userInfo = wx.getStorageSync('userInfo') as Record<string, any> | null
|
||||
if (!userInfo?.userId) {
|
||||
wx.showToast({ title: '请先完善个人信息', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const sn = targetDevice?.sn
|
||||
if (!sn) return
|
||||
|
||||
addSelfUser({
|
||||
dataType: 0,
|
||||
parentUserId: userInfo.userId,
|
||||
sn,
|
||||
scaleDeviceId: sn,
|
||||
realname: userInfo.realname ?? '',
|
||||
idCard: userInfo.idCard || null,
|
||||
sex: userInfo.sex ?? 0,
|
||||
birthday: userInfo.birthday ?? '',
|
||||
height: userInfo.height ?? 0,
|
||||
weight: userInfo.weight ?? 0,
|
||||
mode: getApp<IAppOption>().globalData.operationsEngineer ? 'ops' : 'normal',
|
||||
})
|
||||
.then(() => {
|
||||
wx.showToast({ title: '添加成功', icon: 'success' })
|
||||
this._loadMembers()
|
||||
})
|
||||
.catch(() => {
|
||||
wx.showToast({ title: '添加失败,请重试', icon: 'none' })
|
||||
})
|
||||
},
|
||||
|
||||
/** 添加新用户 */
|
||||
|
||||
Reference in New Issue
Block a user