From 9d362e13de220c0b65c503e712bbc22a71e03cd8 Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Tue, 21 Jan 2025 16:38:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E5=8F=AA?= =?UTF-8?q?=E6=9C=89=E4=B8=80=E4=B8=AA=E8=A7=92=E8=89=B2=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=97=B6=E8=87=AA=E5=8A=A8=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/login/index.vue | 12 ++++++++++++ src/views/trials/trials-myinfo/account.vue | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 21f33813..7a353d14 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -510,6 +510,18 @@ export default { this.loginByRole(this.$store.state.user.roles[0].Id) return } + if ( + Array.isArray(this.$store.state.user.roles) && + this.$store.state.user.roles.filter((item) => item.IsUserRoleDisabled) + .length === + this.$store.state.user.roles.length - 1 + ) { + let role = this.$store.state.user.roles.find( + (item) => !item.IsUserRoleDisabled + ) + this.loginByRole(role.Id) + return + } return (this.toggleRoleVisible = true) }, cancel() { diff --git a/src/views/trials/trials-myinfo/account.vue b/src/views/trials/trials-myinfo/account.vue index feb9161b..35244193 100644 --- a/src/views/trials/trials-myinfo/account.vue +++ b/src/views/trials/trials-myinfo/account.vue @@ -119,7 +119,7 @@ v-for="item in roles" :key="item.Id" :label="item.Id" - :disabled="item.isUserRoleDisabled" + :disabled="item.IsUserRoleDisabled" style="margin-bottom: 10px" > {{ item.UserTypeShortName }} @@ -210,6 +210,7 @@ export default { }, computed: { roles() { + console.log(this.$store.state.user.roles, 'this.$store.state.user.roles') return this.$store.state.user.roles }, hasRole() {