用户信息显示角色

This commit is contained in:
dong 2023-09-01 18:08:25 +08:00
parent 98abaf3f91
commit 02df4b5da3

View File

@ -65,49 +65,51 @@
<q-list>
<q-item>
<q-item-section>
<q-item-label>ID</q-item-label>
<q-item-label caption>ID</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{ userInfo?.id }}</q-item-label>
<q-item-section avatar>
<q-item-label>{{ userInfo?.id }}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>用户名</q-item-label>
<q-item-label caption>用户名</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{ userInfo?.name }}</q-item-label>
<q-item-section avatar>
<q-item-label>{{ userInfo?.name }}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>电话</q-item-label>
<q-item-label caption>角色</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{ userInfo?.mobile }}</q-item-label>
<q-item-section>
<q-item-label avatar style="text-align: right">
{{ getRoleName(userInfo?.roles) }}
</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>注册时间</q-item-label>
<q-item-label caption>电话</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{
userInfo?.register_time
}}</q-item-label>
<q-item-section avatar>
<q-item-label>{{ userInfo?.mobile }}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label caption>注册时间</q-item-label>
</q-item-section>
<q-item-section avatar>
<q-item-label>{{ userInfo?.register_time }}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-card-section>
<q-card-actions align="right">
<q-btn
flat
label="确定"
color="primary"
v-close-popup
@click="closeShowInfo"
/>
<q-btn flat label="确定" color="primary" @click="closeShowInfo" />
</q-card-actions>
</q-card>
</q-dialog>
@ -180,4 +182,15 @@ function logOut() {
router.push({ name: 'login' });
});
}
function getRoleName(list: { id: number; name: string }[] | undefined) {
let name = '';
if (list && list.length > 0) {
const arr = list.map((item) => {
return item.name;
});
name = arr.join('');
}
return name;
}
</script>