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