Merge branch 'fanpeng' into 'master'

1. 修复webview显示bug

See merge request StarlockTeam/wx-starlock!4
This commit is contained in:
范鹏 2024-09-04 03:10:23 +00:00
commit 6bdde099e0
20 changed files with 525 additions and 127 deletions

View File

@ -3,7 +3,7 @@
<view class="name">
<view class="name-text">{{ title }}</view>
<input :value="value" class="name-input" :placeholder="placeholder" placeholder-class="placeholder-class"
maxlength="16" @input="changeInput"></input>
maxlength="50" @input="changeInput"></input>
</view>
</view>
</template>

View File

@ -20,7 +20,7 @@ const DEV = {
const PRE = {
name: 'pre',
baseUrl: 'https://pre.lock.star-lock.cn/api',
webviewBaseUrl: 'https://pre.lock.star-lock.cn',
webviewBaseUrl: 'https://lock.xhjcn.ltd',
version,
buildNumber
}

View File

@ -3,7 +3,7 @@
"appid" : "__UNI__933D519",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"versionCode" : "2",
"transformPx" : false,
/* */
"mp-weixin" : {

View File

@ -1,7 +1,7 @@
<template>
<view>
<view class="text">如需修改名字请重新命名点击确定添加锁</view>
<input class="input" :value="name" maxlength="32" placeholder="请输入名称" placeholder-class="input-placeholder"
<input class="input" :value="name" maxlength="50" placeholder="请输入名称" placeholder-class="input-placeholder"
@input="uopdateName"
></input>
<view class="button" @click="bindLock">确定</view>
@ -72,10 +72,14 @@ export default {
role: 0xff,
password
})
if(addUserCode !== 0) {
if(addUserCode === 0) {
} else if(addUserCode === -1) {
uni.hideLoading()
this.backAndToast('添加失败,请重试')
return
} else {
uni.hideLoading()
return
}
const params = {
lockAlias: this.name,

View File

@ -34,7 +34,18 @@
</view>
</view>
<view class="lock-name">{{lock.lockAlias}}</view>
<view class="lock-time">
<view style="display: flex;align-items: center">
<view v-if="lock.keyStatus === 110412" class="lock-status">已过期</view>
<view v-if="lock.days" class="lock-status" style="background-color: #63b8af">{{lock.days}}</view>
<view v-if="lock.keyStatus === 110403" class="lock-status" style="background-color: #63b8af">未生效</view>
<view v-if="lock.keyStatus === 110405" class="lock-status">已冻结</view>
<view v-if="lock.lockSetting.remoteUnlock === 1" class="lock-status" style="background-color:
#63b8af">远程开锁
</view>
</view>
<view class="lock-time"
:style="{padding: lock.keyStatus === 110401 && !lock.days ? '12rpx 24rpx 0 24rpx'
:'6rpx 24rpx 0 24rpx'}">
<view v-if="lock.keyType === 1 || lock.keyType === 3" style="font-size: 32rpx">{{
getTimeLimit(lock.keyType) }}</view>
<view v-else>
@ -226,6 +237,20 @@
this.getBluetoothStatus()
return
}
if(lock.keyStatus === 110412) {
uni.showToast({
title: '钥匙已过期',
icon: 'none'
})
return
}
if(lock.keyStatus === 110405) {
uni.showToast({
title: '钥匙已冻结',
icon: 'none'
})
return
}
let result = true
if(!this.isInitBluetooth) {
result = await this.initAndListenBluetooth()
@ -308,6 +333,7 @@ page {
font-size: 32rpx;
font-weight: bold;
word-break: break-all;
line-height: 38rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
@ -318,7 +344,7 @@ page {
}
.lock-time {
padding: 12rpx 24rpx 0 24rpx;
padding: 6rpx 24rpx 0 24rpx;
font-size: 22rpx;
font-weight: bold;
}
@ -398,4 +424,16 @@ page {
font-size: 28rpx;
color: #999999;
}
.lock-status {
margin-left: 24rpx;
color: #FFFFFF;
border-radius: 8rpx;
font-size: 22rpx;
font-weight: bold;
display: inline-block;
padding: 4rpx 8rpx;
background-color: #ecab1f;
text-align: center;
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<view>
<view class="item">
<view class="item-title">名称</view>
<view class="item-title" style="width: 350rpx">名称</view>
<view class="item-content">{{ currentKeyInfo.keyName }}</view>
</view>
<view class="item" style="margin-top: 2rpx">
@ -24,7 +24,7 @@
<view class="item" v-if="currentKeyInfo.keyType === 4" style="margin-top: 2rpx">
<view class="item-title">有效时间</view>
<view class="item-content">
{{ timeFormat(currentKeyInfo.startDate, 'h:M') }}-{{ timeFormat(currentKeyInfo.endDate, 'h:M') }}
{{ timeFormat(currentKeyInfo.startDate, 'h:M') }}{{ timeFormat(currentKeyInfo.endDate, 'h:M') }}
</view>
</view>
<view class="item" style="margin-top: 20rpx">
@ -40,6 +40,15 @@
<view class="item-content">{{ timeFormat(currentKeyInfo.sendDate, 'yyyy-mm-dd h:M') }}</view>
</view>
<view class="button" @click="deleteKey">删除钥匙</view>
<up-modal :show="showModal" title="是否删除授权管理员钥匙?" :showCancelButton="true" width="600rpx" @cancel="cancelModal"
@confirm="confirmModal">
<view class="slot-content" @click="changeRadio">
<view style="display: flex;align-items: center;">
<radio :checked="checked"></radio>
<view>同时删除其发送的所有钥匙钥匙删除后不能恢复</view>
</view>
</view>
</up-modal>
</view>
</template>
@ -52,17 +61,58 @@ import { useBasicStore } from '@/stores/basic'
export default {
data () {
return {}
return {
showModal: false,
checked: false
}
},
computed: {
...mapState(useLockStore, ['currentKeyInfo', 'keySearch']),
},
methods: {
timeFormat,
...mapActions(useLockStore, ['updateKeySearch', 'getKeyList']),
...mapActions(useLockStore, ['updateKeySearch', 'getKeyList', 'convertWeekDaysToChineseString']),
...mapActions(useBasicStore, ['backAndToast']),
cancelModal() {
this.showModal = false
this.checked = false
},
changeRadio() {
this.checked = !this.checked
},
async confirmModal() {
uni.showLoading({
title: '删除中',
mask: true
})
const that = this
const { code } = await deleteKeyRequest({
keyId: that.currentKeyInfo.keyId,
includeUnderlings: that.checked ? 1 : 0
})
that.showModal = false
if(code === 0) {
that.updateKeySearch({
...that.keySearch,
pageNo: 1
})
that.getKeyList(that.keySearch)
uni.hideLoading()
that.backAndToast('删除成功')
} else {
uni.hideLoading()
uni.showToast({
title: 'message',
icon: 'none'
})
}
},
async deleteKey () {
const that = this
if(that.currentKeyInfo.keyRight === 1) {
that.showModal = true
return
}
uni.showModal({
title: '提示',
content: '确定要删除该钥匙',
@ -93,21 +143,6 @@ export default {
}
}
})
},
convertWeekDaysToChineseString(weekDays) {
const dayMap = {
1: '一',
2: '二',
3: '三',
4: '四',
5: '五',
6: '六',
7: '日'
}
const chineseWeekDays = weekDays.map(day => dayMap[day])
return chineseWeekDays.join('')
}
}
}

View File

@ -20,8 +20,11 @@
<view class="key" @click="toKeyDetail(key)">
<image class="key-left" :src="key.headUrl" mode="aspectFill"></image>
<view class="key-right">
<view style="display: flex; align-items: center">
<view style="display: flex;">
<view class="key-right-top">{{ key.keyName }}</view>
<image class="key-admin" mode="aspectFill" v-if="key.keyRight === 1 && key.lockSetting.remoteUnlock
=== 1" src="/static/images/icon_remote_unlock.png"></image>
<image class="key-admin" mode="aspectFill" v-if="key.keyRight === 1" src="/static/images/icon_admin.png"></image>
<view class="key-status" :style="{ color: (key.keyStatus === 110401) ? '#63b8af' : '#df282d' }">
{{ getKeyStatus(key.keyStatus) }}
</view>
@ -39,6 +42,15 @@
<view class="button-reset" @click="resetKey">重置钥匙</view>
<view class="button-create" @click="toCreateKey">发送钥匙</view>
</view>
<up-modal :show="showModal" title="是否删除授权管理员钥匙?" :showCancelButton="true" width="600rpx" @cancel="cancelModal"
@confirm="confirmModal">
<view class="slot-content" @click="changeRadio">
<view style="display: flex;align-items: center;">
<radio :checked="checked"></radio>
<view>同时删除其发送的所有钥匙钥匙删除后不能恢复</view>
</view>
</view>
</up-modal>
</view>
</template>
@ -54,6 +66,8 @@ import { deleteKeyRequest, resetKeyRequest } from '@/api/key'
export default {
data () {
return {
showModal: false,
checked: false,
deviceInfo: null,
refresherTriggered: false,
requestFinished: false,
@ -62,7 +76,8 @@ export default {
style: {
backgroundColor: '#f56c6c'
}
}]
}],
deleteKeyId: ''
}
},
computed: {
@ -87,6 +102,43 @@ export default {
methods: {
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']),
...mapActions(useLockStore, ['getKeyList', 'updateCurrentKeyInfo', 'updateKeySearch', 'getKeyStatus']),
changeRadio() {
this.checked = !this.checked
},
async confirmModal() {
uni.showLoading({
title: '删除中',
mask: true
})
const that = this
const { code } = await deleteKeyRequest({
keyId: that.deleteKeyId,
includeUnderlings: that.checked ? 1 : 0
})
that.showModal = false
if(code === 0) {
that.updateKeySearch({
...that.keySearch,
pageNo: 1
})
that.getKeyList(that.keySearch)
uni.hideLoading()
uni.showToast({
title: '删除成功',
icon: 'none'
})
} else {
uni.hideLoading()
uni.showToast({
title: 'message',
icon: 'none'
})
}
},
cancelModal() {
this.showModal = false
this.checked = false
},
toKeyDetail(key) {
this.updateCurrentKeyInfo(key)
this.routeJump({
@ -98,6 +150,11 @@ export default {
const that = this
let index = this.keyList.findIndex(item => item.keyId === key.keyId)
that.$refs.swipeItem[index].closeHandler()
if(data.keyRight === 1) {
this.deleteKeyId = key.keyId
this.showModal = true
return
}
uni.showModal({
title: '提示',
content: '确定要删除该钥匙',
@ -134,6 +191,13 @@ export default {
},
async resetKey() {
const that = this
if(that.keyList.length === 0) {
uni.showToast({
title: '暂无钥匙,无需重置',
icon: 'none'
})
return
}
uni.showModal({
title: '提示',
content: '确定要重置钥匙,该锁的所有钥匙都将被删除',
@ -274,9 +338,20 @@ page {
width: 574rpx;
.key-right-top {
max-width: 450rpx;
font-size: 32rpx;
font-weight: bold;
padding-bottom: 6rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.key-admin {
margin-top: 8rpx;
margin-left: 10rpx;
width: 25rpx;
height: 25rpx;
}
.key-right-bottom {
@ -286,6 +361,7 @@ page {
}
.key-status {
margin-top: 4rpx;
margin-left: auto;
font-size: 26rpx;
color: #63b8af;

View File

@ -1,5 +1,7 @@
<template>
<view>
<view class="days" v-if="currentLockInfo.days">钥匙将在{{ currentLockInfo.days }}天后失效</view>
<view class="lock-name">{{ currentLockInfo.lockAlias }}</view>
<view class="top">
<image class="top-background" src="/static/images/background_main.jpg" mode="aspectFill"></image>
<view style="width: 100%;height: 50rpx">
@ -80,9 +82,6 @@ export default {
SwitchLoading
},
onLoad() {
uni.setNavigationBarTitle({
title: this.currentLockInfo.lockAlias
})
this.getServeTime()
},
methods: {
@ -127,6 +126,10 @@ export default {
uni.vibrateLong()
this.pending = true
this.$refs.loading.open()
uni.showToast({
title: `正在尝试${type === 'close' ? '关' : '开'}锁……`,
icon: 'none'
})
if(this.currentLockInfo.lockSetting.appUnlockOnline) {
const result = await this.getNetToken()
if(!result) {
@ -153,30 +156,30 @@ export default {
title: `${type === 'close' ? '关' : '开'}锁成功`,
icon: 'none'
})
if(this.currentLockInfo.keyType === 3) {
const { code: deleteKeyCode } = await deleteKeyRequest({
keyId: this.keyId
})
if(deleteKeyCode === 0) {
this.updateLockSearch({
...this.lockSearch,
pageNo: 1
})
this.getLockList(this.lockSearch)
this.backAndToast('单次钥匙已在被使用后删除', 1)
}
}
} else if(code === 13) {
uni.showToast({
title: `只能在循环时间内操作门锁`,
icon: 'none'
})
} else {
} else if(code === -1) {
uni.showToast({
title: `${type === 'close' ? '关' : '开'}锁失败,请保证在锁附近`,
icon: 'none'
})
}
if(this.currentLockInfo.keyType === 3) {
const { code: deleteKeyCode } = await deleteKeyRequest({
keyId: this.keyId
})
if(deleteKeyCode === 0) {
this.updateLockSearch({
...this.lockSearch,
pageNo: 1
})
this.getLockList(this.lockSearch)
this.backAndToast('单次钥匙已在被使用后删除', 1)
}
}
this.$refs.loading.close()
this.pending = false
}
@ -185,6 +188,23 @@ export default {
</script>
<style lang="scss" scoped>
.days {
line-height: 60rpx;
background: #faecc9;
color: #bc9839;
text-align: center;
font-size: 32rpx;
width: 750rpx;
height: 60rpx;
}
.lock-name {
text-align: center;
font-size: 32rpx;
padding: 32rpx 32rpx 0 32rpx;
font-weight: bold;
}
.top {
margin-top: 32rpx;
margin-left: 32rpx;

View File

@ -137,6 +137,8 @@
title: '账号切换成功',
icon: 'none'
})
} else if(code === 438) {
} else {
uni.showToast({
title: message,
@ -274,7 +276,7 @@ page {
}
.tips {
margin-top: 35vh;
margin-top: 25vh;
padding: 32rpx 0;
text-align: center;
font-size: 28rpx;

View File

@ -99,12 +99,14 @@ export default {
icon: 'none'
})
}
} else {
} else if(code === -1) {
uni.hideLoading()
uni.showToast({
title: '删除失败,请保持在锁附近',
icon: 'none'
})
} else {
uni.hideLoading()
}
}
}

View File

@ -20,7 +20,12 @@
<view class="password" @click="toPasswordDetail(password)">
<image class="password-left" src="/static/images/icon_lock_transparent.png" mode="aspectFill"></image>
<view class="password-right">
<view class="password-right-top">{{ password.keyboardPwdName }}</view>
<view style="display: flex; align-items: center">
<view class="password-right-top">{{ password.keyboardPwdName }}</view>
<view class="key-status">
{{ getPasswordStatus(password.keyboardPwdStatus) }}
</view>
</view>
<view class="password-right-bottom">{{ password.timeText }}</view>
</view>
</view>
@ -81,7 +86,7 @@ export default {
},
methods: {
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']),
...mapActions(useLockStore, ['getPasswordList', 'updateCurrentPasswordInfo', 'updatePasswordSearch']),
...mapActions(useLockStore, ['getPasswordList', 'updateCurrentPasswordInfo', 'updatePasswordSearch', 'getPasswordStatus']),
...mapActions(useBluetoothStore, ['resetLockPassword', 'setLockPassword']),
toPasswordDetail(password) {
this.updateCurrentPasswordInfo(password)
@ -139,12 +144,14 @@ export default {
icon: 'none'
})
}
} else {
} else if(code === -1) {
uni.hideLoading()
uni.showToast({
title: '删除失败,请保持在锁附近',
icon: 'none'
})
} else {
uni.hideLoading()
}
}
}
@ -152,11 +159,22 @@ export default {
},
async resetPassword() {
const that = this
if(this.passwordList.length === 0) {
uni.showToast({
title: '暂无密码,无需重置',
icon: 'none'
})
return
}
uni.showModal({
title: '提示',
content: '确定要重置密码,该锁的所有密码都将被删除',
async success(res) {
if(res.confirm) {
uni.showLoading({
title: '重置中',
mask: true
})
const { code } = await that.resetLockPassword({
uid: that.userInfo.uid.toString(),
keyId: that.currentLockInfo.keyId.toString()
@ -168,6 +186,7 @@ export default {
})
console.log('重置密码返回', requestCode, message)
if(requestCode === 0) {
uni.hideLoading()
uni.showToast({
title: '重置密码成功',
icon: 'none'
@ -178,16 +197,20 @@ export default {
})
that.getPasswordList(that.passwordSearch)
} else {
uni.hideLoading()
uni.showToast({
title: message,
icon: 'none'
})
}
} else {
} else if(code === -1) {
uni.hideLoading()
uni.showToast({
title: '重置密码失败,请保持在锁附近',
icon: 'none'
})
} else {
uni.hideLoading()
}
}
}
@ -299,12 +322,13 @@ page {
.password-right {
margin-right: 32rpx;
margin-left: 32rpx;
width: 574rpx;
.password-right-top {
font-size: 32rpx;
font-weight: bold;
padding-bottom: 10rpx;
width: 600rpx;
padding-bottom: 6rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@ -335,4 +359,10 @@ page {
font-size: 32rpx;
color: #999999;
}
.key-status {
margin-left: auto;
font-size: 26rpx;
color: #df282d;
}
</style>

View File

@ -2,11 +2,12 @@
<view>
<view class="view">
<view class="view-button">
<view>名称</view>
<view class="view-button" style="padding: 0">
<view class="info">{{currentLockInfo.lockAlias}}</view>
<view style="width: 350rpx">名称</view>
<view class="view-button" style="padding: 20rpx 0">
<view class="info" style="line-height: 40rpx">{{currentLockInfo.lockAlias}}</view>
</view>
</view>
<view class="view-line"></view>
<view class="view-button">
<view>锁编号</view>
<view class="view-button" style="padding: 0">
@ -17,7 +18,7 @@
<view class="view-button">
<view>MAC/ID</view>
<view class="view-button" style="padding: 0">
<view class="info">{{currentLockInfo.mac}}</view>
<view class="info">{{currentLockInfo.mac}}/{{currentLockInfo.lockId}}</view>
</view>
</view>
<view class="view-line"></view>
@ -37,7 +38,50 @@
</view>
</view>
</view>
<view class="view" v-if="currentLockInfo.keyType === 2 || currentLockInfo.keyType === 4">
<view v-if="currentLockInfo.keyType === 2">
<view class="view-button">
<view>有效期</view>
<view class="view-button" style="padding: 0">
<view class="info">{{ timeFormat(currentLockInfo.startDate, 'yyyy-mm-dd h:M') }}{{
timeFormat(currentLockInfo.endDate, 'yyyy-mm-dd h:M') }}</view>
</view>
</view>
</view>
<view v-if="currentLockInfo.keyType === 4">
<view class="view-button">
<view>有效期</view>
<view class="view-button" style="padding: 0">
<view class="info">{{ timeFormat(currentLockInfo.startDate, 'yyyy-mm-dd') }}{{ timeFormat(currentLockInfo.endDate, 'yyyy-mm-dd') }}</view>
</view>
</view>
<view class="view-line"></view>
<view class="view-button">
<view>有效日</view>
<view class="view-button" style="padding: 0">
<view class="info">{{ convertWeekDaysToChineseString(currentLockInfo.weekDays) }}</view>
</view>
</view>
<view class="view-line"></view>
<view class="view-button">
<view>有效时间</view>
<view class="view-button" style="padding: 0">
<view class="info">{{ timeFormat(currentLockInfo.startDate, 'h:M') }}{{
timeFormat(currentLockInfo.endDate, 'h:M') }}</view>
</view>
</view>
</view>
</view>
<view class="button-logout" @click="deleteLock">删除</view>
<up-modal :show="showModal" title="是否删除授权管理员钥匙?" :showCancelButton="true" width="600rpx" @cancel="cancelModal"
@confirm="confirmModal">
<view class="slot-content" @click="changeRadio">
<view style="display: flex;align-items: center;">
<radio :checked="checked"></radio>
<view>同时删除其发送的所有钥匙钥匙删除后不能恢复</view>
</view>
</view>
</up-modal>
</view>
</template>
@ -50,11 +94,14 @@ import { useLockStore } from '@/stores/lock'
import { updateLockSettingRequest } from '@/api/lockSetting'
import { deleteKeyRequest } from '@/api/key'
import { useBasicStore } from '@/stores/basic'
import { timeFormat } from 'uview-plus'
export default {
data () {
return {
unlockApp: 0
unlockApp: 0,
showModal: false,
checked: false
}
},
computed: {
@ -66,9 +113,44 @@ export default {
this.unlockApp = this.currentLockInfo.lockSetting.appUnlockOnline
},
methods: {
timeFormat,
...mapActions(useBluetoothStore, ['resetDevice', 'updateCurrentLockInfo']),
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
...mapActions(useLockStore, ['getLockList', 'updateLockSearch', 'convertWeekDaysToChineseString']),
...mapActions(useBasicStore, ['backAndToast']),
changeRadio() {
this.checked = !this.checked
},
cancelModal() {
this.showModal = false
this.checked = false
},
async confirmModal() {
uni.showLoading({
title: '删除中',
mask: true
})
const that = this
const { code } = await deleteKeyRequest({
keyId: that.keyId,
includeUnderlings: that.checked ? 1 : 0
})
that.showModal = false
if(code === 0) {
uni.hideLoading()
that.updateLockSearch({
...that.lockSearch,
pageNo: 1
})
that.getLockList(that.lockSearch)
that.backAndToast('删除成功', 2)
} else {
uni.hideLoading()
uni.showToast({
title: 'message',
icon: 'none'
})
}
},
async changeUnlockApp(value) {
uni.showLoading({
title: '更新中',
@ -98,9 +180,14 @@ export default {
},
deleteLock() {
const that = this
if(this.currentLockInfo.userType !== 110301 && this.currentLockInfo.keyRight === 1) {
this.showModal = true
return
}
const message = that.currentLockInfo.userType === 110301 ? '删除锁后,所有信息都会一起删除,确定删除锁吗?' : '确定删除该钥匙吗?'
uni.showModal({
title: '提示',
content: '确定删除该门锁吗?',
content: message,
success: async function (res) {
if (res.confirm) {
uni.showLoading({
@ -133,12 +220,14 @@ export default {
icon: 'none'
})
}
} else {
} else if(code === -1) {
uni.hideLoading()
uni.showToast({
title: '删除失败',
title: '删除失败,请保持在锁附近',
icon: 'none'
})
} else {
uni.hideLoading()
}
} else {
const { code } = await deleteKeyRequest({
@ -214,4 +303,21 @@ page {
height: 3rpx;
background: #EBEBEB;
}
radio .wx-radio-input.wx-radio-input-checked {
border: none;
background: #c1885a;
}
radio .wx-radio-input.wx-radio-input-checked::before {
border-radius: 50%; /* 圆角 */
width: 28rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
height: 28rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
line-height: 28rpx;
text-align: center;
font-size: 20rpx; /* 对勾大小 30rpx */
color: #fff; /* 对勾颜色 白色 */
background: #c1885a;
transform: translate(-50%, -50%) scale(1);
}
</style>

View File

@ -1,5 +1,6 @@
<template>
<view>
<view class="tips">找回密码和登录新设备时可通过绑定的邮箱验证</view>
<input class="input-email" :value="email" placeholder="请输入邮箱"
placeholder-class="input-placeholder" :focus="true" @input="updateInputEmail"></input>
<view class="view-top">
@ -139,6 +140,12 @@ page {
</style>
<style scoped lang="scss">
.tips {
padding: 24rpx 32rpx 0 32rpx;
font-size: 28rpx;
color: #999999;
}
.input-email {
border-radius: 16rpx;
background: #FFFFFF;

View File

@ -1,6 +1,6 @@
<template>
<view>
<input class="input" :value="nickname" maxlength="20" placeholder="请输入昵称"
<input class="input" :value="nickname" maxlength="50" placeholder="请输入昵称"
placeholder-class="input-placeholder" :focus="true" @input="updateInput"></input>
<view class="button" @click="updateName">保存</view>
</view>

View File

@ -13,8 +13,8 @@
<view class="view-line"></view>
<view class="view-button" @click="toUpdateName">
<view>昵称</view>
<view class="view-button" style="padding: 0">
<view class="info">{{userInfo.nickname}}</view>
<view class="view-button" style="padding: 20rpx 0">
<view class="name-info">{{userInfo.nickname}}</view>
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
</view>
</view>
@ -107,6 +107,13 @@ export default {
title: '更换成功',
icon: 'none'
})
} else if(code === 421) {
uni.showToast({
title: '手机号已被其他账号绑定',
icon: 'none'
})
} else if(code === 438) {
} else {
uni.showToast({
title: message,
@ -257,6 +264,16 @@ page {
margin-right: 20rpx;
}
.name-info {
line-height: 40rpx;
font-size: 30rpx;
text-align: right;
width: 500rpx;
overflow: hidden;
word-break: break-all;
margin-right: 20rpx;
}
.red-dot {
margin-right: 20rpx;
background: #ec433c;

View File

@ -5,16 +5,17 @@
</template>
<script>
import baseConfig from '@/config/env'
import env from '@/config/env'
export default {
data() {
return {
url: ''
url: '',
env: null
}
},
onLoad: function (options) {
console.log(baseConfig.webviewBaseUrl)
this.env = env[getApp().globalData.getEnvConfig()]
const officialAccounts = {
default: {
url: '/app/introduce',
@ -30,7 +31,7 @@ export default {
}
}
const item = officialAccounts[options?.type] || officialAccounts['default']
this.url = baseConfig.webviewBaseUrl + item['url']
this.url = this.env.webviewBaseUrl + item['url']
console.log(this.url)
uni.setNavigationBarTitle({
title: item['name']

BIN
static/images/icon_admin.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -737,7 +737,7 @@ export const useBluetoothStore = defineStore('ble', {
timer2 = setTimeout(() => {
uni.stopBluetoothDevicesDiscovery()
clearInterval(timer1)
resolve(false)
resolve({ code: -1 })
}, 10500)
timer1 = setInterval(() => {
uni.getBluetoothDevices({
@ -750,7 +750,24 @@ export const useBluetoothStore = defineStore('ble', {
uni.stopBluetoothDevicesDiscovery()
clearTimeout(timer2)
clearInterval(timer1)
resolve(deviceList[i].deviceId)
resolve({
code: 0,
data: {
deviceId: deviceList[i].deviceId
}
})
break
} else if(uuid && uuid.slice(2,8)==='758824' && uuid.slice(30,32)==='00') {
uni.stopBluetoothDevicesDiscovery()
clearTimeout(timer2)
clearInterval(timer1)
uni.showToast({
title: '锁已被重置,请重新绑定',
icon: 'none'
})
resolve({
code: -2
})
break
}
}
@ -772,8 +789,28 @@ export const useBluetoothStore = defineStore('ble', {
// 重新初始化蓝牙适配器
await that.initBluetooth()
that.searchAndConnectDevice()
} else if(res.errno === 1509008) {
uni.showModal({
title: '提示',
content: '安卓手机蓝牙功能需要定位权限,请前往设置开启微信的定位权限后再试',
showCancel: false,
success(res) {
if (res.confirm) {
uni.openAppAuthorizeSetting({
success (res) {
console.log(res)
}
})
}
}
})
resolve({
code: -1
})
} else {
resolve(false)
resolve({
code: -1
})
}
}
})
@ -947,16 +984,14 @@ export const useBluetoothStore = defineStore('ble', {
// 确认设备连接正常
if(!this.currentLockInfo.connected) {
const srerchResult = await this.searchAndConnectDevice()
if(srerchResult.code !== 0) {
return srerchResult
}
this.updateCurrentLockInfo({
...this.currentLockInfo,
deviceId: srerchResult
deviceId: srerchResult.data.deviceId
})
console.log('设备ID', this.currentLockInfo.deviceId)
if(!srerchResult) {
return {
code: -1
}
}
const result = await this.connectBluetoothDevice()
console.log('连接结果', result)
if(!result) {
@ -995,16 +1030,14 @@ export const useBluetoothStore = defineStore('ble', {
// 确认设备连接正常
if(!this.currentLockInfo.connected) {
const srerchResult = await this.searchAndConnectDevice()
if(srerchResult.code !== 0) {
return srerchResult
}
this.updateCurrentLockInfo({
...this.currentLockInfo,
deviceId: srerchResult
deviceId: srerchResult.data.deviceId
})
console.log('设备ID', this.currentLockInfo.deviceId)
if(!srerchResult) {
return {
code: -1
}
}
const result = await this.connectBluetoothDevice()
console.log('连接结果', result)
if(!result) {
@ -1077,16 +1110,14 @@ export const useBluetoothStore = defineStore('ble', {
// 确认设备连接正常
if(!this.currentLockInfo.connected) {
const srerchResult = await this.searchAndConnectDevice()
if(srerchResult.code !== 0) {
return srerchResult
}
this.updateCurrentLockInfo({
...this.currentLockInfo,
deviceId: srerchResult
deviceId: srerchResult.data.deviceId
})
console.log('设备ID', this.currentLockInfo.deviceId)
if(!srerchResult) {
return {
code: -1
}
}
const result = await this.connectBluetoothDevice()
console.log('连接结果', result)
if(!result) {
@ -1148,16 +1179,14 @@ export const useBluetoothStore = defineStore('ble', {
// 确认设备连接正常
if(!this.currentLockInfo.connected) {
const srerchResult = await this.searchAndConnectDevice()
if(srerchResult.code !== 0) {
return srerchResult
}
this.updateCurrentLockInfo({
...this.currentLockInfo,
deviceId: srerchResult
deviceId: srerchResult.data.deviceId
})
console.log('设备ID', this.currentLockInfo.deviceId)
if(!srerchResult) {
return {
code: -1
}
}
const result = await this.connectBluetoothDevice()
console.log('连接结果', result)
if(!result) {
@ -1267,16 +1296,14 @@ export const useBluetoothStore = defineStore('ble', {
// 确认设备连接正常
if(!this.currentLockInfo.connected) {
const srerchResult = await this.searchAndConnectDevice()
if(srerchResult.code !== 0) {
return srerchResult
}
this.updateCurrentLockInfo({
...this.currentLockInfo,
deviceId: srerchResult
deviceId: srerchResult.data.deviceId
})
console.log('设备ID', this.currentLockInfo.deviceId)
if(!srerchResult) {
return {
code: -1
}
}
const result = await this.connectBluetoothDevice()
console.log('连接结果', result)
if(!result) {
@ -1350,16 +1377,14 @@ export const useBluetoothStore = defineStore('ble', {
// 确认设备连接正常
if(!this.currentLockInfo.connected) {
const srerchResult = await this.searchAndConnectDevice()
if(srerchResult.code !== 0) {
return srerchResult
}
this.updateCurrentLockInfo({
...this.currentLockInfo,
deviceId: srerchResult
deviceId: srerchResult.data.deviceId
})
console.log('设备ID', this.currentLockInfo.deviceId)
if(!srerchResult) {
return {
code: -1
}
}
const result = await this.connectBluetoothDevice()
console.log('连接结果', result)
if(!result) {
@ -1431,16 +1456,14 @@ export const useBluetoothStore = defineStore('ble', {
// 确认设备连接正常
if(!this.currentLockInfo.connected) {
const srerchResult = await this.searchAndConnectDevice()
if(srerchResult.code !== 0) {
return srerchResult
}
this.updateCurrentLockInfo({
...this.currentLockInfo,
deviceId: srerchResult
deviceId: srerchResult.data.deviceId
})
console.log('设备ID', this.currentLockInfo.deviceId)
if(!srerchResult) {
return {
code: -1
}
}
const result = await this.connectBluetoothDevice()
console.log('连接结果', result)
if(!result) {
@ -1501,16 +1524,14 @@ export const useBluetoothStore = defineStore('ble', {
// 确认设备连接正常
if(!this.currentLockInfo.connected) {
const srerchResult = await this.searchAndConnectDevice()
if(srerchResult.code !== 0) {
return srerchResult
}
this.updateCurrentLockInfo({
...this.currentLockInfo,
deviceId: srerchResult
deviceId: srerchResult.data.deviceId
})
console.log('设备ID', this.currentLockInfo.deviceId)
if(!srerchResult) {
return {
code: -1
}
}
const result = await this.connectBluetoothDevice()
console.log('连接结果', result)
if(!result) {
@ -1579,16 +1600,14 @@ export const useBluetoothStore = defineStore('ble', {
// 确认设备连接正常
if(!this.currentLockInfo.connected) {
const srerchResult = await this.searchAndConnectDevice()
if(srerchResult.code !== 0) {
return srerchResult
}
this.updateCurrentLockInfo({
...this.currentLockInfo,
deviceId: srerchResult
deviceId: srerchResult.data.deviceId
})
console.log('设备ID', this.currentLockInfo.deviceId)
if(!srerchResult) {
return {
code: -1
}
}
const result = await this.connectBluetoothDevice()
console.log('连接结果', result)
if(!result) {

View File

@ -45,12 +45,27 @@ export const useLockStore = defineStore('lock', {
searchStr: '',
endDate: '0',
startDate: '0',
keyStatus: [110401,110402,110412],
keyStatus: [110401, 110402, 110412, 110405, 110403],
keyRight: 0
},
}
},
actions: {
convertWeekDaysToChineseString(weekDays) {
const dayMap = {
1: '一',
2: '二',
3: '三',
4: '四',
5: '五',
6: '六',
7: '日'
}
const chineseWeekDays = weekDays.map(day => dayMap[day])
return chineseWeekDays.join('')
},
updateLockSearch(search) {
this.lockSearch = search
},
@ -78,10 +93,23 @@ export const useLockStore = defineStore('lock', {
getKeyStatus(keyStatus) {
if(keyStatus === 110401) {
return '正常'
} else if(keyStatus === 110403) {
return '未生效'
} else if(keyStatus === 110402) {
return '待接收'
} else if(keyStatus === 110412) {
return '已过期'
} else if(keyStatus === 110405) {
return '已冻结'
} else {
return ''
}
},
getPasswordStatus(passwordStatus) {
if(passwordStatus === 2) {
return '已过期'
} else if(passwordStatus === 3) {
return '未生效'
} else {
return ''
}
@ -101,6 +129,19 @@ export const useLockStore = defineStore('lock', {
const { code, data, message } = await getLockListRequest(params)
if(code === 0) {
this.lockTotal = data.total
for(let i = 0; i < data.groupList.length; i++) {
for (let j = 0; j < data.groupList[i].lockList.length; j++) {
if((data.groupList[i].lockList[j].keyType === 2 || data.groupList[i].lockList[j].keyType === 4) && data.groupList[i].lockList[j].keyStatus === 110401) {
const now = new Date().getTime()
const diffInMilliseconds = data.groupList[i].lockList[j].endDate - now
const millisecondsPerDay = 24 * 60 * 60 * 1000
const diffInDays = Math.floor(diffInMilliseconds / millisecondsPerDay)
if(diffInDays > 0 && diffInDays <= 15) {
data.groupList[i].lockList[j].days = diffInDays
}
}
}
}
if(params.pageNo === 1) {
this.lockList = data.groupList
} else {