初步完成
This commit is contained in:
@@ -181,16 +181,16 @@ Component({
|
||||
let rawList = Array.isArray(deviceUserIds) ? deviceUserIds : [];
|
||||
// 兼容对象数组和纯ID数组,统一转为字符串比对
|
||||
let deviceIds = rawList.map(item => ({
|
||||
userID: String(item.userID || item),
|
||||
memberID: String(item.memberID || "")
|
||||
userID: item.userID,
|
||||
memberID: item.memberID
|
||||
}));
|
||||
let localIds = userList.map(user => String(user.id));
|
||||
let localIds = userList.map(user => user.id);
|
||||
|
||||
// 秤有、列表没有 → 需要从秤删除
|
||||
let needDeleteList = deviceIds.filter(d => !localIds.includes(d.userID));
|
||||
|
||||
// 秤没有、列表有 → 需要下发到秤
|
||||
let needSyncList = userList.filter(user => !deviceIds.some(d => d.userID === String(user.id)));
|
||||
let needSyncList = userList.filter(user => !deviceIds.some(d => d.userID == user.id));
|
||||
|
||||
console.log("需删除", needDeleteList, "需下发", needSyncList);
|
||||
|
||||
@@ -221,12 +221,12 @@ Component({
|
||||
userID: user.id,
|
||||
userName: user.realname,
|
||||
memberID: "",
|
||||
age: user.age,
|
||||
gender: user.sex,
|
||||
height: user.height,
|
||||
age: user.age || '',
|
||||
gender: user.sex === 2 ? 0 : user.sex,
|
||||
height: String(user.height || ''),
|
||||
isAthleteMode: 0,
|
||||
deviceHeaderIndex: syncIndex,
|
||||
currentWeight: String(user.weight),
|
||||
currentWeight: String(user.weight || ''),
|
||||
targetWeight: "",
|
||||
idealWeight: "",
|
||||
recentData: [],
|
||||
@@ -258,7 +258,7 @@ Component({
|
||||
let item = needDeleteList[delIndex];
|
||||
app.globalData.ppScale.activeProtocol.dataDeleteUser({
|
||||
userID: item.userID,
|
||||
memberID: item.memberID
|
||||
memberID: ""
|
||||
}, (status) => {
|
||||
if (status == 0) {
|
||||
delIndex++;
|
||||
|
||||
@@ -78,7 +78,10 @@ Component({
|
||||
|
||||
// 监听工号输入
|
||||
onWorkNoInput(e) {
|
||||
this.setData({ workNo: e.detail.value });
|
||||
this.setData({
|
||||
workNo: e.detail.value,
|
||||
userInfo: null
|
||||
});
|
||||
},
|
||||
|
||||
// 监听身高输入
|
||||
|
||||
@@ -29,12 +29,16 @@ Component({
|
||||
title: "正在获取Wi-Fi列表...",
|
||||
mask: true
|
||||
});
|
||||
app.globalData.ppScale.activeProtocol.dataFindSurroundDevice((res) => {
|
||||
wx.hideLoading();
|
||||
this.setData({
|
||||
wifiList: res
|
||||
})
|
||||
})
|
||||
// 重新获取协议实例,避免用户同步操作后旧引用失效
|
||||
setTimeout(() => {
|
||||
app.globalData.ppScale.activeProtocol = app.globalData.ppScale.plugin.ScaleAction.getActiveProtocol();
|
||||
app.globalData.ppScale.activeProtocol.dataFindSurroundDevice((res) => {
|
||||
wx.hideLoading();
|
||||
this.setData({
|
||||
wifiList: res
|
||||
})
|
||||
})
|
||||
}, 1500);
|
||||
},
|
||||
|
||||
// 最小化后重连,重置所有状态并重新获取 WiFi 列表
|
||||
|
||||
Reference in New Issue
Block a user