用户登录只有一个角色可以选择时自动登录
parent
d04898dc28
commit
9d362e13de
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue