diff --git a/components/LockInput/LockInput.vue b/components/LockInput/LockInput.vue
index 056de2d..7ecf326 100644
--- a/components/LockInput/LockInput.vue
+++ b/components/LockInput/LockInput.vue
@@ -3,7 +3,7 @@
{{ title }}
+ maxlength="50" @input="changeInput">
diff --git a/config/env.js b/config/env.js
index fdef3e2..2597c4b 100644
--- a/config/env.js
+++ b/config/env.js
@@ -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
}
diff --git a/manifest.json b/manifest.json
index e7753ea..a223d22 100644
--- a/manifest.json
+++ b/manifest.json
@@ -3,7 +3,7 @@
"appid" : "__UNI__933D519",
"description" : "",
"versionName" : "1.0.0",
- "versionCode" : "100",
+ "versionCode" : "2",
"transformPx" : false,
/* 小程序特有相关 */
"mp-weixin" : {
diff --git a/pages/bindLock/bindLock.vue b/pages/bindLock/bindLock.vue
index c8232df..df25b3a 100644
--- a/pages/bindLock/bindLock.vue
+++ b/pages/bindLock/bindLock.vue
@@ -1,7 +1,7 @@
如需修改名字请重新命名,点击确定添加锁
-
确定
@@ -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,
diff --git a/pages/home/home.vue b/pages/home/home.vue
index a46fb54..74df04d 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -34,7 +34,18 @@
{{lock.lockAlias}}
-
+
+ 已过期
+ 余{{lock.days}}天
+ 未生效
+ 已冻结
+ 远程开锁
+
+
+
{{
getTimeLimit(lock.keyType) }}
@@ -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;
+}
diff --git a/pages/keyDetail/keyDetail.vue b/pages/keyDetail/keyDetail.vue
index c6f1a61..2da44aa 100644
--- a/pages/keyDetail/keyDetail.vue
+++ b/pages/keyDetail/keyDetail.vue
@@ -1,7 +1,7 @@
- 名称
+ 名称
{{ currentKeyInfo.keyName }}
@@ -24,7 +24,7 @@
有效时间
- {{ timeFormat(currentKeyInfo.startDate, 'h:M') }}-{{ timeFormat(currentKeyInfo.endDate, 'h:M') }}
+ {{ timeFormat(currentKeyInfo.startDate, 'h:M') }}~{{ timeFormat(currentKeyInfo.endDate, 'h:M') }}
@@ -40,6 +40,15 @@
{{ timeFormat(currentKeyInfo.sendDate, 'yyyy-mm-dd h:M') }}
删除钥匙
+
+
+
+
+ 同时删除其发送的所有钥匙,钥匙删除后不能恢复
+
+
+
@@ -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(',')
}
}
}
diff --git a/pages/keyList/keyList.vue b/pages/keyList/keyList.vue
index fd41edf..11a07a5 100644
--- a/pages/keyList/keyList.vue
+++ b/pages/keyList/keyList.vue
@@ -20,8 +20,11 @@
-
+
{{ key.keyName }}
+
+
{{ getKeyStatus(key.keyStatus) }}
@@ -39,6 +42,15 @@
重置钥匙
发送钥匙
+
+
+
+
+ 同时删除其发送的所有钥匙,钥匙删除后不能恢复
+
+
+
@@ -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;
diff --git a/pages/lockDetail/lockDetail.vue b/pages/lockDetail/lockDetail.vue
index 4f5d080..83b91d2 100644
--- a/pages/lockDetail/lockDetail.vue
+++ b/pages/lockDetail/lockDetail.vue
@@ -1,5 +1,7 @@
+ 钥匙将在{{ currentLockInfo.days }}天后失效
+ {{ currentLockInfo.lockAlias }}
@@ -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 {
diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue
index 550fc5f..5ebb714 100644
--- a/pages/setting/setting.vue
+++ b/pages/setting/setting.vue
@@ -2,11 +2,12 @@
- 名称
-
- {{currentLockInfo.lockAlias}}
+ 名称
+
+ {{currentLockInfo.lockAlias}}
+
锁编号
@@ -17,7 +18,7 @@
MAC/ID
- {{currentLockInfo.mac}}
+ {{currentLockInfo.mac}}/{{currentLockInfo.lockId}}
@@ -37,7 +38,50 @@
+
+
+
+ 有效期
+
+ {{ timeFormat(currentLockInfo.startDate, 'yyyy-mm-dd h:M') }}~{{
+ timeFormat(currentLockInfo.endDate, 'yyyy-mm-dd h:M') }}
+
+
+
+
+
+ 有效期
+
+ {{ timeFormat(currentLockInfo.startDate, 'yyyy-mm-dd') }}~{{ timeFormat(currentLockInfo.endDate, 'yyyy-mm-dd') }}
+
+
+
+
+ 有效日
+
+ {{ convertWeekDaysToChineseString(currentLockInfo.weekDays) }}
+
+
+
+
+ 有效时间
+
+ {{ timeFormat(currentLockInfo.startDate, 'h:M') }}~{{
+ timeFormat(currentLockInfo.endDate, 'h:M') }}
+
+
+
+
删除
+
+
+
+
+ 同时删除其发送的所有钥匙,钥匙删除后不能恢复
+
+
+
@@ -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);
+}
diff --git a/pages/updateEmail/updateEmail.vue b/pages/updateEmail/updateEmail.vue
index 59136d1..66242ce 100644
--- a/pages/updateEmail/updateEmail.vue
+++ b/pages/updateEmail/updateEmail.vue
@@ -1,5 +1,6 @@
+ 找回密码和登录新设备时,可通过绑定的邮箱验证
@@ -139,6 +140,12 @@ page {