同步用户信息调好了

This commit is contained in:
17792275749
2025-04-23 09:56:51 +08:00
parent 7554edfb93
commit a76176346f
5 changed files with 64 additions and 51 deletions
+33 -21
View File
@@ -10,41 +10,53 @@ Page({
ssid: options.ssid,
password: options.password
}, (res) => {
app.globalData.ppScale.wifi.ssid = ssid;
app.globalData.ppScale.wifi.password = password;
if(res === 23) {
app.globalData.ppScale.wifi.ssid = ssid;
app.globalData.ppScale.wifi.password = password;
let mac = app.globalData.ppScale.device.mac;
let deviceId = app.globalData.ppScale.device.connection.deviceId;
if(mac && deviceId) {
let scaleDeviceId = mac.replace(/:/g, '');
let params = {
equipmentName: app.globalData.ppScale.device.name,
scaleDeviceId: scaleDeviceId,
deviceId: deviceId
};
$.ajax("weighingScale/binding/device", params, "POST").then(res => {
app.globalData.ppScale.activeProtocol.codeSetBindingState((res) => {
console.log("setNetwork.js codeSetBindingState", res);
wx.navigateTo({
url: "/pages/setNetworkSuccessful/setNetworkSuccessful"
let mac = app.globalData.ppScale.device.mac;
let deviceId = app.globalData.ppScale.device.connection.deviceId;
if(mac && deviceId) {
let scaleDeviceId = mac.replace(/:/g, '');
let params = {
equipmentName: app.globalData.ppScale.device.name,
scaleDeviceId: scaleDeviceId,
deviceId: deviceId
};
$.ajax("weighingScale/binding/device", params, "POST").then(res => {
app.globalData.ppScale.activeProtocol.codeSetBindingState((res) => {
console.log("setNetwork.js codeSetBindingState", res);
wx.navigateTo({
url: "/pages/setNetworkSuccessful/setNetworkSuccessful"
})
})
}).catch(err => {
wx.showToast({
icon: "none",
title: err.message
})
setTimeout(() => {
wx.switchTab({
url: "/pages/home/home"
})
}, 1500)
})
}).catch(err => {
} else {
wx.showToast({
icon: "none",
title: err.message
title: "Mac 地址与 deviceId 获取失败,请重新绑定"
})
setTimeout(() => {
wx.switchTab({
url: "/pages/home/home"
})
}, 1500)
})
}
} else {
wx.showToast({
icon: "none",
title: "Mac 地址与 deviceId 获取失败,请重新绑定"
title: "配网失败,错误码:" + res
})
setTimeout(() => {
wx.switchTab({