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); + }); } },