添加了更换wifi名称的接口

This commit is contained in:
17792275749
2025-05-29 14:50:39 +08:00
parent 472eeaad3e
commit f98cfe010e
+12 -71
View File
@@ -41,78 +41,19 @@ Component({
if(res === 23) {
app.globalData.ppScale.wifi.ssid = ssid;
app.globalData.ppScale.wifi.password = password;
this.triggerEvent('wifiEvent', {
status: true
});
// 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 => {
// if (res.success) {
// app.globalData.ppScale.activeProtocol.codeSetBindingState((res) => {
// console.log("setNetwork.js codeSetBindingState", res);
// if(res == 0) {
// this.triggerEvent('deviceEvent', {
// status: true
// });
// } else {
// app.globalData.ppScale.plugin.Blue.disconnect();
// wx.showToast({
// title: "绑定失败,请重试。",
// icon: "none"
// })
// setTimeout(() => {
// wx.navigateBack({
// delta: 2
// })
// }, 1500)
// }
// })
// } else {
// app.globalData.ppScale.plugin.Blue.disconnect();
// wx.showToast({
// icon: "none",
// title: res.message
// })
// setTimeout(() => {
// wx.navigateBack({
// delta: 2
// })
// }, 1500)
// }
// }).catch(err => {
// app.globalData.ppScale.plugin.Blue.disconnect();
// wx.showToast({
// icon: "none",
// title: err.message
// })
// setTimeout(() => {
// wx.navigateBack({
// delta: 2
// })
// }, 1500)
// })
// } else {
// app.globalData.ppScale.plugin.Blue.disconnect();
// wx.showToast({
// icon: "none",
// title: "Mac 地址与 deviceId 获取失败,请重新绑定"
// })
// setTimeout(() => {
// wx.navigateBack({
// delta: 2
// })
// }, 1500)
// }
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.disconnect();
wx.showToast({