1. 修复全局列表刷新bug
2. 所有loading添加蒙层不可点击穿透 3. 密码和电子钥匙详情页添加删除功能
This commit is contained in:
parent
13f45e1c26
commit
5129d3624a
@ -100,7 +100,8 @@
|
||||
{
|
||||
"path": "pages/keyList/keyList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "电子钥匙"
|
||||
"disableScroll": true,
|
||||
"navigationBarTitleText": "电子钥匙"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -24,6 +24,7 @@ export default {
|
||||
computed: {
|
||||
...mapState(useBluetoothStore, ['currentLockInfo', 'keyId']),
|
||||
...mapState(useUserStore, ['userInfo']),
|
||||
...mapState(useLockStore, ['lockSearch']),
|
||||
},
|
||||
onLoad() {
|
||||
this.name = this.currentLockInfo.name
|
||||
@ -32,7 +33,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBluetoothStore, ['addLockUser']),
|
||||
...mapActions(useLockStore, ['getLockList']),
|
||||
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
||||
uopdateName(data) {
|
||||
this.name = data.detail.value
|
||||
},
|
||||
@ -45,7 +46,8 @@ export default {
|
||||
return
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '添加中'
|
||||
title: '添加中',
|
||||
mask: true
|
||||
})
|
||||
const timestamp = parseInt(new Date().getTime() / 1000)
|
||||
const password = (Math.floor(Math.random() * 900000) + 100000).toString()
|
||||
@ -114,10 +116,11 @@ export default {
|
||||
const { code, message } = await bindLockAdmin(params)
|
||||
console.log('添加锁返回', code, message)
|
||||
if(code === 0) {
|
||||
this.getLockList({
|
||||
pageNo: 1,
|
||||
pageSize: 50
|
||||
this.updateLockSearch({
|
||||
...this.lockSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
this.getLockList(this.lockSearch)
|
||||
uni.hideLoading()
|
||||
uni.navigateBack({
|
||||
complete() {
|
||||
|
||||
@ -63,6 +63,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapState(useBluetoothStore, ['currentLockInfo']),
|
||||
...mapState(useLockStore, ['passwordSearch']),
|
||||
},
|
||||
async onLoad() {
|
||||
this.deviceInfo = await this.getDeviceInfo()
|
||||
@ -70,7 +71,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['getDeviceInfo']),
|
||||
...mapActions(useLockStore, ['getPasswordList']),
|
||||
...mapActions(useLockStore, ['getPasswordList', 'updatePasswordSearch']),
|
||||
setTime() {
|
||||
const now = new Date()
|
||||
now.setMinutes(0, 0, 0)
|
||||
@ -114,13 +115,11 @@ export default {
|
||||
}
|
||||
const { code, data, message } = await createPsaawordRequest(params)
|
||||
if(code === 0) {
|
||||
const search = {
|
||||
lockStatus: this.currentLockInfo.lockStatus,
|
||||
lockId: this.currentLockInfo.lockId,
|
||||
pageNo: 1,
|
||||
pageSize: 50
|
||||
}
|
||||
this.getPasswordList(search)
|
||||
this.updatePasswordSearch({
|
||||
...this.passwordSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
this.getPasswordList(this.passwordSearch)
|
||||
uni.showModal({
|
||||
title: '密码生成成功',
|
||||
content: `密码:${data.keyboardPwd}`,
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
<view class="search">
|
||||
<up-search :searchIconSize="48" :inputStyle="{ fontSize: '32rpx' }" @focus="getFocus" @blur="getBlur"
|
||||
:height="80" placeholder="搜索" :clearabled="false" @change="changeSearch"
|
||||
v-model="search.searchStr" bgColor="#ffffff" :showAction="false" maxlength="20"></up-search>
|
||||
v-model="lockSearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="20"></up-search>
|
||||
</view>
|
||||
<view class="lock-list" v-if="!penging">
|
||||
<view v-if="lockList.length === 0 && search.searchStr === '' && !focus">
|
||||
<view v-if="lockList.length === 0 && lockSearch.searchStr === '' && !focus">
|
||||
<image src="/static/images/icon_add_round.png" mode="aspectFill" class="button-add-big"
|
||||
@click="toSearchDevice"></image>
|
||||
<view class="text">填加锁时,手机必须在锁旁边</view>
|
||||
@ -71,11 +71,6 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
search: {
|
||||
pageNo: 1,
|
||||
pageSize: 50,
|
||||
searchStr: ''
|
||||
},
|
||||
refresherTriggered: false,
|
||||
focus: false,
|
||||
penging: true,
|
||||
@ -84,12 +79,13 @@
|
||||
},
|
||||
computed: {
|
||||
...mapState(useUserStore, ['userInfo', 'isLogin']),
|
||||
...mapState(useLockStore, ['lockList', 'lockTotal']),
|
||||
...mapState(useLockStore, ['lockList', 'lockTotal', 'lockSearch']),
|
||||
...mapState(useBluetoothStore, ['bluetoothStatus', 'isInitBluetooth']),
|
||||
},
|
||||
async onLoad() {
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
const accountInfo = wx.getAccountInfoSync()
|
||||
getApp().globalData.appid = accountInfo.miniProgram.appId
|
||||
@ -98,7 +94,7 @@
|
||||
const token = uni.getStorageSync('token')
|
||||
if(token) {
|
||||
await this.getUserInfo()
|
||||
await this.getLockList(this.search)
|
||||
await this.getLockList(this.lockSearch)
|
||||
} else {
|
||||
await this.homeLogin()
|
||||
}
|
||||
@ -108,7 +104,7 @@
|
||||
methods: {
|
||||
timeFormat,
|
||||
...mapActions(useUserStore, ['updateUserInfo', 'updateLoginStatus', 'phoneLogin', 'getUserInfo']),
|
||||
...mapActions(useLockStore, ['getLockList', 'getRole', 'getTimeLimit']),
|
||||
...mapActions(useLockStore, ['getLockList', 'getRole', 'getTimeLimit', 'updateLockSearch']),
|
||||
...mapActions(useBluetoothStore, ['getBluetoothStatus', 'initAndListenBluetooth', 'updateCurrentLockInfo',
|
||||
'checkSetting', 'updateKeyId']),
|
||||
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']),
|
||||
@ -126,7 +122,7 @@
|
||||
if(data.accessToken) {
|
||||
uni.setStorageSync('token', data.accessToken)
|
||||
that.getUserInfo()
|
||||
that.getLockList(that.search)
|
||||
that.getLockList(that.lockSearch)
|
||||
that.updateLoginStatus(true)
|
||||
resolve(true)
|
||||
} else {
|
||||
@ -168,17 +164,23 @@
|
||||
},
|
||||
async nextPage() {
|
||||
if(this.lockList.length < this.lockTotal) {
|
||||
this.search.pageNo++
|
||||
const { code } = await this.getLockList(this.search)
|
||||
const sreach = {
|
||||
...this.lockSearch,
|
||||
pageNo: this.lockSearch.pageNo + 1
|
||||
}
|
||||
const { code } = await this.getLockList(search)
|
||||
if(code !== 0) {
|
||||
this.search.pageNo--
|
||||
this.updateLockSearch(search)
|
||||
}
|
||||
}
|
||||
},
|
||||
async refresherList() {
|
||||
this.refresherTriggered = true
|
||||
this.search.pageNo = 1
|
||||
await this.getLockList(this.search)
|
||||
this.updateLockSearch({
|
||||
...this.lockSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
await this.getLockList(this.lockSearch)
|
||||
uni.showToast({
|
||||
title: '刷新成功',
|
||||
icon: 'none'
|
||||
@ -186,8 +188,11 @@
|
||||
this.refresherTriggered = false
|
||||
},
|
||||
async changeSearch(data) {
|
||||
this.search.searchStr = data
|
||||
await this.getLockList(this.search)
|
||||
this.updateLockSearch({
|
||||
...this.lockSearch,
|
||||
searchStr: data
|
||||
})
|
||||
await this.getLockList(this.lockSearch)
|
||||
},
|
||||
getFocus() {
|
||||
this.focus = true
|
||||
|
||||
@ -24,23 +24,66 @@
|
||||
<view class="item-title">发送时间</view>
|
||||
<view class="item-content">{{ timeFormat(currentKeyInfo.sendDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
<view class="button" @click="deleteKey">删除钥匙</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'pinia'
|
||||
import { mapActions, mapState } from 'pinia'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { deleteKeyRequest } from '@/api/key'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useLockStore, ['currentKeyInfo']),
|
||||
...mapState(useLockStore, ['currentKeyInfo', 'keySearch']),
|
||||
},
|
||||
methods: {
|
||||
timeFormat
|
||||
timeFormat,
|
||||
...mapActions(useLockStore, ['updateKeySearch', 'getKeyList']),
|
||||
async deleteKey () {
|
||||
const that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除该钥匙',
|
||||
async success(res) {
|
||||
if(res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '删除中',
|
||||
mask: true
|
||||
})
|
||||
const { code: requestCode, message } = await deleteKeyRequest({
|
||||
keyId: that.currentKeyInfo.keyId
|
||||
})
|
||||
if(requestCode === 0) {
|
||||
uni.hideLoading()
|
||||
that.updateKeySearch({
|
||||
...that.keySearch,
|
||||
pageNo: 1
|
||||
})
|
||||
await that.getKeyList(that.keySearch)
|
||||
uni.navigateBack({
|
||||
complete: () => {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@ -67,4 +110,16 @@ page {
|
||||
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>
|
||||
|
||||
@ -20,7 +20,12 @@
|
||||
<view class="key" @click="toKeyDetail(key)">
|
||||
<image class="key-left" :src="key.headUrl" mode="aspectFill"></image>
|
||||
<view class="key-right">
|
||||
<view class="key-right-top">{{ key.keyName }}</view>
|
||||
<view style="display: flex; align-items: center">
|
||||
<view class="key-right-top">{{ key.keyName }}</view>
|
||||
<view class="key-status" :style="{ color: (key.keyStatus === 110401) ? '#63b8af' : '#df282d' }">
|
||||
{{ getKeyStatus(key.keyStatus) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="key-right-bottom">{{ key.timeText }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -67,7 +72,8 @@ export default {
|
||||
},
|
||||
async onLoad() {
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
this.deviceInfo = await this.getDeviceInfo()
|
||||
this.updateKeySearch({
|
||||
@ -80,7 +86,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']),
|
||||
...mapActions(useLockStore, ['getKeyList', 'updateCurrentKeyInfo', 'updateKeySearch']),
|
||||
...mapActions(useLockStore, ['getKeyList', 'updateCurrentKeyInfo', 'updateKeySearch', 'getKeyStatus']),
|
||||
toKeyDetail(key) {
|
||||
this.updateCurrentKeyInfo(key)
|
||||
this.routeJump({
|
||||
@ -195,7 +201,10 @@ export default {
|
||||
}
|
||||
},
|
||||
async changeSearch(data) {
|
||||
this.keySearch.searchStr = data
|
||||
this.updateKeySearch({
|
||||
...this.keySearch,
|
||||
searchStr: data
|
||||
})
|
||||
const { code, meesage } = await this.getKeyList(this.keySearch)
|
||||
},
|
||||
},
|
||||
@ -262,6 +271,7 @@ page {
|
||||
.key-right {
|
||||
margin-left: 32rpx;
|
||||
margin-right: 32rpx;
|
||||
width: 574rpx;
|
||||
|
||||
.key-right-top {
|
||||
font-size: 32rpx;
|
||||
@ -274,6 +284,12 @@ page {
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.key-status {
|
||||
margin-left: auto;
|
||||
font-size: 26rpx;
|
||||
color: #63b8af;
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
|
||||
@ -61,14 +61,15 @@
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useUserStore, ['isLogin'])
|
||||
...mapState(useUserStore, ['isLogin']),
|
||||
...mapState(useLockStore, ['lockSearch'])
|
||||
},
|
||||
async onLoad() {
|
||||
this.buttonInfo = await this.getButtonInfo()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['getButtonInfo', 'routeJump']),
|
||||
...mapActions(useLockStore, ['getLockList']),
|
||||
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
||||
...mapActions(useUserStore, ['updateLoginStatus', 'phoneLogin', 'updateUserInfo', 'getUserInfo', 'checkSession']),
|
||||
async changePhone(res) {
|
||||
if(res.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
||||
@ -91,10 +92,11 @@
|
||||
})
|
||||
if(code === 0) {
|
||||
uni.setStorageSync('token', data.accessToken)
|
||||
this.getLockList({
|
||||
pageNo: 1,
|
||||
pageSize: 50
|
||||
this.updateLockSearch({
|
||||
...that.lockSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
this.getLockList(this.lockSearch)
|
||||
uni.showToast({
|
||||
title: '账号切换成功',
|
||||
icon: 'none'
|
||||
|
||||
@ -25,24 +25,94 @@
|
||||
<view class="item-content">{{ timeFormat(currentPasswordInfo.sendDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
<view class="tips">密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。</view>
|
||||
<view class="button" @click="deletePassword">删除密码</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'pinia'
|
||||
import { mapActions, mapState } from 'pinia'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { deletePsaawordRequest } from '@/api/keyboardPwd'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useLockStore, ['currentPasswordInfo']),
|
||||
...mapState(useLockStore, ['currentPasswordInfo', 'passwordSearch']),
|
||||
...mapState(useBluetoothStore, ['currentLockInfo', 'keyId']),
|
||||
...mapState(useUserStore, ['userInfo']),
|
||||
},
|
||||
methods: {
|
||||
timeFormat
|
||||
},
|
||||
timeFormat,
|
||||
...mapActions(useBluetoothStore, ['setLockPassword']),
|
||||
...mapActions(useLockStore, ['updatePasswordSearch', 'getPasswordList']),
|
||||
async deletePassword () {
|
||||
const that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除该密码',
|
||||
async success(res) {
|
||||
if(res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '删除中',
|
||||
mask: true
|
||||
})
|
||||
const timestamp = parseInt(new Date().getTime() / 1000)
|
||||
const { code } = await that.setLockPassword({
|
||||
keyId: that.keyId.toString(),
|
||||
uid: that.userInfo.uid.toString(),
|
||||
pwdNo: that.currentPasswordInfo.pwdUserNo,
|
||||
operate: 3,
|
||||
isAdmin: that.currentPasswordInfo.pwdRight,
|
||||
pwd: that.currentPasswordInfo.keyboardPwd,
|
||||
userCountLimit: 0xFFFF,
|
||||
startTime: timestamp,
|
||||
endTime: timestamp
|
||||
})
|
||||
if(code === 0) {
|
||||
const { code: requestCode, message } = await deletePsaawordRequest({
|
||||
lockId: that.currentLockInfo.lockId,
|
||||
keyboardPwdId: that.currentPasswordInfo.keyboardPwdId,
|
||||
deleteType: 1
|
||||
})
|
||||
if(requestCode === 0) {
|
||||
uni.hideLoading()
|
||||
that.updatePasswordSearch({
|
||||
...that.passwordSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
that.getPasswordList(that.passwordSearch)
|
||||
uni.navigateBack({
|
||||
complete: () => {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '删除失败,请保持在锁附近',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -68,4 +138,16 @@ page {
|
||||
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>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<view class="search">
|
||||
<up-search shape="square" :searchIconSize="48" :inputStyle="{ fontSize: '32rpx' }" :height="80" placeholder="搜索"
|
||||
:clearabled="false" @change="changeSearch"
|
||||
v-model="search.searchStr" bgColor="#ffffff" :showAction="false" maxlength="20"></up-search>
|
||||
v-model="passwordSearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="20"></up-search>
|
||||
</view>
|
||||
<view style="padding: 32rpx 0 calc(env(safe-area-inset-bottom) + 250rpx) 0">
|
||||
<view v-if="passwordList.length === 0 && requestFinished">
|
||||
@ -48,11 +48,6 @@ import { deletePsaawordRequest, resetPsaawordListRequest } from '@/api/keyboardP
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
search: {
|
||||
pageNo: 1,
|
||||
pageSize: 50,
|
||||
searchStr: ''
|
||||
},
|
||||
deviceInfo: null,
|
||||
refresherTriggered: false,
|
||||
requestFinished: false,
|
||||
@ -67,22 +62,26 @@ export default {
|
||||
computed: {
|
||||
...mapState(useUserStore, ['userInfo']),
|
||||
...mapState(useBluetoothStore, ['currentLockInfo', 'keyId']),
|
||||
...mapState(useLockStore, ['passwordTotal', 'passwordList']),
|
||||
...mapState(useLockStore, ['passwordTotal', 'passwordList', 'passwordSearch']),
|
||||
},
|
||||
async onLoad() {
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
this.deviceInfo = await this.getDeviceInfo()
|
||||
this.search.lockStatus = this.currentLockInfo.lockStatus
|
||||
this.search.lockId = this.currentLockInfo.lockId
|
||||
const { code, meesage } = await this.getPasswordList(this.search)
|
||||
this.updatePasswordSearch({
|
||||
...this.passwordSearch,
|
||||
lockId: this.currentLockInfo.lockId,
|
||||
lockStatus: this.currentLockInfo.lockStatus
|
||||
})
|
||||
const { code, meesage } = await this.getPasswordList(this.passwordSearch)
|
||||
this.requestFinished = true
|
||||
uni.hideLoading()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']),
|
||||
...mapActions(useLockStore, ['getPasswordList', 'updateCurrentPasswordInfo']),
|
||||
...mapActions(useLockStore, ['getPasswordList', 'updateCurrentPasswordInfo', 'updatePasswordSearch']),
|
||||
...mapActions(useBluetoothStore, ['resetLockPassword', 'setLockPassword']),
|
||||
toPasswordDetail(password) {
|
||||
this.updateCurrentPasswordInfo(password)
|
||||
@ -128,8 +127,11 @@ export default {
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
that.search.pageNo = 1
|
||||
await that.getPasswordList(that.search)
|
||||
that.updatePasswordSearch({
|
||||
...that.passwordSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
await that.getPasswordList(that.passwordSearch)
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
@ -170,8 +172,11 @@ export default {
|
||||
title: '重置密码成功',
|
||||
icon: 'none'
|
||||
})
|
||||
that.search.pageNo = 1
|
||||
that.getPasswordList(that.search)
|
||||
that.updatePasswordSearch({
|
||||
...that.passwordSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
that.getPasswordList(that.passwordSearch)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
@ -195,8 +200,11 @@ export default {
|
||||
},
|
||||
async refresherList() {
|
||||
this.refresherTriggered = true
|
||||
this.search.pageNo = 1
|
||||
const { code, meesage } = await this.getPasswordList(this.search)
|
||||
this.updatePasswordSearch({
|
||||
...this.passwordSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
const { code, meesage } = await this.getPasswordList(this.passwordSearch)
|
||||
if(code === 0) {
|
||||
uni.showToast({
|
||||
title: '刷新成功',
|
||||
@ -206,22 +214,28 @@ export default {
|
||||
this.refresherTriggered = false
|
||||
},
|
||||
async nextPage() {
|
||||
if(this.passwordTotal <= this.search.pageNo * this.search.pageSize) {
|
||||
if(this.passwordTotal <= this.passwordSearch.pageNo * this.passwordSearch.pageSize) {
|
||||
return
|
||||
}
|
||||
const pageNo = this.search.pageNo + 1
|
||||
const pageNo = this.passwordSearch.pageNo + 1
|
||||
const params = {
|
||||
...this.search,
|
||||
...this.passwordSearch,
|
||||
pageNo
|
||||
}
|
||||
const { code, meesage } = await this.getPasswordList(params)
|
||||
if(code === 0) {
|
||||
this.search.pageNo = pageNo
|
||||
that.updatePasswordSearch({
|
||||
...that.passwordSearch,
|
||||
pageNo
|
||||
})
|
||||
}
|
||||
},
|
||||
async changeSearch(data) {
|
||||
this.search.searchStr = data
|
||||
const { code, meesage } = await this.getPasswordList(this.search)
|
||||
this.updatePasswordSearch({
|
||||
...this.passwordSearch,
|
||||
searchStr: data
|
||||
})
|
||||
const { code, meesage } = await this.getPasswordList(this.passwordSearch)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ export default {
|
||||
async connect(device) {
|
||||
uni.showLoading({
|
||||
title: '连接中',
|
||||
// mask: true
|
||||
mask: true
|
||||
})
|
||||
const { code: serverTimestampCode, message } = await this.updateServerTimestamp()
|
||||
if(serverTimestampCode !== 0) {
|
||||
|
||||
@ -58,17 +58,19 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapState(useUserStore, ['userInfo']),
|
||||
...mapState(useBluetoothStore, ['keyId', 'currentLockInfo'])
|
||||
...mapState(useBluetoothStore, ['keyId', 'currentLockInfo']),
|
||||
...mapState(useLockStore, ['lockSearch'])
|
||||
},
|
||||
onLoad() {
|
||||
this.unlockApp = this.currentLockInfo.lockSetting.appUnlockOnline
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBluetoothStore, ['resetDevice', 'updateCurrentLockInfo']),
|
||||
...mapActions(useLockStore, ['getLockList']),
|
||||
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
||||
async changeUnlockApp(value) {
|
||||
uni.showLoading({
|
||||
title: '更新中'
|
||||
title: '更新中',
|
||||
mask: true
|
||||
})
|
||||
const { code, message } = await updateLockSettingRequest({
|
||||
lockId: this.currentLockInfo.lockId,
|
||||
@ -100,7 +102,8 @@ export default {
|
||||
success: async function (res) {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '删除中'
|
||||
title: '删除中',
|
||||
mask: true
|
||||
})
|
||||
if(that.currentLockInfo.userType === 110301) {
|
||||
const { code: resetDeviceCode } = await that.resetDevice({
|
||||
@ -114,10 +117,11 @@ export default {
|
||||
})
|
||||
if(code === 0) {
|
||||
uni.hideLoading()
|
||||
that.getLockList({
|
||||
pageNo: 1,
|
||||
pageSize: 50
|
||||
that.updateLockSearch({
|
||||
...that.lockSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
that.getLockList(that.lockSearch)
|
||||
uni.navigateBack({
|
||||
delta: 2,
|
||||
complete: () => {
|
||||
@ -148,10 +152,11 @@ export default {
|
||||
})
|
||||
if(code === 0) {
|
||||
uni.hideLoading()
|
||||
that.getLockList({
|
||||
pageNo: 1,
|
||||
pageSize: 50
|
||||
that.updateLockSearch({
|
||||
...that.lockSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
that.getLockList(that.lockSearch)
|
||||
uni.navigateBack({
|
||||
delta: 2,
|
||||
complete: () => {
|
||||
|
||||
@ -14,12 +14,24 @@ export const useLockStore = defineStore('lock', {
|
||||
lockList: [],
|
||||
// 锁总数
|
||||
lockTotal: 0,
|
||||
// 锁列表搜索数据
|
||||
lockSearch: {
|
||||
pageNo: 1,
|
||||
pageSize: 50,
|
||||
searchStr: ''
|
||||
},
|
||||
// 密码列表
|
||||
passwordList: [],
|
||||
// 密码总数
|
||||
passwordTotal: 0,
|
||||
// 当前密码详情
|
||||
currentPasswordInfo: {},
|
||||
// 密码列表搜索数据
|
||||
passwordSearch: {
|
||||
pageNo: 1,
|
||||
pageSize: 50,
|
||||
searchStr: ''
|
||||
},
|
||||
// 电子钥匙总数
|
||||
keyTotal: 0,
|
||||
// 电子钥匙列表
|
||||
@ -33,12 +45,18 @@ export const useLockStore = defineStore('lock', {
|
||||
searchStr: '',
|
||||
endDate: '0',
|
||||
startDate: '0',
|
||||
keyStatus: [110401,110402],
|
||||
keyStatus: [110401,110402,110412],
|
||||
keyRight: 0
|
||||
},
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
updateLockSearch(search) {
|
||||
this.lockSearch = search
|
||||
},
|
||||
updatePasswordSearch(search) {
|
||||
this.passwordSearch = search
|
||||
},
|
||||
updateKeySearch(search) {
|
||||
this.keySearch = search
|
||||
},
|
||||
@ -55,6 +73,17 @@ export const useLockStore = defineStore('lock', {
|
||||
return '普通用户'
|
||||
}
|
||||
},
|
||||
getKeyStatus(keyStatus) {
|
||||
if(keyStatus === 110401) {
|
||||
return '正常'
|
||||
} else if(keyStatus === 110402) {
|
||||
return '待接收'
|
||||
} else if(keyStatus === 110412) {
|
||||
return '已过期'
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
getTimeLimit(keyType) {
|
||||
if(keyType === 1) {
|
||||
return '永久'
|
||||
|
||||
@ -37,10 +37,11 @@ export const useUserStore = defineStore('user', {
|
||||
if(code === 0) {
|
||||
uni.setStorageSync('token', data.accessToken)
|
||||
this.getUserInfo()
|
||||
useLockStore().getLockList({
|
||||
pageNo: 1,
|
||||
pageSize: 50
|
||||
useLockStore().updateLockSearch({
|
||||
...useLockStore().lockSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
useLockStore().getLockList(useLockStore().lockSearch)
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user