feat: user account info on top
This commit is contained in:
parent
79bcf8241c
commit
ac367f0649
1 changed files with 106 additions and 32 deletions
|
|
@ -41,14 +41,16 @@ const leftDrawerOpen = ref(false);
|
||||||
const filterUnread = ref(false);
|
const filterUnread = ref(false);
|
||||||
const unread = ref<number>(1);
|
const unread = ref<number>(1);
|
||||||
const filterRole = ref<string[]>();
|
const filterRole = ref<string[]>();
|
||||||
|
const userImage = ref<string>();
|
||||||
|
|
||||||
const currentLanguage = ref<string>('ไทย');
|
const currentLanguage = ref<string>('ไทย');
|
||||||
const language: {
|
const language: {
|
||||||
value: string;
|
value: string;
|
||||||
label: string;
|
label: string;
|
||||||
|
icon: string;
|
||||||
}[] = [
|
}[] = [
|
||||||
{ value: 'th-th', label: 'ไทย' },
|
{ value: 'th-th', label: 'ไทย', icon: 'circle-flags:th' },
|
||||||
{ value: 'en-US', label: 'English' },
|
{ value: 'en-US', label: 'English', icon: 'circle-flags:us' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const notiOpen = ref(false);
|
const notiOpen = ref(false);
|
||||||
|
|
@ -84,8 +86,14 @@ const notification = ref<Notification[]>([
|
||||||
read: true,
|
read: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
const options = ref([
|
||||||
const userImage = ref<string>();
|
{
|
||||||
|
icon: 'mdi-lock-outline',
|
||||||
|
label: 'เปลี่ยนรหัสผ่าน',
|
||||||
|
value: 'op1',
|
||||||
|
color: 'primary',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
function setActive(button: NotificationButton) {
|
function setActive(button: NotificationButton) {
|
||||||
notiMenu.value = notiMenu.value.map((current) => ({
|
notiMenu.value = notiMenu.value.map((current) => ({
|
||||||
|
|
@ -130,7 +138,6 @@ onMounted(async () => {
|
||||||
|
|
||||||
const userRoles = getRole();
|
const userRoles = getRole();
|
||||||
if (userRoles) {
|
if (userRoles) {
|
||||||
console.log(userRoles);
|
|
||||||
filterRole.value = userRoles.filter(
|
filterRole.value = userRoles.filter(
|
||||||
(role) =>
|
(role) =>
|
||||||
role !== 'default-roles-dev' &&
|
role !== 'default-roles-dev' &&
|
||||||
|
|
@ -263,7 +270,8 @@ onMounted(async () => {
|
||||||
dense
|
dense
|
||||||
flat
|
flat
|
||||||
no-caps
|
no-caps
|
||||||
:menu-offset="[0, 10]"
|
content-style="border: 1px solid var(--border-color)"
|
||||||
|
:menu-offset="[30, 10]"
|
||||||
color="dark"
|
color="dark"
|
||||||
class="q-pa-none account-menu-down dropdown-menu"
|
class="q-pa-none account-menu-down dropdown-menu"
|
||||||
>
|
>
|
||||||
|
|
@ -296,32 +304,61 @@ onMounted(async () => {
|
||||||
</q-item>
|
</q-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<q-list class="dropdown-menu">
|
<div no-padding class="row justify-center" style="width: 273.797px">
|
||||||
<q-item clickable>
|
<div class="column col-12 items-center">
|
||||||
<q-item-section avatar style="min-width: 30px">
|
<div
|
||||||
<q-icon
|
class="full-width row justify-center"
|
||||||
color="secondary"
|
style="position: relative"
|
||||||
size="18px"
|
>
|
||||||
name="mdi-lock-outline"
|
<div
|
||||||
/>
|
class="full-width account-cover"
|
||||||
</q-item-section>
|
:class="{ dark: $q.dark.isActive }"
|
||||||
<q-item-section>
|
></div>
|
||||||
<q-item-label>เปลี่ยนรหัสผ่าน</q-item-label>
|
<div class="avartar-border">
|
||||||
</q-item-section>
|
<q-avatar size="72px" class="bg-primary">
|
||||||
</q-item>
|
<img :src="userImage" v-if="userImage" />
|
||||||
<q-item clickable v-close-popup @click="doLogout()">
|
</q-avatar>
|
||||||
<q-item-section avatar style="min-width: 30px">
|
</div>
|
||||||
<q-icon
|
</div>
|
||||||
color="primary"
|
|
||||||
size="18px"
|
<div
|
||||||
name="mdi-logout-variant"
|
class="text-subtitle2 q-mb-xs text-center"
|
||||||
/>
|
style="margin-top: 58px"
|
||||||
</q-item-section>
|
>
|
||||||
<q-item-section>
|
{{ getName() }}
|
||||||
<q-item-label>ออกจากระบบ</q-item-label>
|
</div>
|
||||||
</q-item-section>
|
<div
|
||||||
</q-item>
|
class="badge q-px-sm q-mb-md text-caption"
|
||||||
</q-list>
|
:class="{ dark: $q.dark.isActive }"
|
||||||
|
>
|
||||||
|
{{ getRoleName(userStore.userOption.roleOpts, filterRole) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="column col-12">
|
||||||
|
<q-separator />
|
||||||
|
<div class="column justify-center">
|
||||||
|
<q-list dense v-for="op in options" :key="op.label">
|
||||||
|
<q-item clickable>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon :name="op.icon" :color="op.color" size="20px" />
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section class="q-py-sm">
|
||||||
|
{{ op.label }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</div>
|
||||||
|
<q-btn
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
class="q-ma-sm logout-btn"
|
||||||
|
:class="{ dark: $q.dark.isActive }"
|
||||||
|
label="ออกจากระบบ"
|
||||||
|
@click="doLogout()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</q-btn-dropdown>
|
</q-btn-dropdown>
|
||||||
|
|
||||||
<!-- theme -->
|
<!-- theme -->
|
||||||
|
|
@ -411,4 +448,41 @@ onMounted(async () => {
|
||||||
color: var(--foreground);
|
color: var(--foreground);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: var(--radius-6);
|
||||||
|
background-color: var(--indigo-0);
|
||||||
|
text-wrap: nowrap;
|
||||||
|
|
||||||
|
&.dark {
|
||||||
|
background-color: var(--surface-3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-cover {
|
||||||
|
height: 65px;
|
||||||
|
background-color: var(--indigo-0);
|
||||||
|
|
||||||
|
&.dark {
|
||||||
|
background-color: var(--surface-3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.avartar-border {
|
||||||
|
margin-top: 24px;
|
||||||
|
border: 5px solid var(--surface-1);
|
||||||
|
border-radius: 50%;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-btn {
|
||||||
|
color: hsl(var(--negative-bg));
|
||||||
|
background-color: hsl(var(--stone-3-hsl));
|
||||||
|
|
||||||
|
&.dark {
|
||||||
|
background-color: transparent;
|
||||||
|
border: 1px solid hsl(var(--negative-bg));
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue