fix(user): 修复登录不获取菜单问题

- 在 login 页面中添加了多个 CSS 规则,以确保输入框在自动填充时保持透明背景
- 在 personal 组件中添加了用户登出时清除角色信息的逻辑
- 在 user store 中添加了 removeRoles action,用于清除用户角色信息
This commit is contained in:
du.meimei
2025-04-29 18:01:50 +08:00
parent e553efa34c
commit 97180035e0
3 changed files with 37 additions and 0 deletions

View File

@@ -33,6 +33,9 @@ const actions = {
setToken({ commit }, data) {
commit('SET_TOKEN', data)
},
removeRoles({ commit }) {
commit('SET_ROLES', [])
},
// user login
login({ commit }, userInfo) {
const { userName, password } = userInfo

View File

@@ -59,6 +59,7 @@ export default {
type: 'warning'
}).then(async () => {
await this.$store.dispatch('user/logout')
await this.$store.dispatch('user/removeRoles')
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
})
},

View File

@@ -210,6 +210,10 @@ $cursor: #fff;
background-color: transparent;
}
}
&:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px transparent inset !important;
box-shadow: 0 0 0px 1000px transparent inset !important;
}
}
.el-form-item {
@@ -297,11 +301,20 @@ input -internal-autofill-selected {
/deep/ .el-form-item__content {
height: 40px;
line-height: 40px;
background-color: #fff;
border-radius: 8px;
}
/deep/ .el-form-item__inner {
background-color: transparent !important;
color: #000;
}
.el-input .el-input__inner {
background-color: transparent !important;
&:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px transparent inset !important;
box-shadow: 0 0 0px 1000px transparent inset !important;
}
}
.el-input .el-input__inner:hover,
.el-select .el-input__inner:hover,
.el-range-editor .el-input__inner:hover {
@@ -316,4 +329,24 @@ input -internal-autofill-selected {
/deep/ .el-input__inner {
background-color: transparent !important;
}
// 在全局样式或组件样式中添加以下规则
.el-input input:-webkit-autofill,
.el-input input:-webkit-autofill:hover,
.el-input input:-webkit-autofill:focus {
-webkit-box-shadow: 0 0 0px 1000px transparent inset !important;
box-shadow: 0 0 0px 1000px transparent inset !important;
background-color: transparent !important;
transition: background-color 5000s ease-in-out 0s;
}
// 如果使用scoped样式需要穿透
::v-deep {
.el-input__inner {
&:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px transparent inset !important;
box-shadow: 0 0 0px 1000px transparent inset !important;
background-color: transparent !important;
}
}
}
</style>