diff --git a/App.vue b/App.vue
index 18c5e7f..092e580 100644
--- a/App.vue
+++ b/App.vue
@@ -36,12 +36,15 @@
...mapState(useBluetoothStore, ['bluetoothStatus'])
},
async onLaunch() {
+ // #ifdef MP-WEIXIN
// 检查强制升级
this.updateMiniProgram()
- // 监听蓝牙开关状态
- this.onBluetoothState()
// 设置voip配置
this.setVoipConfig()
+ // #endif
+
+ // 监听蓝牙开关状态
+ this.onBluetoothState()
// 检查蓝牙权限
const checkResult = await this.checkSetting()
console.log(checkResult)
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/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..f1b7ea3 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,45 +1,42 @@
{
- "name": "wx-starlock",
- "appid": "__UNI__933D519",
- "description": "",
- "versionName": "1.2.0",
- "versionCode": "35",
- "mp-weixin": {
- "appid": "wx9829a39e65550757",
- "setting": {
- "urlCheck": true,
- "minified": true
- },
- "permission": {
- "scope.bluetooth": {
- "desc": "蓝牙将用于控制和管理您的智能门锁"
- },
- "scope.userLocation": {
- "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/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 6107d0d..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
}
}
],
@@ -82,13 +71,6 @@
"navigationBarTitleText": "附近设备"
}
},
- {
- "path": "selectAddress",
- "style": {
- "navigationBarTitleText": "锁地址",
- "disableScroll": true
- }
- },
{
"path": "distributionNetwork",
"style": {
@@ -611,13 +593,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": {
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 @@
-
-
- 地理位置
-
-
-
-
- 检查以确保以下地址是正确的
-
- {{ address }}
-
-
- 跳过
- 下一步
-
-
-
-
-
-
-
-
-
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/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..0b72e2e 100644
--- a/pages/main/lockDetail.vue
+++ b/pages/main/lockDetail.vue
@@ -172,7 +172,11 @@
>
掌静脉
-
+
授权管理员
@@ -201,6 +206,7 @@
操作记录
@@ -208,7 +214,7 @@
class="menu-main-image"
src="https://oss-lock.xhjcn.ltd/mp/icon_record.png"
>
- 视频日志
+ 门锁记录
{
- $bluetooth.closeBluetoothConnection()
- })
if (type === 'open') {
uni.reportEvent('open_door', {
result: code,
@@ -374,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/pages/p2p/VideoList.vue b/pages/p2p/VideoList.vue
deleted file mode 100644
index e352ded..0000000
--- a/pages/p2p/VideoList.vue
+++ /dev/null
@@ -1,219 +0,0 @@
-
-
-
-
- 暂无数据
-
-
-
- {{ 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 @@
-
-
-
- 已选{{ selectList.length }}项
- {{ isSelectAll ? '取消全选' : '全选' }}
-
-
-
-
-
-
-
-
-
- 下载
-
-
-
-
-
- 删除
-
-
-
-
-
-
-
-
diff --git a/pages/p2p/videoLog.vue b/pages/p2p/videoLog.vue
index 578a84d..4cff9e5 100644
--- a/pages/p2p/videoLog.vue
+++ b/pages/p2p/videoLog.vue
@@ -1,51 +1,423 @@
-
-
- 3天滚动储存
-
- {{ appName }}已为本设备免费提供3天滚动视频储存服务
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ info.desc }}
+
+
+
+
+
+
+ 暂无数据
+
+
+
+
+ {{ group.date }}
+
+
+
+
+
+
+
+ {{ item.event_type_name }}
+
+
+
+ {{ formatTime(item.event_time) }}
+
+
+ {{ item.text }}
+
+
+
+
+ {{ formatRemainingTime(item.video_expire_at) }}
+
+
+
+
+
+ {{ formatRemainingTime(item.video_expire_at) }}
+
+
+
+
+
+
+
- 去升级
-
-
-
-
- 全部视频
-
-
-
+
+
+
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 === '') {
diff --git a/stores/bluetooth.js b/stores/bluetooth.js
index 94b9334..4484d7a 100644
--- a/stores/bluetooth.js
+++ b/stores/bluetooth.js
@@ -898,6 +898,7 @@ export const useBluetoothStore = defineStore('ble', {
checkSetting() {
const that = this
return new Promise(resolve => {
+ // #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)
})
},
// 连接蓝牙设备+获取设备服务+获取设备特征值
@@ -1049,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) {
@@ -1343,8 +1348,28 @@ export const useBluetoothStore = defineStore('ble', {
}
})
- if (code === 0 && data.outputParams) {
- that.parsingCharacteristicValue(that.hexToArray(data.outputParams))
+ if (code === 0) {
+ 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: `命令下发失败,${data.Status}`,
+ icon: 'none'
+ })
+ characteristicValueCallback({
+ code: -10,
+ message: `命令下发失败,${data.Status}`
+ })
+ }
} else {
characteristicValueCallback({
code,
@@ -1489,7 +1514,7 @@ export const useBluetoothStore = defineStore('ble', {
const packageArray = this.createPackageEnd(headArray, contentArray)
- await this.transportMessage(packageArray)
+ this.transportMessage(packageArray)
return this.getResult()
},
// 获取私钥
@@ -1561,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加密
@@ -1639,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)
},
@@ -1697,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)
},
@@ -1750,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)
},
@@ -1810,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)
},
@@ -1952,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)
},
// 添加用户
@@ -2068,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)
},
// 获取写入结果
@@ -2557,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)
},
@@ -2638,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)
},
@@ -2727,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)
},
@@ -2832,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)
},
@@ -2985,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)
},
@@ -3042,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)
},
@@ -3169,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)
},
@@ -3271,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)
},
@@ -3378,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)
},
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: [
{