1. 完成电机功率设置
2. 完成开门方向设置
This commit is contained in:
parent
cbf048787e
commit
a5b2018949
14
pages.json
14
pages.json
@ -400,6 +400,20 @@
|
|||||||
"navigationBarTitleText": "上传数据",
|
"navigationBarTitleText": "上传数据",
|
||||||
"disableScroll": true
|
"disableScroll": true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/openDirection/openDirection",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "开门方向设置",
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/motorTorsion/motorTorsion",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "电机功率设置",
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
125
pages/motorTorsion/motorTorsion.vue
Normal file
125
pages/motorTorsion/motorTorsion.vue
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="mx-4 pt-5 text-base">
|
||||||
|
<view class="font-bold">请根据门锁实际情况,请谨慎选择电机功率:</view>
|
||||||
|
<view class="mt-8">
|
||||||
|
<view
|
||||||
|
@click="updateValue(1)"
|
||||||
|
class="px-2 py-4 my-4 flex items-center rounded-2xl"
|
||||||
|
:class="[value === 1 ? 'bg-#d9e8fd' : 'bg-#ececec']"
|
||||||
|
>
|
||||||
|
<view class="w-80 h-full flex items-center justify-center">
|
||||||
|
<up-icon name="checkbox-mark" color="#2a85ec" v-if="value === 1" size="40"></up-icon>
|
||||||
|
</view>
|
||||||
|
<view class="flex-1">
|
||||||
|
<view>小功率:</view>
|
||||||
|
<view class="text-#737373 text-sm">耗电少</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
@click="updateValue(2)"
|
||||||
|
class="px-2 py-4 my-4 flex items-center rounded-2xl"
|
||||||
|
:class="[value === 2 ? 'bg-#d9e8fd' : 'bg-#ececec']"
|
||||||
|
>
|
||||||
|
<view class="w-80 h-full flex items-center justify-center">
|
||||||
|
<up-icon name="checkbox-mark" color="#2a85ec" v-if="value === 2" size="40"></up-icon>
|
||||||
|
</view>
|
||||||
|
<view class="flex-1">
|
||||||
|
<view>中功率:</view>
|
||||||
|
<view class="text-#737373 text-sm">常规使用</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
@click="updateValue(3)"
|
||||||
|
class="px-2 py-4 my-4 flex items-center rounded-2xl"
|
||||||
|
:class="[value === 3 ? 'bg-#d9e8fd' : 'bg-#ececec']"
|
||||||
|
>
|
||||||
|
<view class="w-80 h-full flex items-center justify-center">
|
||||||
|
<up-icon name="checkbox-mark" color="#2a85ec" v-if="value === 3" size="40"></up-icon>
|
||||||
|
</view>
|
||||||
|
<view class="flex-1">
|
||||||
|
<view>大功率:</view>
|
||||||
|
<view class="text-#737373 text-sm">
|
||||||
|
如果开锁时锁舌不能正常回收,或需要带动天地钩,建议选择大功率。此时耗电将会增加。
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { updateLockSettingRequest } from '@/api/setting'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
|
||||||
|
const $bluetooth = useBluetoothStore()
|
||||||
|
const $user = useUserStore()
|
||||||
|
|
||||||
|
const value = ref(0)
|
||||||
|
|
||||||
|
const pending = ref(false)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
value.value = $bluetooth.currentLockSetting.lockSettingInfo.motorTorsion
|
||||||
|
})
|
||||||
|
|
||||||
|
const updateValue = async val => {
|
||||||
|
if (pending.value || value.value === val) return
|
||||||
|
pending.value = true
|
||||||
|
uni.showLoading({
|
||||||
|
title: '更新中'
|
||||||
|
})
|
||||||
|
const featureBit = 58
|
||||||
|
const { code } = await $bluetooth.updateSetting({
|
||||||
|
keyId: $bluetooth.keyId.toString(),
|
||||||
|
uid: $user.userInfo.uid.toString(),
|
||||||
|
featureBit,
|
||||||
|
params: [val],
|
||||||
|
withParams: true
|
||||||
|
})
|
||||||
|
$bluetooth.closeBluetoothConnection()
|
||||||
|
if (code === 0) {
|
||||||
|
const { code, message } = await updateLockSettingRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
motorTorsion: val
|
||||||
|
})
|
||||||
|
pending.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
if (code === 0) {
|
||||||
|
value.value = val
|
||||||
|
$bluetooth.updateCurrentLockSetting({
|
||||||
|
...$bluetooth.currentLockSetting,
|
||||||
|
lockSettingInfo: {
|
||||||
|
...$bluetooth.currentLockSetting.lockSettingInfo,
|
||||||
|
motorTorsion: value.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pending.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新失败,请保持在锁附近',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
120
pages/openDirection/openDirection.vue
Normal file
120
pages/openDirection/openDirection.vue
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="mx-4 pt-5 text-base">
|
||||||
|
<view class="font-bold">请谨慎选择您家的开门方向(如果选择错误,将无法正常开关门):</view>
|
||||||
|
<image src="/static/images/icon_open_direction.png" mode="widthFix" class="w-full"></image>
|
||||||
|
<view class="flex items-center justify-between mx-10 mt-8">
|
||||||
|
<view @click="updateValue(1)" class="flex items-center">
|
||||||
|
<image
|
||||||
|
class="w-40 h-40"
|
||||||
|
v-if="value === 1"
|
||||||
|
src="/static/images/icon_select.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
class="w-40 h-40"
|
||||||
|
v-else
|
||||||
|
src="/static/images/icon_not_select.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
<view class="ml-2">左开</view>
|
||||||
|
</view>
|
||||||
|
<view @click="updateValue(2)" class="flex items-center">
|
||||||
|
<image
|
||||||
|
v-if="value === 2"
|
||||||
|
class="w-40 h-40"
|
||||||
|
src="/static/images/icon_select.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
class="w-40 h-40"
|
||||||
|
v-else
|
||||||
|
src="/static/images/icon_not_select.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
<view class="ml-2">右开</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="mt-10"><text class="font-bold">判断方法:</text>人站在屋外,面向入户门。</view>
|
||||||
|
<view>如果门的合页或门轴在左边,则门是左开;</view>
|
||||||
|
<view>如果门的合页或门轴在右边,则门是右开。</view>
|
||||||
|
<view>如果设置错误,将无法正常开关门。</view>
|
||||||
|
<view>建议由安装或维修人员操作。</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { updateLockSettingRequest } from '@/api/setting'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
|
||||||
|
const $bluetooth = useBluetoothStore()
|
||||||
|
const $user = useUserStore()
|
||||||
|
|
||||||
|
const value = ref(0)
|
||||||
|
|
||||||
|
const pending = ref(false)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
value.value = $bluetooth.currentLockSetting.lockSettingInfo.openDirection
|
||||||
|
})
|
||||||
|
|
||||||
|
const updateValue = async val => {
|
||||||
|
if (pending.value || value.value === val) return
|
||||||
|
pending.value = true
|
||||||
|
uni.showLoading({
|
||||||
|
title: '更新中'
|
||||||
|
})
|
||||||
|
const featureBit = 41
|
||||||
|
const { code } = await $bluetooth.updateSetting({
|
||||||
|
keyId: $bluetooth.keyId.toString(),
|
||||||
|
uid: $user.userInfo.uid.toString(),
|
||||||
|
featureBit,
|
||||||
|
params: [val],
|
||||||
|
withParams: true
|
||||||
|
})
|
||||||
|
$bluetooth.closeBluetoothConnection()
|
||||||
|
if (code === 0) {
|
||||||
|
const { code, message } = await updateLockSettingRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
openDirectionValue: val
|
||||||
|
})
|
||||||
|
pending.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
if (code === 0) {
|
||||||
|
value.value = val
|
||||||
|
$bluetooth.updateCurrentLockSetting({
|
||||||
|
...$bluetooth.currentLockSetting,
|
||||||
|
lockSettingInfo: {
|
||||||
|
...$bluetooth.currentLockSetting.lockSettingInfo,
|
||||||
|
openDirectionValue: value.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pending.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新失败,请保持在锁附近',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -116,6 +116,28 @@
|
|||||||
<!-- <view class="item-title">消息提醒</view>-->
|
<!-- <view class="item-title">消息提醒</view>-->
|
||||||
<!-- <view><up-icon name="arrow-right"></up-icon></view>-->
|
<!-- <view><up-icon name="arrow-right"></up-icon></view>-->
|
||||||
<!-- </view>-->
|
<!-- </view>-->
|
||||||
|
<view
|
||||||
|
v-if="
|
||||||
|
$bluetooth.currentLockSetting.lockFeature.openDirection === 1 &&
|
||||||
|
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
|
||||||
|
"
|
||||||
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
|
||||||
|
@click="toJump('openDirection')"
|
||||||
|
>
|
||||||
|
<view class="item-title">开门方向设置</view>
|
||||||
|
<view><up-icon name="arrow-right"></up-icon></view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="
|
||||||
|
$bluetooth.currentLockSetting.lockFeature.motorTorsion === 1 &&
|
||||||
|
$bluetooth.currentLockSetting.lockBasicInfo.keyRight === 1
|
||||||
|
"
|
||||||
|
class="py-3 px-4 bg-white flex items-center justify-between text-base mt-4rpx"
|
||||||
|
@click="toJump('motorTorsion')"
|
||||||
|
>
|
||||||
|
<view class="item-title">电机功率设置</view>
|
||||||
|
<view><up-icon name="arrow-right"></up-icon></view>
|
||||||
|
</view>
|
||||||
<view class="mt-2.5"></view>
|
<view class="mt-2.5"></view>
|
||||||
<view
|
<view
|
||||||
class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base"
|
class="py-3 px-4 bg-white !py-2 flex items-center justify-between text-base"
|
||||||
|
|||||||
BIN
static/images/icon_not_select.png
Normal file
BIN
static/images/icon_not_select.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
static/images/icon_open_direction.png
Executable file
BIN
static/images/icon_open_direction.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
BIN
static/images/icon_select.png
Normal file
BIN
static/images/icon_select.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
@ -296,6 +296,16 @@ const pages = [
|
|||||||
name: 'uploadLockData',
|
name: 'uploadLockData',
|
||||||
path: '/pages/uploadLockData/uploadLockData',
|
path: '/pages/uploadLockData/uploadLockData',
|
||||||
tabBar: false
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'openDirection',
|
||||||
|
path: '/pages/openDirection/openDirection',
|
||||||
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'motorTorsion',
|
||||||
|
path: '/pages/motorTorsion/motorTorsion',
|
||||||
|
tabBar: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user