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 @@ @@ -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 @@ @@ -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 @@