Merge branch 'fanpeng' into 'develop'
Fanpeng See merge request StarlockTeam/wx-starlock!16
39
api/card.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import request from '../utils/request'
|
||||||
|
|
||||||
|
// card 卡片模块
|
||||||
|
|
||||||
|
// 获取卡片列表
|
||||||
|
export function getCardList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/identityCard/list',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除卡片
|
||||||
|
export function deleteCardRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/identityCard/delete',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查卡片名称是否重复
|
||||||
|
export function checkCardNameRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/identityCard/checkIdentityCardName',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片
|
||||||
|
export function addCardRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/identityCard/add',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
39
api/fingerprint.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import request from '../utils/request'
|
||||||
|
|
||||||
|
// fingerprint 指纹模块
|
||||||
|
|
||||||
|
// 获取指纹列表
|
||||||
|
export function getFingerprintList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/fingerprint/list',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除指纹
|
||||||
|
export function deleteFingerprintRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/fingerprint/delete',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查指纹名称是否重复
|
||||||
|
export function checkFingerprintNameRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/fingerprint/checkFingerprintName',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加指纹
|
||||||
|
export function addFingerprintRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/fingerprint/add',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
48
components/LockSwitch/LockSwitch.vue
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<template>
|
||||||
|
<view class="bg-white">
|
||||||
|
<view class="name">
|
||||||
|
<view class="name-text">{{ title }}</view>
|
||||||
|
<switch :checked="checked" class="mr-4 transform-scale-90" @change="change" color="#002ce5" />
|
||||||
|
</view>
|
||||||
|
<view class="px-3 text-sm whitespace-pre-line pb-2" v-if="placeholder">{{ placeholder }}</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
|
||||||
|
const checked = ref(false)
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
title: String,
|
||||||
|
placeholder: String,
|
||||||
|
value: Boolean
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
checked.value = props.value
|
||||||
|
})
|
||||||
|
|
||||||
|
const change = e => {
|
||||||
|
console.log(111, e)
|
||||||
|
// this.$emit('changeInput', e.detail.value)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.name {
|
||||||
|
height: 100rpx;
|
||||||
|
width: 750rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #ffffff;
|
||||||
|
|
||||||
|
.name-text {
|
||||||
|
margin-left: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
1
main.js
@ -1,6 +1,7 @@
|
|||||||
import * as Pinia from 'pinia'
|
import * as Pinia from 'pinia'
|
||||||
import { createSSRApp } from 'vue'
|
import { createSSRApp } from 'vue'
|
||||||
import { createUnistorage } from 'pinia-plugin-unistorage'
|
import { createUnistorage } from 'pinia-plugin-unistorage'
|
||||||
|
import 'uno.css'
|
||||||
import uviewPlus, { setConfig } from 'uview-plus'
|
import uviewPlus, { setConfig } from 'uview-plus'
|
||||||
import App from './App'
|
import App from './App'
|
||||||
|
|
||||||
|
|||||||
2071
package-lock.json
generated
11
package.json
@ -5,11 +5,6 @@
|
|||||||
"pinia": "^2.2.0",
|
"pinia": "^2.2.0",
|
||||||
"pinia-plugin-unistorage": "^0.1.2",
|
"pinia-plugin-unistorage": "^0.1.2",
|
||||||
"sm-crypto": "^0.3.13",
|
"sm-crypto": "^0.3.13",
|
||||||
"star-cloud-uni": "file:../starCloud",
|
|
||||||
"stylelint": "^16.14.1",
|
|
||||||
"stylelint-config-recess-order": "^6.0.0",
|
|
||||||
"stylelint-config-recommended-scss": "^14.1.0",
|
|
||||||
"stylelint-config-standard": "^37.0.0",
|
|
||||||
"uview-plus": "^3.3.12"
|
"uview-plus": "^3.3.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -26,6 +21,12 @@
|
|||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^15.4.3",
|
"lint-staged": "^15.4.3",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
|
"stylelint": "^16.14.1",
|
||||||
|
"stylelint-config-recess-order": "^6.0.0",
|
||||||
|
"stylelint-config-recommended-scss": "^14.1.0",
|
||||||
|
"stylelint-config-standard": "^37.0.0",
|
||||||
|
"unocss": "^65.4.3",
|
||||||
|
"unocss-preset-weapp": "^65.4.1",
|
||||||
"vite-plugin-eslint": "^1.8.1"
|
"vite-plugin-eslint": "^1.8.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
56
pages.json
@ -141,6 +141,62 @@
|
|||||||
"navigationBarTitleText": "添加锁",
|
"navigationBarTitleText": "添加锁",
|
||||||
"disableScroll": true
|
"disableScroll": true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/cardList/cardList",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "卡",
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/createCard/createCard",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "添加卡",
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/bindCard/bindCard",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "添加卡",
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/cardDetail/cardDetail",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "卡详情",
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/fingerprintList/fingerprintList",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "指纹",
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/createFingerprint/createFingerprint",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "添加指纹",
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/fingerprintDetail/fingerprintDetail",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "指纹详情",
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/bindFingerprint/bindFingerprint",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "添加指纹",
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
92
pages/bindCard/bindCard.vue
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="flex justify-center flex-col pt-20">
|
||||||
|
<image
|
||||||
|
src="/static/images/icon_add_card.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
class="mx-[200rpx] w-350 h-350"
|
||||||
|
></image>
|
||||||
|
<view class="mt-5">
|
||||||
|
<up-loading-icon size="70rpx" text="" :vertical="true" textSize="32rpx"></up-loading-icon>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="text-base rounded-xl mt-15 bg-black mx-[75rpx] w-600 h-80 text-align-center line-height-[80rpx] text-white shadow-sm"
|
||||||
|
>{{ text }}</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onUnmounted, getCurrentInstance } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
import { useBasicStore } from '@/stores/basic'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { addCardRequest } from '@/api/card'
|
||||||
|
|
||||||
|
const instance = getCurrentInstance().proxy
|
||||||
|
const eventChannel = instance.getOpenerEventChannel()
|
||||||
|
|
||||||
|
const $bluetooth = useBluetoothStore()
|
||||||
|
const $basic = useBasicStore()
|
||||||
|
const $user = useUserStore()
|
||||||
|
|
||||||
|
const bindFlag = ref(false)
|
||||||
|
|
||||||
|
const text = ref('尝试连接设备…')
|
||||||
|
|
||||||
|
onLoad(async options => {
|
||||||
|
if (options.card) {
|
||||||
|
const params = JSON.parse(options.card)
|
||||||
|
const { code } = await $bluetooth.registerAuthentication(params)
|
||||||
|
|
||||||
|
if (code === 0) {
|
||||||
|
text.value = '已连接到锁,请将卡靠近锁的读卡区'
|
||||||
|
} else {
|
||||||
|
$basic.backAndToast('操作失败,请重试')
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.$on('registerCardConfirm', async data => {
|
||||||
|
if (data.status === 0) {
|
||||||
|
bindFlag.value = true
|
||||||
|
const { code, message } = await addCardRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
startDate: params.startDate,
|
||||||
|
endDate: params.endDate,
|
||||||
|
cardName: params.cardName,
|
||||||
|
cardNumber: String(data.cardNumber),
|
||||||
|
cardType: params.cardType,
|
||||||
|
addType: 1,
|
||||||
|
cardRight: params.isAdmin,
|
||||||
|
isCoerced: params.isForce === 1 ? 2 : 1
|
||||||
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
eventChannel.emit('refresherList', {})
|
||||||
|
$basic.backAndToast('绑卡成功', 2)
|
||||||
|
} else {
|
||||||
|
$basic.backAndToast(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(async () => {
|
||||||
|
uni.$off('registerCardConfirm')
|
||||||
|
if (!bindFlag.value) {
|
||||||
|
await $bluetooth.registerAuthenticationCancel({
|
||||||
|
type: 'card',
|
||||||
|
keyId: $bluetooth.keyId.toString(),
|
||||||
|
uid: $user.userInfo.uid.toString()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$bluetooth.closeBluetoothConnection()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
91
pages/bindFingerprint/bindFingerprint.vue
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="flex justify-center flex-col pt-10 text-align-center text-base">
|
||||||
|
<view>
|
||||||
|
{{ text }}
|
||||||
|
</view>
|
||||||
|
<view v-if="showProcess" class="mt-5 font-bold">({{ process }}/5)</view>
|
||||||
|
<image
|
||||||
|
:src="`/static/images/icon_fingerprint_${process}.png`"
|
||||||
|
mode="widthFix"
|
||||||
|
class="mx-[250rpx] w-250 mt-5"
|
||||||
|
></image>
|
||||||
|
<view class="mt-10">根据提示,抬起手指后再进行下一次指纹采集</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onUnmounted, getCurrentInstance } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
import { useBasicStore } from '@/stores/basic'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { addFingerprintRequest } from '@/api/fingerprint'
|
||||||
|
|
||||||
|
const instance = getCurrentInstance().proxy
|
||||||
|
const eventChannel = instance.getOpenerEventChannel()
|
||||||
|
|
||||||
|
const $bluetooth = useBluetoothStore()
|
||||||
|
const $basic = useBasicStore()
|
||||||
|
const $user = useUserStore()
|
||||||
|
|
||||||
|
const bindFlag = ref(false)
|
||||||
|
const showProcess = ref(false)
|
||||||
|
const process = ref(0)
|
||||||
|
|
||||||
|
const text = ref('尝试连接设备…')
|
||||||
|
|
||||||
|
onLoad(async options => {
|
||||||
|
if (options.info) {
|
||||||
|
const params = JSON.parse(options.info)
|
||||||
|
const { code } = await $bluetooth.registerAuthentication(params)
|
||||||
|
|
||||||
|
if (code === 0) {
|
||||||
|
text.value = '请将您的手指按下'
|
||||||
|
showProcess.value = true
|
||||||
|
} else {
|
||||||
|
$basic.backAndToast('操作失败,请重试')
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.$on('registerFingerprintConfirm', async data => {
|
||||||
|
if (data.status === 0) {
|
||||||
|
bindFlag.value = true
|
||||||
|
const { code, message } = await addFingerprintRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
startDate: params.startDate,
|
||||||
|
endDate: params.endDate,
|
||||||
|
fingerprintName: params.fingerprintName,
|
||||||
|
fingerprintNumber: String(data.fingerprintNumber),
|
||||||
|
fingerprintType: params.fingerprintType,
|
||||||
|
addType: 1,
|
||||||
|
fingerRight: params.isAdmin,
|
||||||
|
isCoerced: params.isForce === 1 ? 2 : 1
|
||||||
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
eventChannel.emit('refresherList', {})
|
||||||
|
$basic.backAndToast('添加成功', 2)
|
||||||
|
} else {
|
||||||
|
$basic.backAndToast(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
uni.$on('registerFingerprintProcess', data => {
|
||||||
|
if (data.status === 0) {
|
||||||
|
process.value = data.process
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
uni.$off('registerFingerprintConfirm')
|
||||||
|
if (!bindFlag.value) {
|
||||||
|
$bluetooth.registerAuthenticationCancel({
|
||||||
|
type: 'fingerprint',
|
||||||
|
keyId: $bluetooth.keyId.toString(),
|
||||||
|
uid: $user.userInfo.uid.toString()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
111
pages/cardDetail/cardDetail.vue
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view v-if="info">
|
||||||
|
<view class="item">
|
||||||
|
<view class="item-title">卡号</view>
|
||||||
|
<view class="item-content">{{ info.cardNumber }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 2rpx">
|
||||||
|
<view class="item-title">姓名</view>
|
||||||
|
<view class="item-content">{{ info.cardName }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 2rpx">
|
||||||
|
<view class="item-title">有效期</view>
|
||||||
|
<view v-if="info.cardType === 1">永久</view>
|
||||||
|
<view v-else-if="info.cardType === 2">
|
||||||
|
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd h:M') }}</view>
|
||||||
|
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd h:M') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
|
||||||
|
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 2rpx" v-if="info.cardType === 4">
|
||||||
|
<view class="item-title">有效日</view>
|
||||||
|
<view class="item-content">{{ $lock.convertWeekDaysToChineseString(info.weekDay) }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 2rpx" v-if="info.cardType === 4">
|
||||||
|
<view class="item-title">有效时间</view>
|
||||||
|
<view class="item-content">
|
||||||
|
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 20rpx">
|
||||||
|
<view class="item-title">添加者</view>
|
||||||
|
<view class="item-content">{{ info.senderUsername }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 2rpx">
|
||||||
|
<view class="item-title">添加时间</view>
|
||||||
|
<view class="item-content">{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="button" @click="deletePassword">删除</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { getCurrentInstance, ref } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { timeFormat } from 'uview-plus'
|
||||||
|
import { useLockStore } from '@/stores/lock'
|
||||||
|
|
||||||
|
const instance = getCurrentInstance().proxy
|
||||||
|
const eventChannel = instance.getOpenerEventChannel()
|
||||||
|
|
||||||
|
const $lock = useLockStore()
|
||||||
|
|
||||||
|
const info = ref(null)
|
||||||
|
|
||||||
|
onLoad(options => {
|
||||||
|
if (options.info) {
|
||||||
|
info.value = JSON.parse(options.info)
|
||||||
|
console.log(info.value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const deletePassword = async () => {
|
||||||
|
eventChannel.emit('delete', {})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.item-title {
|
||||||
|
width: 350rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 24rpx 32rpx;
|
||||||
|
background-color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
padding: 24rpx 32rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
margin: 32rpx;
|
||||||
|
width: 686rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
background-color: #df282d;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 88rpx;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
463
pages/cardList/cardList.vue
Normal file
@ -0,0 +1,463 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<scroll-view
|
||||||
|
v-if="deviceInfo"
|
||||||
|
scroll-y="true"
|
||||||
|
:style="{ height: deviceInfo.screenHeight - deviceInfo.safeArea.top + 'px' }"
|
||||||
|
lower-threshold="100"
|
||||||
|
@refresherrefresh="refresherList"
|
||||||
|
:refresher-enabled="true"
|
||||||
|
@scrolltolower="nextPage"
|
||||||
|
:refresher-triggered="refresherTriggered"
|
||||||
|
>
|
||||||
|
<view class="search">
|
||||||
|
<up-search
|
||||||
|
shape="square"
|
||||||
|
:searchIconSize="48"
|
||||||
|
:inputStyle="{ fontSize: '32rpx' }"
|
||||||
|
:height="80"
|
||||||
|
placeholder="搜索"
|
||||||
|
:clearabled="false"
|
||||||
|
@change="changeSearch"
|
||||||
|
v-model="searchStr"
|
||||||
|
bgColor="#ffffff"
|
||||||
|
:showAction="false"
|
||||||
|
maxlength="50"
|
||||||
|
></up-search>
|
||||||
|
</view>
|
||||||
|
<view style="padding: 0 0 calc(env(safe-area-inset-bottom) + 250rpx) 0">
|
||||||
|
<view v-if="list.length === 0 && requestFinished">
|
||||||
|
<image
|
||||||
|
class="empty-list"
|
||||||
|
src="/static/images/background_empty_list.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
<view class="empty-list-text">暂无数据</view>
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<up-swipe-action>
|
||||||
|
<up-swipe-action-item
|
||||||
|
ref="swipeItem"
|
||||||
|
:options="options"
|
||||||
|
v-for="item in list"
|
||||||
|
:key="item.keyboardPwdId"
|
||||||
|
:threshold="50"
|
||||||
|
@click="deleteItem(item)"
|
||||||
|
>
|
||||||
|
<view class="item" @click="toDetail(item)">
|
||||||
|
<image
|
||||||
|
class="item-left"
|
||||||
|
src="/static/images/icon_card_white.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
<view class="item-right">
|
||||||
|
<view style="display: flex; align-items: center">
|
||||||
|
<view class="item-right-top">{{ item.cardName }}</view>
|
||||||
|
<view class="status">
|
||||||
|
{{ item.statusText }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item-right-bottom">{{ item.timeText }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="line"></view>
|
||||||
|
</up-swipe-action-item>
|
||||||
|
</up-swipe-action>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="button">
|
||||||
|
<view class="button-reset" @click="reset">重置卡片</view>
|
||||||
|
<view class="button-create" @click="toCreate">添加卡片</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { timeFormat } from 'uview-plus'
|
||||||
|
import { useBasicStore } from '@/stores/basic'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
import { deleteCardRequest, getCardList } from '@/api/card'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
|
||||||
|
const $basic = useBasicStore()
|
||||||
|
const $bluetooth = useBluetoothStore()
|
||||||
|
const $user = useUserStore()
|
||||||
|
|
||||||
|
const swipeItem = ref(null)
|
||||||
|
|
||||||
|
const searchStr = ref('')
|
||||||
|
const list = ref([])
|
||||||
|
const pageNo = ref(1)
|
||||||
|
const pageSize = 50
|
||||||
|
const total = ref(0)
|
||||||
|
const lockId = ref(null)
|
||||||
|
|
||||||
|
const deviceInfo = ref(null)
|
||||||
|
const requestFinished = ref(false)
|
||||||
|
const refresherTriggered = ref(false)
|
||||||
|
const options = ref([
|
||||||
|
{
|
||||||
|
text: '删除',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#f56c6c'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
deviceInfo.value = await $basic.getDeviceInfo()
|
||||||
|
lockId.value = $bluetooth.currentLockInfo.lockId
|
||||||
|
const { code, message } = await getList({
|
||||||
|
pageNo: pageNo.value
|
||||||
|
})
|
||||||
|
requestFinished.value = true
|
||||||
|
uni.hideLoading()
|
||||||
|
if (code !== 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const reset = async () => {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '重置后,该锁的卡都将被删除哦,确认要重置吗?',
|
||||||
|
async success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
const netWork = await $basic.getNetworkType()
|
||||||
|
if (!netWork) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await deleteData({
|
||||||
|
operate: 3
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteData = async info => {
|
||||||
|
uni.showLoading({
|
||||||
|
title: `${info.operate === 2 ? '删除' : '重置'}中`
|
||||||
|
})
|
||||||
|
|
||||||
|
const { code } = await $bluetooth.registerAuthentication({
|
||||||
|
type: 'card',
|
||||||
|
keyId: $bluetooth.keyId.toString(),
|
||||||
|
uid: $user.userInfo.uid.toString(),
|
||||||
|
no: Number(info.cardNumber) || 0,
|
||||||
|
operate: info.operate,
|
||||||
|
isAdmin: 0,
|
||||||
|
isForce: 0,
|
||||||
|
userCountLimit: 0,
|
||||||
|
weekDays: [],
|
||||||
|
isRound: 0,
|
||||||
|
startDate: 0,
|
||||||
|
endDate: 0,
|
||||||
|
startTime: '00:00',
|
||||||
|
endTime: '00:00'
|
||||||
|
})
|
||||||
|
|
||||||
|
$bluetooth.closeBluetoothConnection()
|
||||||
|
if (code === 0) {
|
||||||
|
let params = {
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
deleteType: 1,
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
if (info.operate === 2) {
|
||||||
|
params = {
|
||||||
|
...params,
|
||||||
|
cardId: info.cardId,
|
||||||
|
type: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const { code: requestCode, message } = await deleteCardRequest(params)
|
||||||
|
if (requestCode === 0) {
|
||||||
|
if (info.back) {
|
||||||
|
$basic.backAndToast(`删除成功`)
|
||||||
|
}
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: `${info.operate === 2 ? '删除' : '重置'}成功`,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
pageNo.value = 1
|
||||||
|
await getList({
|
||||||
|
pageNo: pageNo.value
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (code === -1) {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: `${info.operate === 2 ? '删除' : '重置'}失败,请保持在锁附近`,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteItem = async data => {
|
||||||
|
const index = list.value.findIndex(item => item.keyboardPwdId === data.keyboardPwdId)
|
||||||
|
swipeItem.value[index].closeHandler()
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除吗?',
|
||||||
|
async success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
const netWork = await $basic.getNetworkType()
|
||||||
|
if (!netWork) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await deleteData({
|
||||||
|
...data,
|
||||||
|
operate: 2
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const refresherList = async () => {
|
||||||
|
refresherTriggered.value = true
|
||||||
|
pageNo.value = 1
|
||||||
|
const { code, message } = await getList({
|
||||||
|
pageNo: pageNo.value,
|
||||||
|
searchStr: searchStr.value
|
||||||
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '刷新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
refresherTriggered.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextPage = async () => {
|
||||||
|
if (total.value <= pageNo.value * pageSize) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const page = pageNo.value + 1
|
||||||
|
const params = {
|
||||||
|
searchStr: searchStr.value,
|
||||||
|
pageNo: page
|
||||||
|
}
|
||||||
|
const { code, message } = await getList(params)
|
||||||
|
if (code === 0) {
|
||||||
|
pageNo.value = page
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getList = async params => {
|
||||||
|
const {
|
||||||
|
data: { timestamp }
|
||||||
|
} = await $bluetooth.updateServerTimestamp()
|
||||||
|
const { code, data, message } = await getCardList({
|
||||||
|
...params,
|
||||||
|
lockId: lockId.value,
|
||||||
|
pageSize
|
||||||
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
total.value = data.total
|
||||||
|
for (let i = 0; i < data.list.length; i++) {
|
||||||
|
if (data.list[i].cardStatus === 1 && data.list[i].startDate > timestamp) {
|
||||||
|
data.list[i].statusText = '未生效'
|
||||||
|
} else if (data.list[i].cardStatus === 2) {
|
||||||
|
data.list[i].statusText = '已失效'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.list[i].cardType === 1) {
|
||||||
|
data.list[i].timeText = timeFormat(data.list[i].startDate, 'yyyy-mm-dd hh:MM') + ' 永久'
|
||||||
|
} else if (data.list[i].cardType === 2) {
|
||||||
|
data.list[i].timeText =
|
||||||
|
timeFormat(data.list[i].startDate, 'yyyy-mm-dd hh:MM') +
|
||||||
|
' - ' +
|
||||||
|
timeFormat(data.list[i].endDate, 'yyyy-mm-dd hh:MM') +
|
||||||
|
' 限时'
|
||||||
|
} else {
|
||||||
|
data.list[i].timeText =
|
||||||
|
timeFormat(data.list[i].startDate, 'yyyy-mm-dd') +
|
||||||
|
' - ' +
|
||||||
|
timeFormat(data.list[i].endDate, 'yyyy-mm-dd') +
|
||||||
|
' 循环'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (params.pageNo === 1) {
|
||||||
|
list.value = data.list
|
||||||
|
} else {
|
||||||
|
list.value = list.value.concat(data.list)
|
||||||
|
}
|
||||||
|
return { code }
|
||||||
|
}
|
||||||
|
return { code, message }
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeSearch = async data => {
|
||||||
|
pageNo.value = 1
|
||||||
|
const { code, message } = await getList({
|
||||||
|
searchStr: data,
|
||||||
|
pageNo: pageNo.value
|
||||||
|
})
|
||||||
|
if (code !== 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const toCreate = () => {
|
||||||
|
$basic.routeJump({
|
||||||
|
name: 'createCard',
|
||||||
|
events: {
|
||||||
|
refresherList() {
|
||||||
|
pageNo.value = 1
|
||||||
|
getList({
|
||||||
|
pageNo: pageNo.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const toDetail = item => {
|
||||||
|
$basic.routeJump({
|
||||||
|
name: 'cardDetail',
|
||||||
|
params: {
|
||||||
|
info: JSON.stringify(item)
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
delete() {
|
||||||
|
deleteItem({ ...item, back: true })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.search {
|
||||||
|
padding: 32rpx;
|
||||||
|
width: 686rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: fixed;
|
||||||
|
bottom: calc(env(safe-area-inset-bottom) + 20rpx);
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
.button-reset {
|
||||||
|
margin-left: 50rpx;
|
||||||
|
width: 300rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
background-color: #df282d;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 88rpx;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-create {
|
||||||
|
margin-left: 50rpx;
|
||||||
|
width: 300rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
background-color: #63b8af;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 88rpx;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #ffffff;
|
||||||
|
height: 120rpx;
|
||||||
|
width: 750rpx;
|
||||||
|
|
||||||
|
.item-left {
|
||||||
|
margin-left: 32rpx;
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-right {
|
||||||
|
margin-right: 32rpx;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
width: 574rpx;
|
||||||
|
|
||||||
|
.item-right-top {
|
||||||
|
max-width: 400rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-right-bottom {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
width: 100%;
|
||||||
|
height: 2rpx;
|
||||||
|
background: #ebebeb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-list {
|
||||||
|
width: 150rpx;
|
||||||
|
height: 150rpx;
|
||||||
|
margin: 300rpx auto 20rpx 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-list-text {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status {
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #df282d;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
337
pages/createCard/createCard.vue
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="tabs">
|
||||||
|
<up-tabs
|
||||||
|
:list="tabs"
|
||||||
|
lineWidth="40rpx"
|
||||||
|
lineHeight="5rpx"
|
||||||
|
:current="currentIndex"
|
||||||
|
lineColor="#63b8af"
|
||||||
|
@click="clickTab"
|
||||||
|
:inactiveStyle="{ color: '#a3a3a3', fontSize: '32rpx', fontWeight: 'bold' }"
|
||||||
|
:activeStyle="{ color: '#63b8af', fontSize: '32rpx', fontWeight: 'bold' }"
|
||||||
|
>
|
||||||
|
</up-tabs>
|
||||||
|
</view>
|
||||||
|
<swiper
|
||||||
|
:style="{ height: deviceInfo.screenHeight - deviceInfo.safeArea.top - 44 + 'px' }"
|
||||||
|
v-if="deviceInfo"
|
||||||
|
:list="tabs"
|
||||||
|
:autoplay="false"
|
||||||
|
:circular="true"
|
||||||
|
:current="currentIndex"
|
||||||
|
@change="changeSwiper"
|
||||||
|
>
|
||||||
|
<swiper-item>
|
||||||
|
<LockInput
|
||||||
|
:value="permanentName"
|
||||||
|
title="姓名"
|
||||||
|
placeholder="请输入"
|
||||||
|
@change-input="changeName('permanent', $event)"
|
||||||
|
></LockInput>
|
||||||
|
<view class="mt-3">
|
||||||
|
<LockSwitch
|
||||||
|
:value="permanentAdmin"
|
||||||
|
title="是否为管理员"
|
||||||
|
@change="changeAdmin('permanent', $event)"
|
||||||
|
></LockSwitch>
|
||||||
|
</view>
|
||||||
|
<view class="mt-3 mb-3">
|
||||||
|
<LockSwitch
|
||||||
|
:value="permanentCoerced"
|
||||||
|
title="胁迫卡"
|
||||||
|
@change="changeCoerced('permanent', $event)"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
></LockSwitch>
|
||||||
|
</view>
|
||||||
|
<view class="button" @click="create('permanent')">下一步</view>
|
||||||
|
</swiper-item>
|
||||||
|
<swiper-item :style="{ height: deviceInfo.windowHeight - 44 + 'px' }">
|
||||||
|
<LockInput
|
||||||
|
:value="temporaryName"
|
||||||
|
title="姓名"
|
||||||
|
placeholder="请输入"
|
||||||
|
@change-input="changeName('temporary', $event)"
|
||||||
|
></LockInput>
|
||||||
|
<view class="mt-3">
|
||||||
|
<LockDatetimePicker
|
||||||
|
title="生效时间"
|
||||||
|
:value="temporaryStartTime"
|
||||||
|
:minDate="minDate"
|
||||||
|
:maxDate="maxDate"
|
||||||
|
type="datehour"
|
||||||
|
@change-time="changeDate('temporaryStartTime', $event)"
|
||||||
|
></LockDatetimePicker>
|
||||||
|
</view>
|
||||||
|
<view class="mt-3">
|
||||||
|
<LockDatetimePicker
|
||||||
|
title="失效时间"
|
||||||
|
:value="temporaryEndTime"
|
||||||
|
:minDate="minDate"
|
||||||
|
:maxDate="maxDate"
|
||||||
|
type="datehour"
|
||||||
|
@change-time="changeDate('temporaryEndTime', $event)"
|
||||||
|
></LockDatetimePicker>
|
||||||
|
</view>
|
||||||
|
<view class="mt-3">
|
||||||
|
<LockSwitch
|
||||||
|
:value="temporaryAdmin"
|
||||||
|
title="是否为管理员"
|
||||||
|
@change="changeAdmin('temporary', $event)"
|
||||||
|
></LockSwitch>
|
||||||
|
</view>
|
||||||
|
<view class="mt-3 mb-3">
|
||||||
|
<LockSwitch
|
||||||
|
:value="temporaryCoerced"
|
||||||
|
title="胁迫卡"
|
||||||
|
@change="changeCoerced('temporary', $event)"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
></LockSwitch>
|
||||||
|
</view>
|
||||||
|
<view class="button" @click="create('temporary')">下一步</view>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { getCurrentInstance, ref } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { useBasicStore } from '@/stores/basic'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
import { checkCardNameRequest } from '@/api/card'
|
||||||
|
|
||||||
|
const instance = getCurrentInstance().proxy
|
||||||
|
const eventChannel = instance.getOpenerEventChannel()
|
||||||
|
|
||||||
|
const $basic = useBasicStore()
|
||||||
|
const $bluetooth = useBluetoothStore()
|
||||||
|
const $user = useUserStore()
|
||||||
|
|
||||||
|
const tabs = [
|
||||||
|
{
|
||||||
|
name: '永久'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '限时'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const permanentName = ref('')
|
||||||
|
const permanentAdmin = ref(false)
|
||||||
|
const permanentCoerced = ref(false)
|
||||||
|
|
||||||
|
const temporaryName = ref('')
|
||||||
|
const temporaryStartTime = ref(Number(new Date()))
|
||||||
|
const temporaryEndTime = ref(Number(new Date()))
|
||||||
|
const temporaryAdmin = ref(false)
|
||||||
|
const temporaryCoerced = ref(false)
|
||||||
|
|
||||||
|
const minDate = ref(Number(new Date()))
|
||||||
|
const maxDate = ref(Number(4133951940000))
|
||||||
|
const currentIndex = ref(0)
|
||||||
|
const deviceInfo = ref(null)
|
||||||
|
const placeholder =
|
||||||
|
'当被胁迫要求强行开锁时,使用胁迫卡会触发报警,报警信息会推送给管理员,该功能需要锁联网。\n请不要将胁迫卡用于日常开锁'
|
||||||
|
|
||||||
|
onLoad(async () => {
|
||||||
|
deviceInfo.value = await $basic.getDeviceInfo()
|
||||||
|
temporaryStartTime.value = setTime()
|
||||||
|
temporaryEndTime.value = setTime()
|
||||||
|
minDate.value = Number(getNextFullHour())
|
||||||
|
maxDate.value = Number(getFutureTimestamp())
|
||||||
|
})
|
||||||
|
|
||||||
|
const getNextFullHour = () => {
|
||||||
|
const now = new Date()
|
||||||
|
const currentHour = now.getHours()
|
||||||
|
now.setHours(currentHour)
|
||||||
|
now.setMinutes(0)
|
||||||
|
now.setSeconds(0)
|
||||||
|
now.setMilliseconds(0)
|
||||||
|
|
||||||
|
return now
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFutureTimestamp = () => {
|
||||||
|
const currentDate = new Date()
|
||||||
|
|
||||||
|
const year = currentDate.getFullYear()
|
||||||
|
const month = currentDate.getMonth()
|
||||||
|
const day = currentDate.getDate()
|
||||||
|
|
||||||
|
const futureDate = new Date(year + 3, month, day, 23, 0, 0)
|
||||||
|
|
||||||
|
return futureDate.getTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
const setTime = () => {
|
||||||
|
const now = new Date()
|
||||||
|
now.setMinutes(0, 0, 0)
|
||||||
|
|
||||||
|
return now.getTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
const create = async type => {
|
||||||
|
if (
|
||||||
|
(type === 'temporary' && temporaryName.value === '') ||
|
||||||
|
(type === 'permanent' && permanentName.value === '')
|
||||||
|
) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '名称不能为空',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '失效时间要大于生效时间',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const netWork = await $basic.getNetworkType()
|
||||||
|
if (!netWork) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let params = {
|
||||||
|
type: 'card',
|
||||||
|
keyId: $bluetooth.keyId.toString(),
|
||||||
|
uid: $user.userInfo.uid.toString(),
|
||||||
|
no: 0,
|
||||||
|
operate: 0,
|
||||||
|
userCountLimit: 0xffff
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'permanent') {
|
||||||
|
params = {
|
||||||
|
...params,
|
||||||
|
cardName: permanentName.value,
|
||||||
|
isAdmin: permanentAdmin.value ? 1 : 0,
|
||||||
|
isForce: permanentCoerced.value ? 1 : 0,
|
||||||
|
weekDays: [],
|
||||||
|
isRound: 0,
|
||||||
|
startDate: 0,
|
||||||
|
cardType: 1,
|
||||||
|
endDate: 0,
|
||||||
|
startTime: '00:00',
|
||||||
|
endTime: '00:00'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
params = {
|
||||||
|
...params,
|
||||||
|
cardName: temporaryName.value,
|
||||||
|
isAdmin: temporaryAdmin.value ? 1 : 0,
|
||||||
|
isForce: temporaryCoerced.value ? 1 : 0,
|
||||||
|
weekDays: [],
|
||||||
|
cardType: 2,
|
||||||
|
isRound: 0,
|
||||||
|
startDate: temporaryStartTime.value,
|
||||||
|
endDate: temporaryEndTime.value,
|
||||||
|
startTime: '00:00',
|
||||||
|
endTime: '00:00'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const { code, message } = await checkCardNameRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
cardName: params.cardName
|
||||||
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
$basic.routeJump({
|
||||||
|
name: 'bindCard',
|
||||||
|
params: {
|
||||||
|
card: JSON.stringify(params)
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
refresherList() {
|
||||||
|
eventChannel.emit('refresherList', {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeName = (type, event) => {
|
||||||
|
if (type === 'permanent') {
|
||||||
|
permanentName.value = event
|
||||||
|
} else {
|
||||||
|
temporaryName.value = event
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeDate = (type, event) => {
|
||||||
|
if (type === 'temporaryStartTime') {
|
||||||
|
temporaryStartTime.value = event
|
||||||
|
} else {
|
||||||
|
temporaryEndTime.value = event
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeAdmin = (type, event) => {
|
||||||
|
if (type === 'permanent') {
|
||||||
|
permanentAdmin.value = event.detail.value
|
||||||
|
} else {
|
||||||
|
temporaryAdmin.value = event.detail.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeCoerced = (type, event) => {
|
||||||
|
if (type === 'permanent') {
|
||||||
|
permanentCoerced.value = event.detail.value
|
||||||
|
} else {
|
||||||
|
temporaryCoerced.value = event.detail.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const clickTab = data => {
|
||||||
|
currentIndex.value = data.index
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeSwiper = e => {
|
||||||
|
currentIndex.value = e.detail.current
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.tabs {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
margin-top: 40rpx;
|
||||||
|
margin-bottom: 50rpx;
|
||||||
|
color: #262626;
|
||||||
|
font-size: 26rpx;
|
||||||
|
padding: 0 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
border-radius: 64rpx;
|
||||||
|
width: 686rpx;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #63b8af;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
337
pages/createFingerprint/createFingerprint.vue
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="tabs">
|
||||||
|
<up-tabs
|
||||||
|
:list="tabs"
|
||||||
|
lineWidth="40rpx"
|
||||||
|
lineHeight="5rpx"
|
||||||
|
:current="currentIndex"
|
||||||
|
lineColor="#63b8af"
|
||||||
|
@click="clickTab"
|
||||||
|
:inactiveStyle="{ color: '#a3a3a3', fontSize: '32rpx', fontWeight: 'bold' }"
|
||||||
|
:activeStyle="{ color: '#63b8af', fontSize: '32rpx', fontWeight: 'bold' }"
|
||||||
|
>
|
||||||
|
</up-tabs>
|
||||||
|
</view>
|
||||||
|
<swiper
|
||||||
|
:style="{ height: deviceInfo.screenHeight - deviceInfo.safeArea.top - 44 + 'px' }"
|
||||||
|
v-if="deviceInfo"
|
||||||
|
:list="tabs"
|
||||||
|
:autoplay="false"
|
||||||
|
:circular="true"
|
||||||
|
:current="currentIndex"
|
||||||
|
@change="changeSwiper"
|
||||||
|
>
|
||||||
|
<swiper-item>
|
||||||
|
<LockInput
|
||||||
|
:value="permanentName"
|
||||||
|
title="姓名"
|
||||||
|
placeholder="请输入"
|
||||||
|
@change-input="changeName('permanent', $event)"
|
||||||
|
></LockInput>
|
||||||
|
<view class="mt-3">
|
||||||
|
<LockSwitch
|
||||||
|
:value="permanentAdmin"
|
||||||
|
title="是否为管理员"
|
||||||
|
@change="changeAdmin('permanent', $event)"
|
||||||
|
></LockSwitch>
|
||||||
|
</view>
|
||||||
|
<view class="mt-3 mb-3">
|
||||||
|
<LockSwitch
|
||||||
|
:value="permanentCoerced"
|
||||||
|
title="胁迫卡"
|
||||||
|
@change="changeCoerced('permanent', $event)"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
></LockSwitch>
|
||||||
|
</view>
|
||||||
|
<view class="button" @click="create('permanent')">下一步</view>
|
||||||
|
</swiper-item>
|
||||||
|
<swiper-item :style="{ height: deviceInfo.windowHeight - 44 + 'px' }">
|
||||||
|
<LockInput
|
||||||
|
:value="temporaryName"
|
||||||
|
title="姓名"
|
||||||
|
placeholder="请输入"
|
||||||
|
@change-input="changeName('temporary', $event)"
|
||||||
|
></LockInput>
|
||||||
|
<view class="mt-3">
|
||||||
|
<LockDatetimePicker
|
||||||
|
title="生效时间"
|
||||||
|
:value="temporaryStartTime"
|
||||||
|
:minDate="minDate"
|
||||||
|
:maxDate="maxDate"
|
||||||
|
type="datehour"
|
||||||
|
@change-time="changeDate('temporaryStartTime', $event)"
|
||||||
|
></LockDatetimePicker>
|
||||||
|
</view>
|
||||||
|
<view class="mt-3">
|
||||||
|
<LockDatetimePicker
|
||||||
|
title="失效时间"
|
||||||
|
:value="temporaryEndTime"
|
||||||
|
:minDate="minDate"
|
||||||
|
:maxDate="maxDate"
|
||||||
|
type="datehour"
|
||||||
|
@change-time="changeDate('temporaryEndTime', $event)"
|
||||||
|
></LockDatetimePicker>
|
||||||
|
</view>
|
||||||
|
<view class="mt-3">
|
||||||
|
<LockSwitch
|
||||||
|
:value="temporaryAdmin"
|
||||||
|
title="是否为管理员"
|
||||||
|
@change="changeAdmin('temporary', $event)"
|
||||||
|
></LockSwitch>
|
||||||
|
</view>
|
||||||
|
<view class="mt-3 mb-3">
|
||||||
|
<LockSwitch
|
||||||
|
:value="temporaryCoerced"
|
||||||
|
title="胁迫卡"
|
||||||
|
@change="changeCoerced('temporary', $event)"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
></LockSwitch>
|
||||||
|
</view>
|
||||||
|
<view class="button" @click="create('temporary')">下一步</view>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { getCurrentInstance, ref } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { useBasicStore } from '@/stores/basic'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
import { checkFingerprintNameRequest } from '@/api/fingerprint'
|
||||||
|
|
||||||
|
const instance = getCurrentInstance().proxy
|
||||||
|
const eventChannel = instance.getOpenerEventChannel()
|
||||||
|
|
||||||
|
const $basic = useBasicStore()
|
||||||
|
const $bluetooth = useBluetoothStore()
|
||||||
|
const $user = useUserStore()
|
||||||
|
|
||||||
|
const tabs = [
|
||||||
|
{
|
||||||
|
name: '永久'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '限时'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const permanentName = ref('')
|
||||||
|
const permanentAdmin = ref(false)
|
||||||
|
const permanentCoerced = ref(false)
|
||||||
|
|
||||||
|
const temporaryName = ref('')
|
||||||
|
const temporaryStartTime = ref(Number(new Date()))
|
||||||
|
const temporaryEndTime = ref(Number(new Date()))
|
||||||
|
const temporaryAdmin = ref(false)
|
||||||
|
const temporaryCoerced = ref(false)
|
||||||
|
|
||||||
|
const minDate = ref(Number(new Date()))
|
||||||
|
const maxDate = ref(Number(4133951940000))
|
||||||
|
const currentIndex = ref(0)
|
||||||
|
const deviceInfo = ref(null)
|
||||||
|
const placeholder =
|
||||||
|
'当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警信息会推送给管理员,该功能需要锁联网。\n请不要将胁迫指纹用于日常开锁'
|
||||||
|
|
||||||
|
onLoad(async () => {
|
||||||
|
deviceInfo.value = await $basic.getDeviceInfo()
|
||||||
|
temporaryStartTime.value = setTime()
|
||||||
|
temporaryEndTime.value = setTime()
|
||||||
|
minDate.value = Number(getNextFullHour())
|
||||||
|
maxDate.value = Number(getFutureTimestamp())
|
||||||
|
})
|
||||||
|
|
||||||
|
const getNextFullHour = () => {
|
||||||
|
const now = new Date()
|
||||||
|
const currentHour = now.getHours()
|
||||||
|
now.setHours(currentHour)
|
||||||
|
now.setMinutes(0)
|
||||||
|
now.setSeconds(0)
|
||||||
|
now.setMilliseconds(0)
|
||||||
|
|
||||||
|
return now
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFutureTimestamp = () => {
|
||||||
|
const currentDate = new Date()
|
||||||
|
|
||||||
|
const year = currentDate.getFullYear()
|
||||||
|
const month = currentDate.getMonth()
|
||||||
|
const day = currentDate.getDate()
|
||||||
|
|
||||||
|
const futureDate = new Date(year + 3, month, day, 23, 0, 0)
|
||||||
|
|
||||||
|
return futureDate.getTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
const setTime = () => {
|
||||||
|
const now = new Date()
|
||||||
|
now.setMinutes(0, 0, 0)
|
||||||
|
|
||||||
|
return now.getTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
const create = async type => {
|
||||||
|
if (
|
||||||
|
(type === 'temporary' && temporaryName.value === '') ||
|
||||||
|
(type === 'permanent' && permanentName.value === '')
|
||||||
|
) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '名称不能为空',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'temporary' && temporaryStartTime.value > temporaryEndTime.value) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '失效时间要大于生效时间',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const netWork = await $basic.getNetworkType()
|
||||||
|
if (!netWork) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let params = {
|
||||||
|
type: 'fingerprint',
|
||||||
|
keyId: $bluetooth.keyId.toString(),
|
||||||
|
uid: $user.userInfo.uid.toString(),
|
||||||
|
no: 0,
|
||||||
|
operate: 0,
|
||||||
|
userCountLimit: 0xffff
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'permanent') {
|
||||||
|
params = {
|
||||||
|
...params,
|
||||||
|
fingerprintName: permanentName.value,
|
||||||
|
isAdmin: permanentAdmin.value ? 1 : 0,
|
||||||
|
isForce: permanentCoerced.value ? 1 : 0,
|
||||||
|
weekDays: [],
|
||||||
|
isRound: 0,
|
||||||
|
startDate: 0,
|
||||||
|
fingerprintType: 1,
|
||||||
|
endDate: 0,
|
||||||
|
startTime: '00:00',
|
||||||
|
endTime: '00:00'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
params = {
|
||||||
|
...params,
|
||||||
|
fingerprintName: temporaryName.value,
|
||||||
|
isAdmin: temporaryAdmin.value ? 1 : 0,
|
||||||
|
isForce: temporaryCoerced.value ? 1 : 0,
|
||||||
|
weekDays: [],
|
||||||
|
fingerprintType: 2,
|
||||||
|
isRound: 0,
|
||||||
|
startDate: temporaryStartTime.value,
|
||||||
|
endDate: temporaryEndTime.value,
|
||||||
|
startTime: '00:00',
|
||||||
|
endTime: '00:00'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const { code, message } = await checkFingerprintNameRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
fingerprintName: params.fingerprintName
|
||||||
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
$basic.routeJump({
|
||||||
|
name: 'bindFingerprint',
|
||||||
|
params: {
|
||||||
|
info: JSON.stringify(params)
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
refresherList() {
|
||||||
|
eventChannel.emit('refresherList', {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeName = (type, event) => {
|
||||||
|
if (type === 'permanent') {
|
||||||
|
permanentName.value = event
|
||||||
|
} else {
|
||||||
|
temporaryName.value = event
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeDate = (type, event) => {
|
||||||
|
if (type === 'temporaryStartTime') {
|
||||||
|
temporaryStartTime.value = event
|
||||||
|
} else {
|
||||||
|
temporaryEndTime.value = event
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeAdmin = (type, event) => {
|
||||||
|
if (type === 'permanent') {
|
||||||
|
permanentAdmin.value = event.detail.value
|
||||||
|
} else {
|
||||||
|
temporaryAdmin.value = event.detail.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeCoerced = (type, event) => {
|
||||||
|
if (type === 'permanent') {
|
||||||
|
permanentCoerced.value = event.detail.value
|
||||||
|
} else {
|
||||||
|
temporaryCoerced.value = event.detail.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const clickTab = data => {
|
||||||
|
currentIndex.value = data.index
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeSwiper = e => {
|
||||||
|
currentIndex.value = e.detail.current
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.tabs {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
margin-top: 40rpx;
|
||||||
|
margin-bottom: 50rpx;
|
||||||
|
color: #262626;
|
||||||
|
font-size: 26rpx;
|
||||||
|
padding: 0 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
border-radius: 64rpx;
|
||||||
|
width: 686rpx;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #63b8af;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
111
pages/fingerprintDetail/fingerprintDetail.vue
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view v-if="info">
|
||||||
|
<view class="item">
|
||||||
|
<view class="item-title">指纹号</view>
|
||||||
|
<view class="item-content">{{ info.fingerprintNumber }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 2rpx">
|
||||||
|
<view class="item-title">姓名</view>
|
||||||
|
<view class="item-content">{{ info.fingerprintName }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 2rpx">
|
||||||
|
<view class="item-title">有效期</view>
|
||||||
|
<view v-if="info.fingerprintType === 1">永久</view>
|
||||||
|
<view v-else-if="info.fingerprintType === 2">
|
||||||
|
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd h:M') }}</view>
|
||||||
|
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd h:M') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
|
||||||
|
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 2rpx" v-if="info.fingerprintType === 4">
|
||||||
|
<view class="item-title">有效日</view>
|
||||||
|
<view class="item-content">{{ $lock.convertWeekDaysToChineseString(info.weekDay) }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 2rpx" v-if="info.fingerprintType === 4">
|
||||||
|
<view class="item-title">有效时间</view>
|
||||||
|
<view class="item-content">
|
||||||
|
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 20rpx">
|
||||||
|
<view class="item-title">添加者</view>
|
||||||
|
<view class="item-content">{{ info.senderUsername }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" style="margin-top: 2rpx">
|
||||||
|
<view class="item-title">添加时间</view>
|
||||||
|
<view class="item-content">{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="button" @click="deletePassword">删除</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { getCurrentInstance, ref } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { timeFormat } from 'uview-plus'
|
||||||
|
import { useLockStore } from '@/stores/lock'
|
||||||
|
|
||||||
|
const instance = getCurrentInstance().proxy
|
||||||
|
const eventChannel = instance.getOpenerEventChannel()
|
||||||
|
|
||||||
|
const $lock = useLockStore()
|
||||||
|
|
||||||
|
const info = ref(null)
|
||||||
|
|
||||||
|
onLoad(options => {
|
||||||
|
if (options.info) {
|
||||||
|
info.value = JSON.parse(options.info)
|
||||||
|
console.log(info.value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const deletePassword = async () => {
|
||||||
|
eventChannel.emit('delete', {})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.item-title {
|
||||||
|
width: 350rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 24rpx 32rpx;
|
||||||
|
background-color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
padding: 24rpx 32rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
margin: 32rpx;
|
||||||
|
width: 686rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
background-color: #df282d;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 88rpx;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
463
pages/fingerprintList/fingerprintList.vue
Normal file
@ -0,0 +1,463 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<scroll-view
|
||||||
|
v-if="deviceInfo"
|
||||||
|
scroll-y="true"
|
||||||
|
:style="{ height: deviceInfo.screenHeight - deviceInfo.safeArea.top + 'px' }"
|
||||||
|
lower-threshold="100"
|
||||||
|
@refresherrefresh="refresherList"
|
||||||
|
:refresher-enabled="true"
|
||||||
|
@scrolltolower="nextPage"
|
||||||
|
:refresher-triggered="refresherTriggered"
|
||||||
|
>
|
||||||
|
<view class="search">
|
||||||
|
<up-search
|
||||||
|
shape="square"
|
||||||
|
:searchIconSize="48"
|
||||||
|
:inputStyle="{ fontSize: '32rpx' }"
|
||||||
|
:height="80"
|
||||||
|
placeholder="搜索"
|
||||||
|
:clearabled="false"
|
||||||
|
@change="changeSearch"
|
||||||
|
v-model="searchStr"
|
||||||
|
bgColor="#ffffff"
|
||||||
|
:showAction="false"
|
||||||
|
maxlength="50"
|
||||||
|
></up-search>
|
||||||
|
</view>
|
||||||
|
<view style="padding: 0 0 calc(env(safe-area-inset-bottom) + 250rpx) 0">
|
||||||
|
<view v-if="list.length === 0 && requestFinished">
|
||||||
|
<image
|
||||||
|
class="empty-list"
|
||||||
|
src="/static/images/background_empty_list.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
<view class="empty-list-text">暂无数据</view>
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<up-swipe-action>
|
||||||
|
<up-swipe-action-item
|
||||||
|
ref="swipeItem"
|
||||||
|
:options="options"
|
||||||
|
v-for="item in list"
|
||||||
|
:key="item.keyboardPwdId"
|
||||||
|
:threshold="50"
|
||||||
|
@click="deleteItem(item)"
|
||||||
|
>
|
||||||
|
<view class="item" @click="toDetail(item)">
|
||||||
|
<image
|
||||||
|
class="item-left"
|
||||||
|
src="/static/images/icon_fingerprint_white.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
<view class="item-right">
|
||||||
|
<view style="display: flex; align-items: center">
|
||||||
|
<view class="item-right-top">{{ item.fingerprintName }}</view>
|
||||||
|
<view class="status">
|
||||||
|
{{ item.statusText }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item-right-bottom">{{ item.timeText }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="line"></view>
|
||||||
|
</up-swipe-action-item>
|
||||||
|
</up-swipe-action>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="button">
|
||||||
|
<view class="button-reset" @click="reset">重置指纹</view>
|
||||||
|
<view class="button-create" @click="toCreate">添加指纹</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { timeFormat } from 'uview-plus'
|
||||||
|
import { useBasicStore } from '@/stores/basic'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { deleteFingerprintRequest, getFingerprintList } from '@/api/fingerprint'
|
||||||
|
|
||||||
|
const $basic = useBasicStore()
|
||||||
|
const $bluetooth = useBluetoothStore()
|
||||||
|
const $user = useUserStore()
|
||||||
|
|
||||||
|
const swipeItem = ref(null)
|
||||||
|
|
||||||
|
const searchStr = ref('')
|
||||||
|
const list = ref([])
|
||||||
|
const pageNo = ref(1)
|
||||||
|
const pageSize = 50
|
||||||
|
const total = ref(0)
|
||||||
|
const lockId = ref(null)
|
||||||
|
|
||||||
|
const deviceInfo = ref(null)
|
||||||
|
const requestFinished = ref(false)
|
||||||
|
const refresherTriggered = ref(false)
|
||||||
|
const options = ref([
|
||||||
|
{
|
||||||
|
text: '删除',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#f56c6c'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
deviceInfo.value = await $basic.getDeviceInfo()
|
||||||
|
lockId.value = $bluetooth.currentLockInfo.lockId
|
||||||
|
const { code, message } = await getList({
|
||||||
|
pageNo: pageNo.value
|
||||||
|
})
|
||||||
|
requestFinished.value = true
|
||||||
|
uni.hideLoading()
|
||||||
|
if (code !== 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const reset = async () => {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '重置后,该锁的指纹都将被删除哦,确认要重置吗?',
|
||||||
|
async success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
const netWork = await $basic.getNetworkType()
|
||||||
|
if (!netWork) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await deleteData({
|
||||||
|
operate: 3
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteData = async info => {
|
||||||
|
uni.showLoading({
|
||||||
|
title: `${info.operate === 2 ? '删除' : '重置'}中`
|
||||||
|
})
|
||||||
|
|
||||||
|
const { code } = await $bluetooth.registerAuthentication({
|
||||||
|
type: 'fingerprint',
|
||||||
|
keyId: $bluetooth.keyId.toString(),
|
||||||
|
uid: $user.userInfo.uid.toString(),
|
||||||
|
no: Number(info.fingerprintNumber) || 0,
|
||||||
|
operate: info.operate,
|
||||||
|
isAdmin: 0,
|
||||||
|
isForce: 0,
|
||||||
|
userCountLimit: 0,
|
||||||
|
weekDays: [],
|
||||||
|
isRound: 0,
|
||||||
|
startDate: 0,
|
||||||
|
endDate: 0,
|
||||||
|
startTime: '00:00',
|
||||||
|
endTime: '00:00'
|
||||||
|
})
|
||||||
|
|
||||||
|
$bluetooth.closeBluetoothConnection()
|
||||||
|
if (code === 0) {
|
||||||
|
let params = {
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
deleteType: 1,
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
if (info.operate === 2) {
|
||||||
|
params = {
|
||||||
|
...params,
|
||||||
|
fingerprintId: info.fingerprintId,
|
||||||
|
type: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const { code: requestCode, message } = await deleteFingerprintRequest(params)
|
||||||
|
if (requestCode === 0) {
|
||||||
|
if (info.back) {
|
||||||
|
$basic.backAndToast(`删除成功`)
|
||||||
|
}
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: `${info.operate === 2 ? '删除' : '重置'}成功`,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
pageNo.value = 1
|
||||||
|
await getList({
|
||||||
|
pageNo: pageNo.value
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (code === -1) {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: `${info.operate === 2 ? '删除' : '重置'}失败,请保持在锁附近`,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteItem = async data => {
|
||||||
|
const index = list.value.findIndex(item => item.keyboardPwdId === data.keyboardPwdId)
|
||||||
|
swipeItem.value[index].closeHandler()
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除吗?',
|
||||||
|
async success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
const netWork = await $basic.getNetworkType()
|
||||||
|
if (!netWork) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await deleteData({
|
||||||
|
...data,
|
||||||
|
operate: 2
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const refresherList = async () => {
|
||||||
|
refresherTriggered.value = true
|
||||||
|
pageNo.value = 1
|
||||||
|
const { code, message } = await getList({
|
||||||
|
pageNo: pageNo.value,
|
||||||
|
searchStr: searchStr.value
|
||||||
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '刷新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
refresherTriggered.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextPage = async () => {
|
||||||
|
if (total.value <= pageNo.value * pageSize) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const page = pageNo.value + 1
|
||||||
|
const params = {
|
||||||
|
searchStr: searchStr.value,
|
||||||
|
pageNo: page
|
||||||
|
}
|
||||||
|
const { code, message } = await getList(params)
|
||||||
|
if (code === 0) {
|
||||||
|
pageNo.value = page
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getList = async params => {
|
||||||
|
const {
|
||||||
|
data: { timestamp }
|
||||||
|
} = await $bluetooth.updateServerTimestamp()
|
||||||
|
const { code, data, message } = await getFingerprintList({
|
||||||
|
...params,
|
||||||
|
lockId: lockId.value,
|
||||||
|
pageSize
|
||||||
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
total.value = data.total
|
||||||
|
for (let i = 0; i < data.list.length; i++) {
|
||||||
|
if (data.list[i].fingerprintStatus === 1 && data.list[i].startDate > timestamp) {
|
||||||
|
data.list[i].statusText = '未生效'
|
||||||
|
} else if (data.list[i].fingerprintStatus === 2) {
|
||||||
|
data.list[i].statusText = '已失效'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.list[i].fingerprintType === 1) {
|
||||||
|
data.list[i].timeText = timeFormat(data.list[i].startDate, 'yyyy-mm-dd hh:MM') + ' 永久'
|
||||||
|
} else if (data.list[i].fingerprintType === 2) {
|
||||||
|
data.list[i].timeText =
|
||||||
|
timeFormat(data.list[i].startDate, 'yyyy-mm-dd hh:MM') +
|
||||||
|
' - ' +
|
||||||
|
timeFormat(data.list[i].endDate, 'yyyy-mm-dd hh:MM') +
|
||||||
|
' 限时'
|
||||||
|
} else {
|
||||||
|
data.list[i].timeText =
|
||||||
|
timeFormat(data.list[i].startDate, 'yyyy-mm-dd') +
|
||||||
|
' - ' +
|
||||||
|
timeFormat(data.list[i].endDate, 'yyyy-mm-dd') +
|
||||||
|
' 循环'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (params.pageNo === 1) {
|
||||||
|
list.value = data.list
|
||||||
|
} else {
|
||||||
|
list.value = list.value.concat(data.list)
|
||||||
|
}
|
||||||
|
return { code }
|
||||||
|
}
|
||||||
|
return { code, message }
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeSearch = async data => {
|
||||||
|
pageNo.value = 1
|
||||||
|
const { code, message } = await getList({
|
||||||
|
searchStr: data,
|
||||||
|
pageNo: pageNo.value
|
||||||
|
})
|
||||||
|
if (code !== 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const toCreate = () => {
|
||||||
|
$basic.routeJump({
|
||||||
|
name: 'createFingerprint',
|
||||||
|
events: {
|
||||||
|
refresherList() {
|
||||||
|
pageNo.value = 1
|
||||||
|
getList({
|
||||||
|
pageNo: pageNo.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const toDetail = item => {
|
||||||
|
$basic.routeJump({
|
||||||
|
name: 'fingerprintDetail',
|
||||||
|
params: {
|
||||||
|
info: JSON.stringify(item)
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
delete() {
|
||||||
|
deleteItem({ ...item, back: true })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.search {
|
||||||
|
padding: 32rpx;
|
||||||
|
width: 686rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: fixed;
|
||||||
|
bottom: calc(env(safe-area-inset-bottom) + 20rpx);
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
.button-reset {
|
||||||
|
margin-left: 50rpx;
|
||||||
|
width: 300rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
background-color: #df282d;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 88rpx;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-create {
|
||||||
|
margin-left: 50rpx;
|
||||||
|
width: 300rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
background-color: #63b8af;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 88rpx;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #ffffff;
|
||||||
|
height: 120rpx;
|
||||||
|
width: 750rpx;
|
||||||
|
|
||||||
|
.item-left {
|
||||||
|
margin-left: 32rpx;
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-right {
|
||||||
|
margin-right: 32rpx;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
width: 574rpx;
|
||||||
|
|
||||||
|
.item-right-top {
|
||||||
|
max-width: 400rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-right-bottom {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
width: 100%;
|
||||||
|
height: 2rpx;
|
||||||
|
background: #ebebeb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-list {
|
||||||
|
width: 150rpx;
|
||||||
|
height: 150rpx;
|
||||||
|
margin: 300rpx auto 20rpx 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-list-text {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status {
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #df282d;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -68,6 +68,30 @@
|
|||||||
<image class="menu-main-image" src="/static/images/icon_lock_transparent.png"></image>
|
<image class="menu-main-image" src="/static/images/icon_lock_transparent.png"></image>
|
||||||
<view>密码</view>
|
<view>密码</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="currentLockInfo.lockFeature.icCard || currentLockInfo.keyRight === 1"
|
||||||
|
class="menu-main-view"
|
||||||
|
@click="routeJump({ name: 'cardList' })"
|
||||||
|
>
|
||||||
|
<image class="menu-main-image" src="/static/images/icon_card.png"></image>
|
||||||
|
<view>卡</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="currentLockInfo.lockFeature.fingerprint || currentLockInfo.keyRight === 1"
|
||||||
|
class="menu-main-view"
|
||||||
|
@click="routeJump({ name: 'fingerprintList' })"
|
||||||
|
>
|
||||||
|
<image class="menu-main-image" src="/static/images/icon_fingerprint.png"></image>
|
||||||
|
<view>指纹</view>
|
||||||
|
</view>
|
||||||
|
<view class="menu-main-view" @click="routeJump({ name: 'keyList' })">
|
||||||
|
<image class="menu-main-image" src="/static/images/icon_admin_black.png"></image>
|
||||||
|
<view>授权管理员</view>
|
||||||
|
</view>
|
||||||
|
<view class="menu-main-view" @click="routeJump({ name: 'keyList' })">
|
||||||
|
<image class="menu-main-image" src="/static/images/icon_record.png"></image>
|
||||||
|
<view>操作记录</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="setting" @click="routeJump({ name: 'setting' })">
|
<view class="setting" @click="routeJump({ name: 'setting' })">
|
||||||
@ -113,6 +137,9 @@
|
|||||||
import { deleteKeyRequest } from '@/api/key'
|
import { deleteKeyRequest } from '@/api/key'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
SwitchLoading
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
time: 0,
|
time: 0,
|
||||||
@ -127,9 +154,6 @@
|
|||||||
...mapState(useUserStore, ['userInfo']),
|
...mapState(useUserStore, ['userInfo']),
|
||||||
...mapState(useLockStore, ['lockSearch'])
|
...mapState(useLockStore, ['lockSearch'])
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
SwitchLoading
|
|
||||||
},
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.getServeTime()
|
this.getServeTime()
|
||||||
},
|
},
|
||||||
@ -428,7 +452,6 @@
|
|||||||
.menu {
|
.menu {
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
margin-left: 32rpx;
|
margin-left: 32rpx;
|
||||||
padding-bottom: 32rpx;
|
|
||||||
width: 686rpx;
|
width: 686rpx;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
border-radius: 32rpx;
|
border-radius: 32rpx;
|
||||||
@ -449,16 +472,16 @@
|
|||||||
|
|
||||||
.menu-main {
|
.menu-main {
|
||||||
padding-top: 32rpx;
|
padding-top: 32rpx;
|
||||||
padding-bottom: 32rpx;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 32rpx;
|
font-size: 28rpx;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-left: 43rpx;
|
margin-left: 43rpx;
|
||||||
|
|
||||||
.menu-main-view {
|
.menu-main-view {
|
||||||
width: 150rpx;
|
width: 150rpx;
|
||||||
|
margin-bottom: 48rpx;
|
||||||
|
|
||||||
.menu-main-image {
|
.menu-main-image {
|
||||||
filter: sepia(100%) saturate(10000%) hue-rotate(180deg) brightness(0.1);
|
filter: sepia(100%) saturate(10000%) hue-rotate(180deg) brightness(0.1);
|
||||||
|
|||||||
BIN
static/images/icon_add_blue.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
static/images/icon_add_card.png
Executable file
|
After Width: | Height: | Size: 44 KiB |
BIN
static/images/icon_admin_black.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
static/images/icon_card.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
static/images/icon_card_white.png
Executable file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
static/images/icon_fingerprint.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
static/images/icon_fingerprint_0.png
Executable file
|
After Width: | Height: | Size: 156 KiB |
BIN
static/images/icon_fingerprint_1.png
Executable file
|
After Width: | Height: | Size: 182 KiB |
BIN
static/images/icon_fingerprint_2.png
Executable file
|
After Width: | Height: | Size: 303 KiB |
BIN
static/images/icon_fingerprint_3.png
Executable file
|
After Width: | Height: | Size: 336 KiB |
BIN
static/images/icon_fingerprint_4.png
Executable file
|
After Width: | Height: | Size: 361 KiB |
BIN
static/images/icon_fingerprint_5.png
Normal file
|
After Width: | Height: | Size: 308 KiB |
BIN
static/images/icon_fingerprint_white.png
Executable file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
static/images/icon_record.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
@ -111,6 +111,46 @@ const pages = [
|
|||||||
name: 'addLockGuid',
|
name: 'addLockGuid',
|
||||||
path: '/pages/addLockGuid/addLockGuid',
|
path: '/pages/addLockGuid/addLockGuid',
|
||||||
tabBar: false
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cardList',
|
||||||
|
path: '/pages/cardList/cardList',
|
||||||
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'createCard',
|
||||||
|
path: '/pages/createCard/createCard',
|
||||||
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cardDetail',
|
||||||
|
path: '/pages/cardDetail/cardDetail',
|
||||||
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'bindCard',
|
||||||
|
path: '/pages/bindCard/bindCard',
|
||||||
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'fingerprintList',
|
||||||
|
path: '/pages/fingerprintList/fingerprintList',
|
||||||
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'createFingerprint',
|
||||||
|
path: '/pages/createFingerprint/createFingerprint',
|
||||||
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'fingerprintDetail',
|
||||||
|
path: '/pages/fingerprintDetail/fingerprintDetail',
|
||||||
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'bindFingerprint',
|
||||||
|
path: '/pages/bindFingerprint/bindFingerprint',
|
||||||
|
tabBar: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -134,10 +174,27 @@ export const useBasicStore = defineStore('basic', {
|
|||||||
return page.name === data.name
|
return page.name === data.name
|
||||||
})
|
})
|
||||||
if (page) {
|
if (page) {
|
||||||
uni.$u.route({
|
if (!data.type || data.type === 'navigateTo' || data.type === 'to') {
|
||||||
url: page.path,
|
let url = `${page.path}?`
|
||||||
...data
|
if (data.params) {
|
||||||
})
|
Object.keys(data.params).forEach((key, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
url += `${key}=${data.params[key]}`
|
||||||
|
} else {
|
||||||
|
url += `&${key}=${data.params[key]}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url,
|
||||||
|
...data
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.$u.route({
|
||||||
|
url: page.path,
|
||||||
|
...data
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取当前网络状态
|
// 获取当前网络状态
|
||||||
|
|||||||
27
unocss.config.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import presetWeapp from 'unocss-preset-weapp'
|
||||||
|
import { extractorAttributify, transformerClass } from 'unocss-preset-weapp/transformer'
|
||||||
|
|
||||||
|
const { presetWeappAttributify, transformerAttributify } = extractorAttributify()
|
||||||
|
|
||||||
|
export default {
|
||||||
|
presets: [
|
||||||
|
// https://github.com/MellowCo/unocss-preset-weapp
|
||||||
|
presetWeapp(),
|
||||||
|
// attributify autocomplete
|
||||||
|
presetWeappAttributify()
|
||||||
|
],
|
||||||
|
shortcuts: [
|
||||||
|
{
|
||||||
|
'border-base': 'border border-gray-500_10',
|
||||||
|
center: 'flex justify-center items-center'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
transformers: [
|
||||||
|
// https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerAttributify
|
||||||
|
transformerAttributify(),
|
||||||
|
|
||||||
|
// https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerClass
|
||||||
|
transformerClass()
|
||||||
|
]
|
||||||
|
}
|
||||||
16
vite.config.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import uni from '@dcloudio/vite-plugin-uni'
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig(async () => {
|
||||||
|
const UnoCss = await import('unocss/vite').then(i => i.default)
|
||||||
|
|
||||||
|
return {
|
||||||
|
plugins: [
|
||||||
|
uni(),
|
||||||
|
|
||||||
|
// https://github.com/unocss/unocss
|
||||||
|
UnoCss()
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||