From ad2ea934d50e3abe93c447c9f739a0945142286f Mon Sep 17 00:00:00 2001 From: "STW_TTTY\\stwtt" Date: Tue, 20 Aug 2024 10:59:53 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B9=80?= =?UTF-8?q?=E0=B9=80=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B8=A3=E0=B8=B9=E0=B8=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/08_KPI/views/form.vue | 1 - src/views/MainLayout.vue | 62 +++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/modules/08_KPI/views/form.vue b/src/modules/08_KPI/views/form.vue index 923ba48..1a94f9f 100644 --- a/src/modules/08_KPI/views/form.vue +++ b/src/modules/08_KPI/views/form.vue @@ -490,7 +490,6 @@ const evaluator = ref({ posTypeName: "", posLevelName: "", org: "", - posmasterAct: "", isPosmasterAct: false, posmasterAct: [], }); diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 24072f1..c6c3fa3 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -7,12 +7,12 @@ import { useQuasar } from "quasar"; import keycloak, { kcLogout } from "@/plugins/keycloak"; import { useCounterMixin } from "@/stores/mixin"; import CustomComponent from "@/components/CustomDialog.vue"; - +import avatar from "@/assets/avatar_user.jpg"; const route = useRoute(); const router = useRouter(); const $q = useQuasar(); - +const profileImg = ref(""); const mixin = useCounterMixin(); const { date2Thai, @@ -42,24 +42,46 @@ onMounted(async () => { }); async function checkUser() { - http.get(config.API.profilePosition()).catch((err) => { - $q.dialog({ - component: CustomComponent, - componentProps: { - title: "ข้อความแจ้งเตือน", - message: err.response.data.message, - icon: "warning", - color: "red", - onlycancel: true, - }, - }).onCancel(async () => { - showLoader(); - await kcLogout(); - setTimeout(() => { - hideLoader(); - }, 1000); + http + .get(config.API.profilePosition()) + .then(async (res) => { + const data = res.data.result; + if (data.avatarName) { + await getImg(data.profileId, data.avatarName); + } else { + profileImg.value = avatar; + } + }) + .catch((err) => { + $q.dialog({ + component: CustomComponent, + componentProps: { + title: "ข้อความแจ้งเตือน", + message: err.response.data.message, + icon: "warning", + color: "red", + onlycancel: true, + }, + }).onCancel(async () => { + showLoader(); + await kcLogout(); + setTimeout(() => { + hideLoader(); + }, 1000); + }); }); - }); +} + +function getImg(id: string, pathName: string) { + http + .get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName)) + .then((res) => { + profileImg.value = res.data.downloadUrl; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => {}); } const totalNoti = ref(0); @@ -406,7 +428,7 @@ function onInfo() {