แสดงรูปโปรไฟล์หน้ารายการทะเบียนประวัติ

This commit is contained in:
Warunee Tamkoo 2024-04-29 17:31:02 +07:00
parent 4232c5d4e8
commit 81fd3a3ac8
5 changed files with 117 additions and 91 deletions

View file

@ -12,6 +12,7 @@ import type { FormFilter } from "@/modules/04_registryNew/interface/request/Main
/** importComponents*/
import TableView from "@/modules/04_registryNew/components/TableView.vue";
import avatar from "@/assets/avatar_user.jpg";
/** importStore*/
import { useRegistryNewDataStore } from "@/modules/04_registryNew/store";
@ -152,6 +153,7 @@ async function fetchDataPerson(search: boolean = false) {
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
dataPersonMain.value = res.data.result.data;
total.value = res.data.result.total;
insertAvatar(res.data.result.data);
})
.catch((err) => {
messageError($q, err);
@ -163,6 +165,44 @@ async function fetchDataPerson(search: boolean = false) {
});
}
function insertAvatar(items: DataPerson[]) {
items.map((x: any, index: number) => {
http
.get(
config.API.fileByFile(
"ทะเบียนประวัติ",
"โปรไฟล์",
x.id,
"profile-" + x.id
)
)
.then((img) => {
dataPersonMain.value[index] = {
...x,
avatar: img.data.downloadUrl,
};
})
.catch(() => {
dataPersonMain.value[index] = {
...x,
avatar: avatar,
};
});
});
}
// const convertImageProfile = (id: string) => {
// return http
// .get(
// config.API.fileByFile("", "", id, "profile-" + id)
// )
// .then((res) => {
// return res.data.downloadUrl;
// })
// .catch(() => {
// return avatar;
// });
// };
function onClickShowFilter() {
isShowFilter.value = !isShowFilter.value;
isShowBtnFilter.value = false;
@ -229,7 +269,7 @@ onMounted(async () => {
อมลทะเบยนประว
</div> -->
<q-card class="q-mt-md ">
<q-card class="q-mt-md">
<q-card-section class="card-img q-pb-lg">
<div class="text-h5 text-center q-py-md text-weight-medium">
นหาขอมลทะเบยนประว