提交 1e8117d9 authored 作者: pengxiaohui's avatar pengxiaohui

fix: 修复登录用户角色和姓名不显示的bug [#2125]

上级 ec6cae4a
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<span v-if="roles.length === 0"></span> <span v-if="roles.length === 0"></span>
</div> </div>
<div class="item"> <div class="item">
<label>真实姓名:</label>{{user.realname || "无"}} <label>姓名:</label>{{user.realname || user.nickname || '无'}}
</div> </div>
</div> </div>
</div> </div>
...@@ -34,6 +34,10 @@ export default { ...@@ -34,6 +34,10 @@ export default {
}, },
computed: { computed: {
...mapGetters(['user', 'roles']) ...mapGetters(['user', 'roles'])
},
created() {
console.log(this.user)
console.log(this.roles)
} }
} }
</script> </script>
......
...@@ -28,7 +28,11 @@ ...@@ -28,7 +28,11 @@
<div class="table-container"> <div class="table-container">
<el-table :data="listData" style="width: 100%;" height="100%" v-loading="loading" @selection-change="handleSelectionChange"> <el-table :data="listData" style="width: 100%;" height="100%" v-loading="loading" @selection-change="handleSelectionChange">
<el-table-column v-if="hasDelete" type="selection" width="45" /> <el-table-column v-if="hasDelete" type="selection" width="45" />
<el-table-column prop="sso_user.nickname" label="姓名" min-width="100" /> <el-table-column label="姓名" min-width="100" >
<template slot-scope="{ row }">
<span>{{row.sso_user.real_name || row.sso_user.nickname}}</span>
</template>
</el-table-column>
<el-table-column label="手机号码" min-width="100"> <el-table-column label="手机号码" min-width="100">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<span>{{row.sso_user.mobile || '-'}}</span> <span>{{row.sso_user.mobile || '-'}}</span>
......
...@@ -78,7 +78,7 @@ const user = { ...@@ -78,7 +78,7 @@ const user = {
// 获取角色 // 获取角色
async checkRoles({ commit }) { async checkRoles({ commit }) {
const hasRoles = await getUserRoles().then(res => { const hasRoles = await getUserRoles().then(res => {
const roles = res.data.roles const roles = res.data
let isSuperAdmin = false let isSuperAdmin = false
if (roles && Array.isArray(roles)) { if (roles && Array.isArray(roles)) {
roles.forEach(it => { roles.forEach(it => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论