2025年12月3日14:14:55
This commit is contained in:
@@ -32,42 +32,62 @@ Component({
|
||||
setNerwork() {
|
||||
let ssid = this.properties.ssid;
|
||||
let password = this.properties.password;
|
||||
app.globalData.ppScale.activeProtocol.dataConfigNetWork({
|
||||
domain: app.globalData.ppScale.domain,
|
||||
ssid: ssid,
|
||||
password: password
|
||||
}, (res) => {
|
||||
console.log("setNetwork.js dataConfigNetWork", res);
|
||||
let version = app.globalData.ppScale.version;
|
||||
if (version === 'domain1') {
|
||||
app.globalData.ppScale.activeProtocol.dataConfigNetWork({
|
||||
domain: app.globalData.ppScale.domain1,
|
||||
ssid: this.data.selectWifi.ssid,
|
||||
password: this.data.selectWifiPWD
|
||||
}, (res) => {
|
||||
console.log("setNetwork.js dataConfigNetWork 1", res);
|
||||
|
||||
this.netWorkCallBack(res);
|
||||
})
|
||||
}
|
||||
if (version === 'domain2') {
|
||||
app.globalData.ppScale.activeProtocol.dataConfigUserNetWork({
|
||||
domain: app.globalData.ppScale.domain2,
|
||||
ssid: ssid,
|
||||
password: password,
|
||||
userName: "apiUser",
|
||||
userPassword: "3acebb95eb49577e9c2a2082589b9bd6"
|
||||
}, (res) => {
|
||||
console.log("setNetwork.js dataConfigUserNetWork 2", res);
|
||||
|
||||
this.netWorkCallBack(res);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
if(res === 23) {
|
||||
app.globalData.ppScale.wifi.ssid = ssid;
|
||||
app.globalData.ppScale.wifi.password = password;
|
||||
netWorkCallBack(res) {
|
||||
if(res === 23) {
|
||||
app.globalData.ppScale.wifi.ssid = ssid;
|
||||
app.globalData.ppScale.wifi.password = password;
|
||||
|
||||
let scaleDeviceId = app.globalData.ppScale.device.mac.replace(/:/g, '');
|
||||
if(scaleDeviceId) {
|
||||
let params = {
|
||||
equipmentCode: scaleDeviceId,
|
||||
wifiName: ssid
|
||||
};
|
||||
$.ajax("weighingScale/edit/device", params, "POST").then((res) => {
|
||||
this.triggerEvent('wifiEvent', {
|
||||
status: true
|
||||
});
|
||||
})
|
||||
}
|
||||
} else {
|
||||
app.globalData.ppScale.plugin.Blue.stop();
|
||||
wx.showToast({
|
||||
icon: "none",
|
||||
title: "配网失败,错误码:" + res
|
||||
})
|
||||
setTimeout(() => {
|
||||
let scaleDeviceId = app.globalData.ppScale.device.mac.replace(/:/g, '');
|
||||
if(scaleDeviceId) {
|
||||
let params = {
|
||||
equipmentCode: scaleDeviceId,
|
||||
wifiName: ssid
|
||||
};
|
||||
$.ajax("weighingScale/edit/device", params, "POST").then((res) => {
|
||||
this.triggerEvent('wifiEvent', {
|
||||
status: false
|
||||
status: true
|
||||
});
|
||||
}, 1500)
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
app.globalData.ppScale.plugin.Blue.stop();
|
||||
wx.showToast({
|
||||
icon: "none",
|
||||
title: "配网失败,错误码:" + res
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.triggerEvent('wifiEvent', {
|
||||
status: false
|
||||
});
|
||||
}, 1500)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user