diff --git a/api/lock.js b/api/lock.js
index 9931b27..1be2222 100644
--- a/api/lock.js
+++ b/api/lock.js
@@ -19,3 +19,12 @@ export function bindLockAdmin(data) {
data
})
}
+
+// 获取手机联网token
+export function getLockNetTokenRequest(data) {
+ return request({
+ url: '/lock/getLockNetToken',
+ method: 'POST',
+ data
+ })
+}
diff --git a/components/SwitchLoading/SwitchLoading.vue b/components/SwitchLoading/SwitchLoading.vue
new file mode 100644
index 0000000..569f1cb
--- /dev/null
+++ b/components/SwitchLoading/SwitchLoading.vue
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/home/home.vue b/pages/home/home.vue
index 57f6010..261ca59 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -64,7 +64,6 @@
import { useBluetoothStore } from '@/stores/bluetooth'
import { useBasicStore } from '@/stores/basic'
import { mapState, mapActions } from 'pinia'
- import { getServerDatetime } from '@/api/check'
export default {
data() {
@@ -106,7 +105,8 @@
timeFormat,
...mapActions(useUserStore, ['updateUserInfo', 'updateLoginStatus', 'login']),
...mapActions(useLockStore, ['getLockList', 'getRole', 'getTimeLimit']),
- ...mapActions(useBluetoothStore, ['getBluetoothStatus', 'initAndListenBluetooth', 'updateCurrentLockInfo', 'checkSetting']),
+ ...mapActions(useBluetoothStore, ['getBluetoothStatus', 'initAndListenBluetooth', 'updateCurrentLockInfo',
+ 'checkSetting', 'updateKeyId']),
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']),
async nextPage() {
if(this.lockList.length < this.lockTotal) {
@@ -172,7 +172,16 @@
result = await this.initAndListenBluetooth()
}
if(result) {
- this.updateCurrentLockInfo(lock)
+ const data = {
+ ...lock,
+ name: lock.bluetooth.bluetoothDeviceName,
+ deviceId: lock.bluetooth.bluetoothDeviceId,
+ commKey: lock.bluetooth.privateKey,
+ signKey: lock.bluetooth.signKey,
+ publicKey: lock.bluetooth.publicKey,
+ }
+ this.updateKeyId(lock.keyId)
+ this.updateCurrentLockInfo(data)
this.routeJump({
name: 'lockDetail'
})
diff --git a/pages/lockDetail/lockDetail.vue b/pages/lockDetail/lockDetail.vue
index 608c2be..d7637d1 100644
--- a/pages/lockDetail/lockDetail.vue
+++ b/pages/lockDetail/lockDetail.vue
@@ -1,17 +1,327 @@
-
+
+
+
+
+
+ {{ currentLockInfo.electricQuantity }}%
+
+
+
+
+
+
+ 点击开锁,长按闭锁
+
+
+
+ {{ getRole(currentLockInfo.userType) }}
+
+
+
+ 手机需联网
+
+
+
+
+
+
+ 设置
+
+
-
diff --git a/static/images/background_main.jpg b/static/images/background_main.jpg
new file mode 100644
index 0000000..53c25b1
Binary files /dev/null and b/static/images/background_main.jpg differ
diff --git a/static/images/icon_cloud.png b/static/images/icon_cloud.png
new file mode 100644
index 0000000..e93fd9c
Binary files /dev/null and b/static/images/icon_cloud.png differ
diff --git a/static/images/icon_cloud_active.png b/static/images/icon_cloud_active.png
new file mode 100644
index 0000000..13f3d99
Binary files /dev/null and b/static/images/icon_cloud_active.png differ
diff --git a/static/images/icon_lock_transparent.png b/static/images/icon_lock_transparent.png
new file mode 100644
index 0000000..57bcb4e
Binary files /dev/null and b/static/images/icon_lock_transparent.png differ
diff --git a/static/images/icon_menu.png b/static/images/icon_menu.png
new file mode 100644
index 0000000..2311ee0
Binary files /dev/null and b/static/images/icon_menu.png differ
diff --git a/static/images/icon_role.png b/static/images/icon_role.png
new file mode 100644
index 0000000..33d916e
Binary files /dev/null and b/static/images/icon_role.png differ
diff --git a/static/images/icon_setting.png b/static/images/icon_setting.png
new file mode 100644
index 0000000..6834c06
Binary files /dev/null and b/static/images/icon_setting.png differ
diff --git a/static/images/icon_tips.png b/static/images/icon_tips.png
new file mode 100644
index 0000000..5dcd7a1
Binary files /dev/null and b/static/images/icon_tips.png differ
diff --git a/stores/bluetooth.js b/stores/bluetooth.js
index 2e67edf..8c9307b 100644
--- a/stores/bluetooth.js
+++ b/stores/bluetooth.js
@@ -67,6 +67,10 @@ export const useBluetoothStore = defineStore('ble', {
}
},
actions: {
+ // 更新keyId
+ updateKeyId(keyId) {
+ this.keyId = keyId
+ },
// 二进制转字符串
uint8ArrayToString(uint8Array) {
let str = ''
@@ -900,11 +904,12 @@ export const useBluetoothStore = defineStore('ble', {
conentArray.set(this.timestampToArray(openTime), 63)
- conentArray.set(this.currentLockInfo.token, 67)
+ conentArray.set(this.currentLockInfo.token || this.timestampToArray(openTime), 67)
conentArray[71] = 16
- const md5Array = this.md5Encrypte(name + uid, this.currentLockInfo.token, this.currentLockInfo.signKey)
+
+ const md5Array = this.md5Encrypte(name + uid, this.currentLockInfo.token || this.timestampToArray(openTime), this.currentLockInfo.signKey)
conentArray.set(md5Array, 72)
@@ -915,7 +920,6 @@ export const useBluetoothStore = defineStore('ble', {
const cebArray = sm4.encrypt(conentArray, this.currentLockInfo.commKey, { mode: 'ecb', output: 'array' })
const packageArray = this.createPackageEnd(headArray, cebArray)
-
await this.writeBLECharacteristicValue(packageArray)
return this.getWriteResult(this.openDoor, data)
diff --git a/stores/user.js b/stores/user.js
index e89fd61..16d047e 100644
--- a/stores/user.js
+++ b/stores/user.js
@@ -22,7 +22,7 @@ export const useUserStore = defineStore('user', {
this.isLogin = status
},
async login() {
- uni.setStorageSync('token', '3023|pZ1aoVlMKJBTBTGWlsZPpbLvxc8txcHbrJx2ljrf49c7efe0')
+ uni.setStorageSync('token', '3028|6WkZCHj5yzLlXW3z3ylc1TDhtKYvF3jHB6e4eTWr22681e3e')
const { code, data } = await getUserInfoRequest()
await useLockStore().getLockList({
pageNo: 1,