From 04740730da2b5e20b009f392f84d5cf919de303b Mon Sep 17 00:00:00 2001 From: 17792275749 <812100002@qq.com> Date: Fri, 10 Apr 2026 11:42:34 +0800 Subject: [PATCH] =?UTF-8?q?[AI=20Generated]:=20refactor(Comp):=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E9=85=8D=E7=BD=91=E8=B6=85=E6=97=B6=E6=9C=BA=E5=88=B6?= =?UTF-8?q?=E3=80=81=E5=B7=A5=E5=8F=B7=E8=BE=93=E5=85=A5=E6=BB=A18?= =?UTF-8?q?=E4=BD=8D=E8=87=AA=E5=8A=A8=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configureDevice_2_addUser.js | 11 ++-- .../configureDevice_2_addUser.wxml | 18 +++--- .../configureDevice_3/configureDevice_3.js | 56 ++++++------------- 3 files changed, 33 insertions(+), 52 deletions(-) diff --git a/components/configureDevice_2_addUser/configureDevice_2_addUser.js b/components/configureDevice_2_addUser/configureDevice_2_addUser.js index b118a92..bbe1ef4 100644 --- a/components/configureDevice_2_addUser/configureDevice_2_addUser.js +++ b/components/configureDevice_2_addUser/configureDevice_2_addUser.js @@ -100,12 +100,13 @@ Component({ }); }, - // 监听工号输入(员工模式) + // 监听工号输入(员工模式),输入满 8 位时自动查询 onWorkNoInput(e) { - this.setData({ - workNo: e.detail.value, - userInfo: null - }); + const value = e.detail.value; + this.setData({ workNo: value, userInfo: null }); + if (value.trim().length === 8) { + this.searchUser(); + } }, // 监听身高输入(员工模式) diff --git a/components/configureDevice_2_addUser/configureDevice_2_addUser.wxml b/components/configureDevice_2_addUser/configureDevice_2_addUser.wxml index 0561ea9..ef2f00e 100644 --- a/components/configureDevice_2_addUser/configureDevice_2_addUser.wxml +++ b/components/configureDevice_2_addUser/configureDevice_2_addUser.wxml @@ -39,9 +39,9 @@ {{userInfo.realname || ''}} - - 请先输入工号 - + + + @@ -54,9 +54,9 @@ {{userInfo.sex === 1 ? '男' : userInfo.sex === 2 ? '女' : ''}} - - 请先输入工号 - + + + @@ -69,9 +69,9 @@ {{userInfo.birthday || ''}} - - 请先输入工号 - + + + diff --git a/components/configureDevice_3/configureDevice_3.js b/components/configureDevice_3/configureDevice_3.js index 54a0172..0a21a4d 100644 --- a/components/configureDevice_3/configureDevice_3.js +++ b/components/configureDevice_3/configureDevice_3.js @@ -1,8 +1,5 @@ const app = getApp(); -// 超时时间:15 秒 -const SDK_TIMEOUT = 15000; - Component({ data: { progress: 0, @@ -20,7 +17,6 @@ Component({ }, detached() { console.log('configureDevice3 detached'); - if (this._sdkCancel) { this._sdkCancel(); this._sdkCancel = null; } } }, @@ -84,42 +80,26 @@ Component({ let version = app.globalData.ppScale.version; if (version === 'domain1') { - this._sdkCancel = app.callWithTimeout( - (done) => app.globalData.ppScale.activeProtocol.dataConfigNetWork({ - domain: app.globalData.ppScale.domain1, - ssid: this.data.selectWifi.ssid, - password: this.data.selectWifiPWD - }, done), - SDK_TIMEOUT, - (res) => { - console.log("setNetwork.js dataConfigNetWork 1", res); - this.netWorkCallBack(res); - }, - () => { - this.setData({ progress: 1 }); - wx.showToast({ title: "配网超时,请重试", icon: "none" }); - } - ); + 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') { - this._sdkCancel = app.callWithTimeout( - (done) => app.globalData.ppScale.activeProtocol.dataConfigUserNetWork({ - domain: app.globalData.ppScale.domain2, - ssid: this.data.selectWifi.ssid, - password: this.data.selectWifiPWD, - userName: "apiUser", - userPassword: "3acebb95eb49577e9c2a2082589b9bd6", - }, done), - SDK_TIMEOUT, - (res) => { - console.log("setNetwork.js dataConfigUserNetWork 2", res); - this.netWorkCallBack(res); - }, - () => { - this.setData({ progress: 1 }); - wx.showToast({ title: "配网超时,请重试", icon: "none" }); - } - ); + app.globalData.ppScale.activeProtocol.dataConfigUserNetWork({ + domain: app.globalData.ppScale.domain2, + ssid: this.data.selectWifi.ssid, + password: this.data.selectWifiPWD, + userName: "apiUser", + userPassword: "3acebb95eb49577e9c2a2082589b9bd6", + }, (res) => { + console.log("setNetwork.js dataConfigUserNetWork 2", res); + this.netWorkCallBack(res); + }); } },