From f98cfe010e40915abe93b3fc5e553fe67513aec4 Mon Sep 17 00:00:00 2001 From: 17792275749 <812100002@qq.com> Date: Thu, 29 May 2025 14:50:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=9B=B4=E6=8D=A2wi?= =?UTF-8?q?fi=E5=90=8D=E7=A7=B0=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../replaceNetwork_3/replaceNetwork_3.js | 83 +++---------------- 1 file changed, 12 insertions(+), 71 deletions(-) diff --git a/components/replaceNetwork_3/replaceNetwork_3.js b/components/replaceNetwork_3/replaceNetwork_3.js index 59c28cb..facde4a 100644 --- a/components/replaceNetwork_3/replaceNetwork_3.js +++ b/components/replaceNetwork_3/replaceNetwork_3.js @@ -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({