From 6ddfae9bdd94bb2a7f466f8f0c98c3df03ad0878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Sun, 4 May 2025 14:46:20 +0800 Subject: [PATCH 1/8] build: v1.2.1+36 --- components/LockSwitch/LockSwitch.vue | 2 +- manifest.json | 13 +- pages.json | 24 +- pages/addDevice/distributionNetwork.vue | 2 +- pages/addDevice/searchDevice.vue | 2 +- pages/addDevice/selectAddress.vue | 283 ------------------------ pages/p2p/VideoList.vue | 2 +- pages/setting/catEyeMode.vue | 8 +- pages/setting/coercionOpenDoor.vue | 2 +- pages/setting/lockInfo.vue | 6 - pages/setting/motorTorsion.vue | 6 +- pages/setting/noticeWay.vue | 8 +- pages/setting/openDoorNotice.vue | 2 +- pages/setting/realTimePicture.vue | 4 +- pages/setting/videoSlot.vue | 4 +- stores/basic.js | 33 ++- 16 files changed, 54 insertions(+), 347 deletions(-) delete mode 100644 pages/addDevice/selectAddress.vue diff --git a/components/LockSwitch/LockSwitch.vue b/components/LockSwitch/LockSwitch.vue index 294ac54..0584767 100644 --- a/components/LockSwitch/LockSwitch.vue +++ b/components/LockSwitch/LockSwitch.vue @@ -7,7 +7,7 @@ v-if="tip" name="question-circle-fill" color="#555555" - size="38" + size="38rpx" @click="tipDialog" > diff --git a/manifest.json b/manifest.json index fdb5525..f59e2c8 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name": "wx-starlock", "appid": "__UNI__933D519", "description": "", - "versionName": "1.2.0", - "versionCode": "35", + "versionName": "1.3.0", + "versionCode": "37", "mp-weixin": { "appid": "wx9829a39e65550757", "setting": { @@ -13,12 +13,11 @@ "permission": { "scope.bluetooth": { "desc": "蓝牙将用于控制和管理您的智能门锁" - }, - "scope.userLocation": { - "desc": "获取您的位置信息将用于智能门锁的位置服务" } }, - "requiredPrivateInfos": ["getLocation"], + "requiredPrivateInfos": [ + "getLocation" + ], "usingComponents": true, "lazyCodeLoading": "requiredComponents", "optimization": { @@ -42,4 +41,4 @@ } }, "vueVersion": "3" -} +} \ No newline at end of file diff --git a/pages.json b/pages.json index 6107d0d..ac6329f 100644 --- a/pages.json +++ b/pages.json @@ -82,13 +82,6 @@ "navigationBarTitleText": "附近设备" } }, - { - "path": "selectAddress", - "style": { - "navigationBarTitleText": "锁地址", - "disableScroll": true - } - }, { "path": "distributionNetwork", "style": { @@ -611,13 +604,22 @@ ], "preloadRule": { "pages/main/home": { - "packages": ["pages/others", "pages/addDevice", "pages/p2p"] + "packages": [ + "pages/others", + "pages/addDevice", + "pages/p2p" + ] }, "pages/main/lockDetail": { - "packages": ["pages/feature", "pages/setting"] + "packages": [ + "pages/feature", + "pages/setting" + ] }, "pages/main/mine": { - "packages": ["pages/user"] + "packages": [ + "pages/user" + ] } }, "globalStyle": { @@ -654,4 +656,4 @@ } ] } -} +} \ No newline at end of file diff --git a/pages/addDevice/distributionNetwork.vue b/pages/addDevice/distributionNetwork.vue index 2290a35..5b5993e 100644 --- a/pages/addDevice/distributionNetwork.vue +++ b/pages/addDevice/distributionNetwork.vue @@ -131,7 +131,7 @@ if (data.status === 0) { $basic.routeJump({ type: 'redirectTo', - name: 'selectAddress' + name: 'bindLock' }) setTimeout(() => { uni.showToast({ diff --git a/pages/addDevice/searchDevice.vue b/pages/addDevice/searchDevice.vue index 30765bc..50274ba 100644 --- a/pages/addDevice/searchDevice.vue +++ b/pages/addDevice/searchDevice.vue @@ -143,7 +143,7 @@ name: this.currentLockInfo.lockConfig.model === model.TENCENT_YUN_LOCK ? 'distributionNetwork' - : 'selectAddress' + : 'bindLock' }) } else { uni.hideLoading() diff --git a/pages/addDevice/selectAddress.vue b/pages/addDevice/selectAddress.vue deleted file mode 100644 index 3f52fd5..0000000 --- a/pages/addDevice/selectAddress.vue +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - diff --git a/pages/p2p/VideoList.vue b/pages/p2p/VideoList.vue index e352ded..04a1bf0 100644 --- a/pages/p2p/VideoList.vue +++ b/pages/p2p/VideoList.vue @@ -30,7 +30,7 @@ v-else class="absolute inset-0 bg-black bg-opacity-30 flex items-center justify-center" > - + {{ timeFormat(video.operateDate, 'yyyy-mm-dd hh:MM') }} diff --git a/pages/setting/catEyeMode.vue b/pages/setting/catEyeMode.vue index d9f3167..d55038d 100644 --- a/pages/setting/catEyeMode.vue +++ b/pages/setting/catEyeMode.vue @@ -18,7 +18,7 @@ " name="checkbox-mark" color="#2a85ec" - size="40" + size="40rpx" > @@ -70,7 +70,7 @@ " name="checkbox-mark" color="#2a85ec" - size="40" + size="40rpx" > @@ -122,7 +122,7 @@ " name="checkbox-mark" color="#2a85ec" - size="40" + size="40rpx" > @@ -174,7 +174,7 @@ " name="checkbox-mark" color="#2a85ec" - size="40" + size="40rpx" > diff --git a/pages/setting/coercionOpenDoor.vue b/pages/setting/coercionOpenDoor.vue index d53f128..7cb44fe 100644 --- a/pages/setting/coercionOpenDoor.vue +++ b/pages/setting/coercionOpenDoor.vue @@ -49,7 +49,7 @@ @click="toJump(null)" class="flex items-center justify-center bg-white shadow-sm rounded-md pos-fixed bottom-[calc(env(safe-area-inset-bottom)+48rpx)] w-686 mx-4 h-100" > - 胁迫指纹 diff --git a/pages/setting/lockInfo.vue b/pages/setting/lockInfo.vue index a54925c..3410afc 100644 --- a/pages/setting/lockInfo.vue +++ b/pages/setting/lockInfo.vue @@ -105,12 +105,6 @@ - - 位置信息 - - {{ $bluetooth.currentLockSetting.lockBasicInfo.address }} - - - + 小功率: @@ -22,7 +22,7 @@ :class="[value === 2 ? 'bg-#d9e8fd' : 'bg-#ececec']" > - + 中功率: @@ -35,7 +35,7 @@ :class="[value === 3 ? 'bg-#d9e8fd' : 'bg-#ececec']" > - + 大功率: diff --git a/pages/setting/noticeWay.vue b/pages/setting/noticeWay.vue index d7372e2..aab0a91 100644 --- a/pages/setting/noticeWay.vue +++ b/pages/setting/noticeWay.vue @@ -12,7 +12,7 @@ 接收者 @@ -51,7 +51,7 @@ 接收者 diff --git a/pages/setting/openDoorNotice.vue b/pages/setting/openDoorNotice.vue index 3cc4819..46d158e 100644 --- a/pages/setting/openDoorNotice.vue +++ b/pages/setting/openDoorNotice.vue @@ -49,7 +49,7 @@ @click="toJump(null)" class="flex items-center justify-center bg-white shadow-sm rounded-md pos-fixed bottom-[calc(env(safe-area-inset-bottom)+48rpx)] w-686 mx-4 h-100" > - 添加家人 diff --git a/pages/setting/realTimePicture.vue b/pages/setting/realTimePicture.vue index d19023a..5bb1fd6 100644 --- a/pages/setting/realTimePicture.vue +++ b/pages/setting/realTimePicture.vue @@ -18,7 +18,7 @@ " name="checkbox-mark" color="#2a85ec" - size="40" + size="40rpx" > @@ -64,7 +64,7 @@ " name="checkbox-mark" color="#2a85ec" - size="40" + size="40rpx" > diff --git a/pages/setting/videoSlot.vue b/pages/setting/videoSlot.vue index 289bfcd..36942c6 100644 --- a/pages/setting/videoSlot.vue +++ b/pages/setting/videoSlot.vue @@ -6,7 +6,7 @@ :class="[isAllDay === 1 ? 'bg-#d9e8fd' : 'bg-#ececec']" > - + - + diff --git a/stores/basic.js b/stores/basic.js index b8668ed..552a78a 100644 --- a/stores/basic.js +++ b/stores/basic.js @@ -52,11 +52,6 @@ const pages = [ path: '/pages/addDevice/searchDevice', tabBar: false }, - { - name: 'selectAddress', - path: '/pages/addDevice/selectAddress', - tabBar: false - }, { name: 'bindLock', path: '/pages/addDevice/bindLock', @@ -415,7 +410,7 @@ const pages = [ ] export const useBasicStore = defineStore('basic', { - state() { + state () { return { // 设备信息 deviceInfo: null, @@ -429,7 +424,7 @@ export const useBasicStore = defineStore('basic', { // 路由跳转 /* data 入参 name string页面名称 type string跳转方式 params object传递参数 delta number返回页面数 * 具体入参查看文档 https://www.uviewui.com/js/route.html */ - routeJump(data) { + routeJump (data) { const page = pages.find(page => { return page.name === data.name }) @@ -458,10 +453,10 @@ export const useBasicStore = defineStore('basic', { } }, // 获取当前网络状态 - getNetworkType() { + getNetworkType () { return new Promise(resolve => { uni.getNetworkType({ - success(res) { + success (res) { if (res.networkType === 'none') { uni.showToast({ title: '网络访问失败,请检查网络是否正常', @@ -472,14 +467,14 @@ export const useBasicStore = defineStore('basic', { } resolve(true) }, - fail() { + fail () { resolve(false) } }) }) }, // 获取设备信息 - getDeviceInfo() { + getDeviceInfo () { const that = this return new Promise(resolve => { if (that.deviceInfo?.model) { @@ -487,18 +482,18 @@ export const useBasicStore = defineStore('basic', { return } uni.getSystemInfo({ - success(res) { + success (res) { that.deviceInfo = res resolve(that.deviceInfo) }, - fail() { + fail () { resolve({}) } }) }) }, // 获取胶囊信息 - getButtonInfo() { + getButtonInfo () { return new Promise(resolve => { if (this.buttonInfo?.top) { resolve(this.buttonInfo) @@ -509,7 +504,7 @@ export const useBasicStore = defineStore('basic', { }) }, // 计算字符串长度 - calculateStringTotalWidth(str) { + calculateStringTotalWidth (str) { let totalWidth = 0 // 遍历字符串中的每一个字符 for (let i = 0; i < str.length; i++) { @@ -526,10 +521,10 @@ export const useBasicStore = defineStore('basic', { return totalWidth }, // 回退页面并弹出toast提示 - backAndToast(message, delta = 1) { + backAndToast (message, delta = 1) { uni.navigateBack({ delta, - complete() { + complete () { setTimeout(() => { uni.showToast({ title: message, @@ -540,7 +535,7 @@ export const useBasicStore = defineStore('basic', { }) }, // 分享跳转 - shareJump(data = this.shareConfig) { + shareJump (data = this.shareConfig) { if (data.path) { const target = data.path.split('/') if (target.length > 1) { @@ -568,7 +563,7 @@ export const useBasicStore = defineStore('basic', { } this.shareConfig = data - function getParams(params) { + function getParams (params) { let paramStr = '' Object.keys(params).forEach(item => { if (paramStr === '') { From 24b6fb61b5b03aca1e7918fa377bf68fc8c5c9fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Fri, 9 May 2025 11:52:58 +0800 Subject: [PATCH 2/8] =?UTF-8?q?feat:=20=E5=9C=A8App.vue=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=BC=BA=E5=88=B6=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E6=A3=80=E6=9F=A5=EF=BC=8C=E6=9B=B4=E6=96=B0README.md?= =?UTF-8?q?=E4=BB=A5=E6=94=B9=E5=96=84=E6=96=87=E6=A1=A3=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 2 ++ README.md | 20 ++++++++++++++------ manifest.json | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/App.vue b/App.vue index 18c5e7f..068b41e 100644 --- a/App.vue +++ b/App.vue @@ -36,8 +36,10 @@ ...mapState(useBluetoothStore, ['bluetoothStatus']) }, async onLaunch() { + // #ifdef MP-WEIXIN // 检查强制升级 this.updateMiniProgram() + // #endif // 监听蓝牙开关状态 this.onBluetoothState() // 设置voip配置 diff --git a/README.md b/README.md index 129604d..0ab99ee 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,23 @@ # 项目说明 ## 功能 -#### 功能与星锁app相同,在其基础上简化 + +### 功能与星锁app相同,在其基础上简化 ## 使用工具 -#### HBuilderX + 微信开发者工具(推荐使用IntelliJ工具编写,HBuilderX代码提示等功能做的较差) + +### HBuilderX + 微信开发者工具(推荐使用IntelliJ工具编写,HBuilderX代码提示等功能做的较差) ## 技术栈 + 运行方式 -#### [uni-app](https://uniapp.dcloud.net.cn/)创建的vue3项目,目前并未使用uni-app x和uniCloud,主要使用vue3 + pinia + uview-plus -#### 在HBuilderX中点击 文件 -> 导入 -> 从本地目录导入,选择项目目录即可导入项目 -#### 运行只需执行`npm i` 安装依赖(node版本 v20.16),然后在HBuilderX中点击运行 -> 运行到微信开发者工具即可(运行前勾选运行时压缩代码) + +### [uni-app](https://uniapp.dcloud.net.cn/)创建的vue3项目,目前并未使用uni-app x和uniCloud,主要使用vue3 + pinia + uview-plus + +### 在HBuilderX中点击 文件 -> 导入 -> 从本地目录导入,选择项目目录即可导入项目 + +### 运行只需执行`npm i` 安装依赖(node版本 v20.16),然后在HBuilderX中点击运行 -> 运行到微信开发者工具即可(运行前勾选运行时压缩代码) ## 目录 + 1. api 项目接口 2. config 项目不同环境配置 3. pages 项目页面 @@ -20,7 +26,9 @@ 6. utils 项目公共方法 ## 公共方法 -#### 示例在index页面中,后续添加公共方法会在文档中说明 + +### 示例在index页面中,后续添加公共方法会在文档中说明 + 1. utils/request 请求方法 2. pinia 全局状态管理 3. [uview-plus](https://uiadmin.net/uview-plus/components/intro.html) Uni-app常用UI组件库,且提供很多常用api diff --git a/manifest.json b/manifest.json index f59e2c8..102a969 100644 --- a/manifest.json +++ b/manifest.json @@ -41,4 +41,4 @@ } }, "vueVersion": "3" -} \ No newline at end of file +} From 06ebc96086e3d48efaf9761274cb8c2aab2e8e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Fri, 16 May 2025 14:23:41 +0800 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20=E5=9C=A8=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E7=8E=AF=E5=A2=83=E4=B8=8B=E7=9A=84=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=8E=B7=E5=8F=96=E5=92=8C=E8=93=9D=E7=89=99?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 7 ++++--- pages/main/customBox.vue | 2 ++ pages/main/home.vue | 8 ++++++++ pages/main/lockDetail.vue | 10 +++++++++- stores/bluetooth.js | 3 +++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/App.vue b/App.vue index 068b41e..092e580 100644 --- a/App.vue +++ b/App.vue @@ -39,11 +39,12 @@ // #ifdef MP-WEIXIN // 检查强制升级 this.updateMiniProgram() - // #endif - // 监听蓝牙开关状态 - this.onBluetoothState() // 设置voip配置 this.setVoipConfig() + // #endif + + // 监听蓝牙开关状态 + this.onBluetoothState() // 检查蓝牙权限 const checkResult = await this.checkSetting() console.log(checkResult) diff --git a/pages/main/customBox.vue b/pages/main/customBox.vue index c616fe2..50031ff 100644 --- a/pages/main/customBox.vue +++ b/pages/main/customBox.vue @@ -38,9 +38,11 @@ const time = ref(0) onMounted(async () => { + // #ifdef MP-WEIXIN const accountInfo = uni.getAccountInfoSync() getApp().globalData.appid = accountInfo.miniProgram.appId getApp().globalData.envVersion = accountInfo.miniProgram.envVersion + // #endif const result = await passthrough({ request_method: 'POST', diff --git a/pages/main/home.vue b/pages/main/home.vue index 93cdf65..9fe1cd9 100644 --- a/pages/main/home.vue +++ b/pages/main/home.vue @@ -218,9 +218,11 @@ title: '加载中', mask: true }) + // #ifdef MP-WEIXIN const accountInfo = uni.getAccountInfoSync() getApp().globalData.appid = accountInfo.miniProgram.appId getApp().globalData.envVersion = accountInfo.miniProgram.envVersion + // #endif this.deviceInfo = await this.getDeviceInfo() const token = getStorage('token') if (token) { @@ -243,9 +245,12 @@ await this.homeLogin() this.pending = false uni.hideLoading() + console.log('登录成功') } + // #ifdef MP-WEIXIN const _data = JSON.parse(JSON.stringify(data)) this.shareJump(_data) + // #endif }, methods: { timeFormat, @@ -403,6 +408,7 @@ homeLogin() { const that = this return new Promise(resolve => { + // #ifdef MP-WEIXIN uni.login({ provider: 'weixin', async success(loginRes) { @@ -437,6 +443,8 @@ resolve(false) } }) + // #endif + resolve(false) }) }, changeRadio() { diff --git a/pages/main/lockDetail.vue b/pages/main/lockDetail.vue index fd85034..71ec3d1 100644 --- a/pages/main/lockDetail.vue +++ b/pages/main/lockDetail.vue @@ -172,7 +172,11 @@ > 掌静脉 - + 授权管理员 @@ -201,6 +206,7 @@ 操作记录 @@ -223,6 +229,7 @@ { + // #ifdef MP-WEIXIN uni.getSetting({ async success(res) { const bluetooth = res.authSetting['scope.bluetooth'] @@ -924,6 +925,8 @@ export const useBluetoothStore = defineStore('ble', { resolve(false) } }) + // #endif + resolve(false) }) }, // 连接蓝牙设备+获取设备服务+获取设备特征值 From 739746151292fccd701c95de0911f8a22dc1cb65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Sat, 17 May 2025 18:22:50 +0800 Subject: [PATCH 4/8] fix --- manifest.json | 80 ++++++++++++++++++------------------ pages/feature/recordList.vue | 2 +- stores/bluetooth.js | 20 ++++++++- 3 files changed, 58 insertions(+), 44 deletions(-) diff --git a/manifest.json b/manifest.json index 102a969..f1b7ea3 100644 --- a/manifest.json +++ b/manifest.json @@ -1,44 +1,42 @@ { - "name": "wx-starlock", - "appid": "__UNI__933D519", - "description": "", - "versionName": "1.3.0", - "versionCode": "37", - "mp-weixin": { - "appid": "wx9829a39e65550757", - "setting": { - "urlCheck": true, - "minified": true - }, - "permission": { - "scope.bluetooth": { - "desc": "蓝牙将用于控制和管理您的智能门锁" - } - }, - "requiredPrivateInfos": [ - "getLocation" - ], - "usingComponents": true, - "lazyCodeLoading": "requiredComponents", - "optimization": { - "subPackages": true - }, - "plugins": { - "xp2p": { - "version": "latest", - "provider": "wx1319af22356934bf", - "export": "exportForXp2pPlugin.js" - }, - "wmpf-voip": { - "version": "latest", - "provider": "wxf830863afde621eb", - "genericsImplementation": { - "call-page-plugin": { - "custombox": "pages/main/customBox" - } + "name" : "wx-starlock", + "appid" : "__UNI__933D519", + "description" : "", + "versionName" : "1.3.0", + "versionCode" : "37", + "mp-weixin" : { + "appid" : "wx9829a39e65550757", + "setting" : { + "urlCheck" : true, + "minified" : true + }, + "permission" : { + "scope.bluetooth" : { + "desc" : "蓝牙将用于控制和管理您的智能门锁" + } + }, + "requiredPrivateInfos" : [ "getLocation" ], + "usingComponents" : true, + "lazyCodeLoading" : "requiredComponents", + "optimization" : { + "subPackages" : true + }, + "plugins" : { + "xp2p" : { + "version" : "latest", + "provider" : "wx1319af22356934bf", + "export" : "exportForXp2pPlugin.js" + }, + "wmpf-voip" : { + "version" : "latest", + "provider" : "wxf830863afde621eb", + "genericsImplementation" : { + "call-page-plugin" : { + "custombox" : "pages/main/customBox" + } + } + } } - } - } - }, - "vueVersion": "3" + }, + "vueVersion" : "3" } diff --git a/pages/feature/recordList.vue b/pages/feature/recordList.vue index 5bc9a95..4722fa7 100644 --- a/pages/feature/recordList.vue +++ b/pages/feature/recordList.vue @@ -39,7 +39,7 @@ diff --git a/stores/bluetooth.js b/stores/bluetooth.js index bd58cac..098dbb7 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -1346,8 +1346,24 @@ export const useBluetoothStore = defineStore('ble', { } }) - if (code === 0 && data.outputParams) { - that.parsingCharacteristicValue(that.hexToArray(data.outputParams)) + if (code === 0) { + if (data.status === '') { + that.parsingCharacteristicValue(that.hexToArray(data.outputParams.result)) + } else { + let code = -10 + if (data.status === 'FailedOperation.ActionUnreachable') { + code = -11 + } + + uni.showToast({ + title: `设备状态异常,${code}`, + icon: 'none' + }) + characteristicValueCallback({ + code: -10, + message: '设备状态异常' + }) + } } else { characteristicValueCallback({ code, From 8c19ae5a2e9f15df8af9f4c40be6e4893b04a06a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Wed, 28 May 2025 15:15:14 +0800 Subject: [PATCH 5/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E4=B8=8B=E5=8F=91=E6=97=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/main/lockDetail.vue | 16 ++++---- stores/bluetooth.js | 78 +++++++++++++++++++++------------------ 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/pages/main/lockDetail.vue b/pages/main/lockDetail.vue index 71ec3d1..5053c44 100644 --- a/pages/main/lockDetail.vue +++ b/pages/main/lockDetail.vue @@ -362,14 +362,6 @@ openTime: parseInt(new Date().getTime() / 1000, 10) + time.value, onlineToken: onlineToken.value }) - $bluetooth - .syncRecord({ - keyId: $bluetooth.currentLockInfo.keyId.toString(), - uid: $user.userInfo.uid.toString() - }) - .then(() => { - $bluetooth.closeBluetoothConnection() - }) if (type === 'open') { uni.reportEvent('open_door', { result: code, @@ -382,6 +374,14 @@ }) } if (code === 0) { + $bluetooth + .syncRecord({ + keyId: $bluetooth.currentLockInfo.keyId.toString(), + uid: $user.userInfo.uid.toString() + }) + .then(() => { + $bluetooth.closeBluetoothConnection() + }) show.value = true typeValue.value = type setTimeout(() => { diff --git a/stores/bluetooth.js b/stores/bluetooth.js index 098dbb7..4484d7a 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -1052,15 +1052,17 @@ export const useBluetoothStore = defineStore('ble', { // 断开蓝牙连接 closeBluetoothConnection() { const that = this - uni.closeBLEConnection({ - deviceId: that.currentLockInfo.deviceId, - success(res) { - console.log('断开连接成功', res) - }, - fail(res) { - console.log('断开连接失败', res) - } - }) + if (that.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN) { + uni.closeBLEConnection({ + deviceId: that.currentLockInfo.deviceId, + success(res) { + console.log('断开连接成功', res) + }, + fail(res) { + console.log('断开连接失败', res) + } + }) + } }, // 周数组转换 convertWeekdaysToNumber(weekDay) { @@ -1347,21 +1349,25 @@ export const useBluetoothStore = defineStore('ble', { }) if (code === 0) { - if (data.status === '') { - that.parsingCharacteristicValue(that.hexToArray(data.outputParams.result)) - } else { - let code = -10 - if (data.status === 'FailedOperation.ActionUnreachable') { - code = -11 + if (data.Status === 'action execute success!') { + if (data.OutputParams.result === '') { + characteristicValueCallback({ + code: 0, + message: `成功,${data.Status}` + }) + } else { + const params = that.hexToArray(data.OutputParams.result) + console.log('转换后的数据', params) + that.parsingCharacteristicValue(params) } - + } else { uni.showToast({ - title: `设备状态异常,${code}`, + title: `命令下发失败,${data.Status}`, icon: 'none' }) characteristicValueCallback({ code: -10, - message: '设备状态异常' + message: `命令下发失败,${data.Status}` }) } } else { @@ -1508,7 +1514,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, contentArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult() }, // 获取私钥 @@ -1580,7 +1586,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult() }, // md5加密 @@ -1658,7 +1664,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.getLockStatus, data) }, @@ -1716,7 +1722,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.getLockStatusInfo, data) }, @@ -1769,7 +1775,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.getWifiList, data) }, @@ -1829,12 +1835,12 @@ export const useBluetoothStore = defineStore('ble', { const cebArray = sm4.encrypt(contentArray, this.currentLockInfo.commKey, { mode: 'ecb', output: 'array', - padding: 'none' + padding: length % 16 === 0 ? 'none' : 'pkcs#5' }) const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.distributionNetwork, data) }, @@ -1971,7 +1977,7 @@ export const useBluetoothStore = defineStore('ble', { }) const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray, false) + this.transportMessage(packageArray, false) return this.getResult(this.addLockUser, data) }, // 添加用户 @@ -2087,7 +2093,7 @@ export const useBluetoothStore = defineStore('ble', { }) const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray, false) + this.transportMessage(packageArray, false) return this.getResult(this.bindLock, data) }, // 获取写入结果 @@ -2576,7 +2582,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.cleanLockUser, data) }, @@ -2657,7 +2663,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.resetDevice, data) }, @@ -2746,7 +2752,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.resetLockPassword, data) }, @@ -2851,7 +2857,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.setLockPassword, data) }, @@ -3004,7 +3010,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.registerAuthentication, data) }, @@ -3061,7 +3067,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.registerAuthenticationCancel, data) }, @@ -3188,7 +3194,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.syncSingleRecord, data) }, @@ -3290,7 +3296,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.updateAdminPassword, data) }, @@ -3397,7 +3403,7 @@ export const useBluetoothStore = defineStore('ble', { const packageArray = this.createPackageEnd(headArray, cebArray) - await this.transportMessage(packageArray) + this.transportMessage(packageArray) return this.getResult(this.updateSetting, data) }, From 6f9fb8b2df2be665718cecf25d56860ea897558e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Thu, 29 May 2025 14:21:39 +0800 Subject: [PATCH 6/8] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E4=BA=91?= =?UTF-8?q?=E5=AD=98=E7=9A=84UI=E5=8F=8A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 57 ++++++- package.json | 4 + pages.json | 17 +- pages/main/lockDetail.vue | 2 +- pages/p2p/VideoList.vue | 219 ------------------------ pages/p2p/videoEdit.vue | 145 ---------------- pages/p2p/videoLog.vue | 346 ++++++++++++++++++++++++++++++++++---- unocss.config.js | 10 +- 8 files changed, 386 insertions(+), 414 deletions(-) delete mode 100644 pages/p2p/VideoList.vue delete mode 100644 pages/p2p/videoEdit.vue diff --git a/package-lock.json b/package-lock.json index 32037f5..3e19e4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,10 @@ "devDependencies": { "@commitlint/cli": "^19.7.1", "@commitlint/config-conventional": "^19.7.1", + "@iconify-json/material-symbols": "^1.2.22", + "@iconify-json/solar": "^1.2.2", + "@iconify/utils": "^2.3.0", + "@unocss/preset-icons": "^66.1.2", "commitizen": "^4.3.1", "crc": "^4.3.2", "cz-git": "^1.11.0", @@ -1049,6 +1053,26 @@ "dev": true, "license": "BSD-3-Clause" }, + "node_modules/@iconify-json/material-symbols": { + "version": "1.2.22", + "resolved": "https://registry.npmjs.org/@iconify-json/material-symbols/-/material-symbols-1.2.22.tgz", + "integrity": "sha512-raleOIRt8iPtwAkDzmw/c5zb06nIaicsYs5bZ3yfRjBxuYT/UYNa2ZFQQMl3uuTTiZuUXwFa1M8PJW3CFRAN0w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@iconify/types": "*" + } + }, + "node_modules/@iconify-json/solar": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@iconify-json/solar/-/solar-1.2.2.tgz", + "integrity": "sha512-lcTb6DWL4HZObiY1W3fHfuxxuQHUc6CFHFeywKEx7Ry0k+dU6POZCMC7oVLr0F8vuf+KgaQ3oOoGO/yFzOwrNg==", + "dev": true, + "license": "CC-BY-4.0", + "dependencies": { + "@iconify/types": "*" + } + }, "node_modules/@iconify/types": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz", @@ -1771,20 +1795,30 @@ } }, "node_modules/@unocss/preset-icons": { - "version": "65.5.0", - "resolved": "https://registry.npmjs.org/@unocss/preset-icons/-/preset-icons-65.5.0.tgz", - "integrity": "sha512-lSwMNtj4nufpQDBFoioAM9S6hP8028lA9fLFM3Vw+KmI10/3TaZyOaCXJVH5UdsfNWexGGo/Qo+K1YFWfXLZ8A==", + "version": "66.1.2", + "resolved": "https://registry.npmjs.org/@unocss/preset-icons/-/preset-icons-66.1.2.tgz", + "integrity": "sha512-14390jFBJ2anuKvjX9TeRCm7adNjR/mey0bh0+S/k/5W3VugIY2y0E+OH3m+sx5d/5ZUYbYkUGsmtuKbVNwwxQ==", "dev": true, "license": "MIT", "dependencies": { "@iconify/utils": "^2.3.0", - "@unocss/core": "65.5.0", + "@unocss/core": "66.1.2", "ofetch": "^1.4.1" }, "funding": { "url": "https://github.com/sponsors/antfu" } }, + "node_modules/@unocss/preset-icons/node_modules/@unocss/core": { + "version": "66.1.2", + "resolved": "https://registry.npmjs.org/@unocss/core/-/core-66.1.2.tgz", + "integrity": "sha512-mN9h1hHEuhDcdbI4z74o7UnxlBZYVsJpYcdC1YLWBKROcLYTkuyZ7hgBzpo1FBNox2Bt3JnrSinVDmc44Bxjow==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/@unocss/preset-mini": { "version": "65.5.0", "resolved": "https://registry.npmjs.org/@unocss/preset-mini/-/preset-mini-65.5.0.tgz", @@ -9402,6 +9436,21 @@ "unplugin-transform-class": "^0.5.3" } }, + "node_modules/unocss/node_modules/@unocss/preset-icons": { + "version": "65.5.0", + "resolved": "https://registry.npmjs.org/@unocss/preset-icons/-/preset-icons-65.5.0.tgz", + "integrity": "sha512-lSwMNtj4nufpQDBFoioAM9S6hP8028lA9fLFM3Vw+KmI10/3TaZyOaCXJVH5UdsfNWexGGo/Qo+K1YFWfXLZ8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@iconify/utils": "^2.3.0", + "@unocss/core": "65.5.0", + "ofetch": "^1.4.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/unplugin": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.16.1.tgz", diff --git a/package.json b/package.json index 5a12c60..f7c9d92 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,10 @@ "devDependencies": { "@commitlint/cli": "^19.7.1", "@commitlint/config-conventional": "^19.7.1", + "@iconify-json/material-symbols": "^1.2.22", + "@iconify-json/solar": "^1.2.2", + "@iconify/utils": "^2.3.0", + "@unocss/preset-icons": "^66.1.2", "commitizen": "^4.3.1", "crc": "^4.3.2", "cz-git": "^1.11.0", diff --git a/pages.json b/pages.json index ac6329f..81ff30f 100644 --- a/pages.json +++ b/pages.json @@ -32,22 +32,11 @@ "disableScroll": true } }, - { - "path": "videoDetail", - "style": { - "navigationBarTitleText": "视频播放" - } - }, { "path": "videoLog", "style": { - "navigationBarTitleText": "云存" - } - }, - { - "path": "videoEdit", - "style": { - "navigationBarTitleText": "视频编辑" + "navigationBarTitleText": "门锁记录", + "disableScroll": true } } ], @@ -656,4 +645,4 @@ } ] } -} \ No newline at end of file +} diff --git a/pages/main/lockDetail.vue b/pages/main/lockDetail.vue index 5053c44..0b72e2e 100644 --- a/pages/main/lockDetail.vue +++ b/pages/main/lockDetail.vue @@ -214,7 +214,7 @@ class="menu-main-image" src="https://oss-lock.xhjcn.ltd/mp/icon_record.png" > - 视频日志 + 门锁记录 - - - - 暂无数据 - - - - {{ item.date }} - - - - - - - - - - - - {{ timeFormat(video.operateDate, 'yyyy-mm-dd hh:MM') }} - - - - - - - - - - diff --git a/pages/p2p/videoEdit.vue b/pages/p2p/videoEdit.vue deleted file mode 100644 index 3c255eb..0000000 --- a/pages/p2p/videoEdit.vue +++ /dev/null @@ -1,145 +0,0 @@ - - - diff --git a/pages/p2p/videoLog.vue b/pages/p2p/videoLog.vue index 578a84d..c1dd402 100644 --- a/pages/p2p/videoLog.vue +++ b/pages/p2p/videoLog.vue @@ -1,51 +1,337 @@ diff --git a/unocss.config.js b/unocss.config.js index 7528dde..e4ab282 100644 --- a/unocss.config.js +++ b/unocss.config.js @@ -1,5 +1,6 @@ import presetWeapp from 'unocss-preset-weapp' import { extractorAttributify, transformerClass } from 'unocss-preset-weapp/transformer' +import presetIcons from '@unocss/preset-icons' const { presetWeappAttributify, transformerAttributify } = extractorAttributify() @@ -8,7 +9,14 @@ export default { // https://github.com/MellowCo/unocss-preset-weapp presetWeapp(), // attributify autocomplete - presetWeappAttributify() + presetWeappAttributify(), + presetIcons({ + collections: { + solar: () => import('@iconify-json/solar/icons.json').then(i => i.default), + 'material-symbols': () => + import('@iconify-json/material-symbols/icons.json').then(i => i.default) + } + }) ], shortcuts: [ { From adae5c917afe350293f37d87403eb9aa91bebb76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Thu, 29 May 2025 17:47:25 +0800 Subject: [PATCH 7/8] =?UTF-8?q?feat:=20=E5=9C=A8=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=BB=84=E4=BB=B6=E4=B8=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6=E4=BB=A5=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E5=88=B0=E7=BD=91=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/p2p/videoLog.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pages/p2p/videoLog.vue b/pages/p2p/videoLog.vue index c1dd402..9bec776 100644 --- a/pages/p2p/videoLog.vue +++ b/pages/p2p/videoLog.vue @@ -1,7 +1,7 @@