diff --git a/api/user.js b/api/user.js index c927885..a160ff4 100644 --- a/api/user.js +++ b/api/user.js @@ -136,3 +136,12 @@ export function getWebUrlRequest(data) { data }) } + +// 退出登录 +export function logoutRequest(data) { + return request({ + url: '/v3/user/logout', + method: 'POST', + data + }) +} diff --git a/pages/main/mine.vue b/pages/main/mine.vue index 67085e5..5af3ffe 100644 --- a/pages/main/mine.vue +++ b/pages/main/mine.vue @@ -56,9 +56,14 @@ >切换环境 + + + + 退出 + 因智能门锁与账号绑定,登录为手机号登录 @@ -105,7 +110,7 @@ import { useBasicStore } from '@/stores/basic' import { useUserStore } from '@/stores/user' import { useLockStore } from '@/stores/lock' - import { phoneLoginRequest } from '@/api/user' + import { phoneLoginRequest, logoutRequest } from '@/api/user' import env from '@/config/env' import { setStorage, getStorage, removeStorage } from '@/utils/storage' import { useNotificationStore } from '@/stores/notification' @@ -260,6 +265,25 @@ type } }) + }, + logout() { + uni.showModal({ + title: '提示', + content: '确定退出登录吗?', + success: async res => { + if (res.confirm) { + await logoutRequest() + removeStorage('token') + removeStorage('openid') + removeStorage('userInfo') + removeStorage('lockList') + this.routeJump({ + name: 'login', + type: 'reLaunch' + }) + } + } + }) } } } diff --git a/pages/user/updateEmail.vue b/pages/user/updateEmail.vue index 1999c9a..441b380 100644 --- a/pages/user/updateEmail.vue +++ b/pages/user/updateEmail.vue @@ -168,28 +168,27 @@ } .input-email { - border-radius: 16rpx; - background: #ffffff; - margin-left: 35rpx; - margin-top: 48rpx; - height: 108rpx; width: 616rpx; - padding-left: 32rpx; + height: 108rpx; padding-right: 32rpx; + padding-left: 32rpx; + margin-top: 48rpx; + margin-left: 35rpx; + background: #ffffff; + border-radius: 16rpx; } .button-verify { - margin-top: 48rpx; - height: 108rpx; width: 265rpx; - line-height: 108rpx; - border-radius: 16rpx; - text-align: center; - font-size: 32rpx; + height: 108rpx; + margin-top: 48rpx; margin-left: 35rpx; - - background: #63b8af; + font-size: 32rpx; + line-height: 108rpx; color: #ffffff; + text-align: center; + background: #63b8af; + border-radius: 16rpx; } .view-top { @@ -198,14 +197,14 @@ } .input-verify { - border-radius: 16rpx; - background: #ffffff; - margin-left: 35rpx; - margin-top: 48rpx; - height: 108rpx; width: 316rpx; - padding-left: 32rpx; + height: 108rpx; padding-right: 32rpx; + padding-left: 32rpx; + margin-top: 48rpx; + margin-left: 35rpx; + background: #ffffff; + border-radius: 16rpx; } .input-placeholder { @@ -216,15 +215,15 @@ } .button { - margin-top: 32rpx; - margin-left: 35rpx; width: 680rpx; height: 96rpx; + margin-top: 32rpx; + margin-left: 35rpx; + font-size: 32rpx; + line-height: 96rpx; + color: #ffffff; + text-align: center; background: #63b8af; border-radius: 16rpx; - line-height: 96rpx; - text-align: center; - font-size: 32rpx; - color: #ffffff; } diff --git a/pages/user/updateName.vue b/pages/user/updateName.vue index 229b3b5..ca237d2 100644 --- a/pages/user/updateName.vue +++ b/pages/user/updateName.vue @@ -84,14 +84,14 @@ diff --git a/pages/user/updatePassword.vue b/pages/user/updatePassword.vue index 031d61b..ba2acca 100644 --- a/pages/user/updatePassword.vue +++ b/pages/user/updatePassword.vue @@ -145,14 +145,14 @@ diff --git a/pages/user/userInfo.vue b/pages/user/userInfo.vue index d69cfe3..c6f907b 100644 --- a/pages/user/userInfo.vue +++ b/pages/user/userInfo.vue @@ -1,6 +1,7 @@