ปรับเเสดงรูป
This commit is contained in:
parent
85677820e4
commit
ad2ea934d5
2 changed files with 42 additions and 21 deletions
|
|
@ -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<string>("");
|
||||
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<number>(0);
|
||||
|
|
@ -406,7 +428,7 @@ function onInfo() {
|
|||
<q-item dense v-close-popup class="q-pa-none q-pl-xs">
|
||||
<q-item-section avatar class="q-pa-none" style="min-width: 30px">
|
||||
<q-img
|
||||
src="@/assets/avatar_user.jpg"
|
||||
:src="profileImg"
|
||||
class="border-100"
|
||||
spinner-color="white"
|
||||
style="height: 30px; max-width: 30px"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue