feat: 适配腾讯云锁
This commit is contained in:
parent
ea2000af96
commit
a73c550bbb
@ -78,7 +78,10 @@
|
||||
</view>
|
||||
<view class="menu-main">
|
||||
<view
|
||||
v-if="$bluetooth.currentLockInfo.keyRight === 1"
|
||||
v-if="
|
||||
$bluetooth.currentLockInfo.keyRight === 1 &&
|
||||
$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
||||
"
|
||||
class="menu-main-view"
|
||||
@click="$basic.routeJump({ name: 'keyList' })"
|
||||
>
|
||||
@ -91,7 +94,8 @@
|
||||
<view
|
||||
v-if="
|
||||
$bluetooth.currentLockInfo.lockFeature.password &&
|
||||
$bluetooth.currentLockInfo.keyRight === 1
|
||||
$bluetooth.currentLockInfo.keyRight === 1 &&
|
||||
$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
||||
"
|
||||
class="menu-main-view"
|
||||
@click="$basic.routeJump({ name: 'passwordList' })"
|
||||
@ -105,7 +109,8 @@
|
||||
<view
|
||||
v-if="
|
||||
$bluetooth.currentLockInfo.lockFeature.icCard &&
|
||||
$bluetooth.currentLockInfo.keyRight === 1
|
||||
$bluetooth.currentLockInfo.keyRight === 1 &&
|
||||
$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
||||
"
|
||||
class="menu-main-view"
|
||||
@click="$basic.routeJump({ name: 'cardList' })"
|
||||
@ -119,7 +124,8 @@
|
||||
<view
|
||||
v-if="
|
||||
$bluetooth.currentLockInfo.lockFeature.fingerprint &&
|
||||
$bluetooth.currentLockInfo.keyRight === 1
|
||||
$bluetooth.currentLockInfo.keyRight === 1 &&
|
||||
$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
||||
"
|
||||
class="menu-main-view"
|
||||
@click="$basic.routeJump({ name: 'fingerprintList' })"
|
||||
@ -133,7 +139,8 @@
|
||||
<view
|
||||
v-if="
|
||||
$bluetooth.currentLockInfo.lockFeature.bluetoothRemoteControl &&
|
||||
$bluetooth.currentLockInfo.keyRight === 1
|
||||
$bluetooth.currentLockInfo.keyRight === 1 &&
|
||||
$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
||||
"
|
||||
class="menu-main-view transform-scale-110"
|
||||
@click="$basic.routeJump({ name: 'remoteList' })"
|
||||
@ -147,7 +154,8 @@
|
||||
<view
|
||||
v-if="
|
||||
$bluetooth.currentLockInfo.lockFeature.d3Face &&
|
||||
$bluetooth.currentLockInfo.keyRight === 1
|
||||
$bluetooth.currentLockInfo.keyRight === 1 &&
|
||||
$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
||||
"
|
||||
class="menu-main-view"
|
||||
@click="$basic.routeJump({ name: 'faceList' })"
|
||||
@ -161,7 +169,8 @@
|
||||
<view
|
||||
v-if="
|
||||
$bluetooth.currentLockInfo.lockFeature.palmVein &&
|
||||
$bluetooth.currentLockInfo.keyRight === 1
|
||||
$bluetooth.currentLockInfo.keyRight === 1 &&
|
||||
$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
||||
"
|
||||
class="menu-main-view"
|
||||
@click="$basic.routeJump({ name: 'palmVeinList' })"
|
||||
@ -184,7 +193,10 @@
|
||||
<view>监控</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="$bluetooth.currentLockInfo.userType === 110301"
|
||||
v-if="
|
||||
$bluetooth.currentLockInfo.userType === 110301 &&
|
||||
$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
||||
"
|
||||
class="menu-main-view"
|
||||
@click="$basic.routeJump({ name: 'adminList' })"
|
||||
>
|
||||
@ -217,7 +229,10 @@
|
||||
<view>门锁记录</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="$bluetooth.currentLockInfo.keyRight === 1"
|
||||
v-if="
|
||||
$bluetooth.currentLockInfo.keyRight === 1 &&
|
||||
$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
||||
"
|
||||
class="menu-main-view"
|
||||
@click="$basic.routeJump({ name: 'messageReminder' })"
|
||||
>
|
||||
@ -240,7 +255,11 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="setting" @click="$basic.routeJump({ name: 'setting' })">
|
||||
<view
|
||||
class="setting"
|
||||
@click="$basic.routeJump({ name: 'setting' })"
|
||||
v-if="$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN"
|
||||
>
|
||||
<image class="setting-image" src="https://oss-lock.xhjcn.ltd/mp/icon_setting.png"></image>
|
||||
<view class="setting-text">设置</view>
|
||||
<image
|
||||
@ -249,6 +268,12 @@
|
||||
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
|
||||
></image>
|
||||
</view>
|
||||
<view
|
||||
v-if="$bluetooth.currentLockInfo.transportType === transportType.TRANSPORT_TENCENT_YUN"
|
||||
class="fixed bottom-[calc(env(safe-area-inset-bottom)+120rpx)] mt-4 rounded-3xl w-686 h-80 line-height-80rpx text-center mx-32rpx bg-#ec433c text-white text-xl font-bold"
|
||||
@click="deleteLock"
|
||||
>删除
|
||||
</view>
|
||||
</scroll-view>
|
||||
<up-popup
|
||||
:show="show"
|
||||
@ -284,7 +309,7 @@
|
||||
import SwitchLoading from '@/components/SwitchLoading/SwitchLoading.vue'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { getLockDetailRequest, getLockNetTokenRequest } from '@/api/lock'
|
||||
import { getLockDetailRequest, getLockNetTokenRequest, deleteLockRequest } from '@/api/lock'
|
||||
import { deleteKeyRequest } from '@/api/key'
|
||||
import { transportType } from '@/constant/transportType'
|
||||
|
||||
@ -497,6 +522,58 @@
|
||||
}
|
||||
refresherTriggered.value = false
|
||||
}
|
||||
|
||||
const deleteLock = async () => {
|
||||
const netWork = await $basic.getNetworkType()
|
||||
if (!netWork) {
|
||||
return
|
||||
}
|
||||
|
||||
const message = '删除锁后,所有信息都会一起删除,确定删除锁吗?'
|
||||
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: message,
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '删除中'
|
||||
})
|
||||
const { code: resetDeviceCode } = await $bluetooth.resetDevice({
|
||||
name: $bluetooth.currentLockInfo.name,
|
||||
authUid: $user.userInfo.uid.toString(),
|
||||
keyId: $bluetooth.keyId.toString()
|
||||
})
|
||||
if (resetDeviceCode === 0 || resetDeviceCode === -2) {
|
||||
const { code, message } = await deleteLockRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId
|
||||
})
|
||||
if (code === 0) {
|
||||
uni.hideLoading()
|
||||
$lock.updateLockSearch({
|
||||
...$lock.lockSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
$lock.getLockList($lock.lockSearch)
|
||||
$basic.backAndToast('删除成功', 1)
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else if (resetDeviceCode === -1) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '删除失败,请保持在锁附近',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@ -42,12 +42,6 @@
|
||||
<view v-if="requestFinish" class="mt-4 text-center text-base font-bold text-[#999]">
|
||||
微信会收到视频通话请求
|
||||
</view>
|
||||
<view
|
||||
class="fixed bottom-120rpx w-400rpx h-88rpx rounded-md leading-88rpx left-1/2 -translate-x-1/2 bg-[#63b8af] text-center text-base font-bold text-[#ffffff]"
|
||||
@click="getTicket"
|
||||
>
|
||||
获取ticket
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -106,41 +100,6 @@
|
||||
}
|
||||
})
|
||||
|
||||
const getTicket = async () => {
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
const result = await getInfo()
|
||||
uni.hideLoading()
|
||||
if (result.code === 0) {
|
||||
const ticket = result.data.WXIoTDeviceInfo.SNTicket
|
||||
uni.showModal({
|
||||
title: '票据',
|
||||
content: ticket,
|
||||
showCancel: false,
|
||||
confirmText: '复制',
|
||||
success: ({ confirm }) => {
|
||||
if (confirm) {
|
||||
uni.setClipboardData({
|
||||
data: ticket,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const getDeviceVoIPList = async () => {
|
||||
return new Promise(resolve => {
|
||||
wx.getDeviceVoIPList({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user