From 418a7e98e91116bdeb1dd2e29e2469479cad048f Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 19 Nov 2024 11:52:16 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B8=A3?= =?UTF-8?q?=E0=B8=B9=E0=B8=9B=20Profile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/MainLayout.vue | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 39b96f1de..9712517f2 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -7,6 +7,7 @@ import { scroll, useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import { useMenuDataStore } from "@/stores/menuList"; import { tokenParsed, logout } from "@/plugins/auth"; +import avatar from "@/assets/avatar_user.jpg"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -251,6 +252,7 @@ onMounted(async () => { await fetchSys(); await fetchPermissionsSys(); + fetchKeycloakPosition(); const user = await tokenParsed(); if (user) { @@ -536,6 +538,31 @@ async function fetchPermissionsSys() { messageError($q, err); }); } + +async function fetchKeycloakPosition() { + await http + .get(config.API.keycloakPosition()) + .then(async (res) => { + const data = await res.data.result; + if (data.avatarName) { + await getImg(data.profileId, data.avatarName); + } else { + profileImg.value = avatar; + } + }) + .catch((err) => { + messageError($q, err); + }); +} + +const profileImg = ref(""); +async function getImg(id: string, pathName: string) { + await http + .get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName)) + .then((res) => { + profileImg.value = res.data.downloadUrl; + }); +} @@ -716,8 +743,8 @@ async function fetchPermissionsSys() { - - + + @@ -734,8 +761,11 @@ async function fetchPermissionsSys() { >
- + + + +
{{ fullname }}