From baecc976eed564bd4f9a17afb1a005c12ffa1a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Thu, 10 Apr 2025 16:34:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E8=93=9D=E7=89=99?= =?UTF-8?q?=E9=80=8F=E4=BC=A0=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD+?= =?UTF-8?q?=E8=A2=AB=E5=8F=AB=E6=97=B6=E6=9F=A5=E8=AF=A2=E9=94=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.cjs | 3 +- App.vue | 10 +- constant/transportType.js | 7 + pages/addDevice/searchDevice.vue | 7 +- pages/main/customBox.vue | 47 +++-- pages/p2p/authorizeWechat.vue | 23 ++- stores/bluetooth.js | 334 +++++++++++++++++++++++-------- 7 files changed, 324 insertions(+), 107 deletions(-) create mode 100644 constant/transportType.js diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 27c8944..e29e48e 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -9,7 +9,8 @@ module.exports = { uni: 'writable', getApp: 'writable', wx: 'writable', - getCurrentPages: 'writable' + getCurrentPages: 'writable', + requirePlugin: 'writable' }, // 指定如何解析语法 parser: 'vue-eslint-parser', diff --git a/App.vue b/App.vue index 6b24e74..18c5e7f 100644 --- a/App.vue +++ b/App.vue @@ -16,6 +16,7 @@ appid: '', // 小程序版本 envVersion: '', + sn: '', // 获取环境配置 getEnvConfig() { const envVersionStorage = getStorage('envVersion') @@ -84,6 +85,13 @@ key: 'Call', routeType: 'switchTab' }) + + wmpfVoip.onVoipEvent(event => { + if (event.eventName === 'callPageOnShow') { + const query = wmpfVoip.getPluginOnloadOptions() + getApp().globalData.sn = query.callerId + } + }) }, // 强制升级 updateMiniProgram() { @@ -104,5 +112,5 @@ diff --git a/constant/transportType.js b/constant/transportType.js new file mode 100644 index 0000000..7effc3f --- /dev/null +++ b/constant/transportType.js @@ -0,0 +1,7 @@ +export const transportType = { + TRANSPORT_BLUETOOTH: 0, + TRANSPORT_OFFLINE: 10, + TRANSPORT_GATEWAY: 20, + TRANSPORT_WIFI: 30, + TRANSPORT_TENCENT_YUN: 40 +} diff --git a/pages/addDevice/searchDevice.vue b/pages/addDevice/searchDevice.vue index abdb58f..b1f0689 100644 --- a/pages/addDevice/searchDevice.vue +++ b/pages/addDevice/searchDevice.vue @@ -67,7 +67,7 @@ 'getCommKey', 'connectBluetoothDevice', 'updateServerTimestamp', - 'getLockStatus' + 'getLockStatusInfo' ]), ...mapActions(useBasicStore, ['getDeviceInfo', 'routeJump', 'getNetworkType']), async connect(device) { @@ -123,7 +123,7 @@ } const date = new Date() const timestamp = this.serverTimestamp - date.getTimezoneOffset() * 60 - const { code } = await this.getLockStatus({ + const { code } = await this.getLockStatusInfo({ name: this.currentLockInfo.name, uid: this.userInfo.uid.toString(), nowTime: this.serverTimestamp, @@ -148,7 +148,8 @@ icon: 'none' }) } - } catch (res) { + } catch (error) { + console.log('连接失败', error) uni.hideLoading() uni.showToast({ title: '连接失败,请靠近设备并保持设备处于唤醒状态', diff --git a/pages/main/customBox.vue b/pages/main/customBox.vue index 2249512..c616fe2 100644 --- a/pages/main/customBox.vue +++ b/pages/main/customBox.vue @@ -1,5 +1,5 @@