แก้ไข กล่องข้อความ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-17 17:34:55 +07:00
parent 94a8969d7d
commit b7de285e8d

View file

@ -87,35 +87,36 @@ onMounted(async () => {
}); });
const fetchlistInbox = async (index: number) => { const fetchlistInbox = async (index: number) => {
index === 1 && showLoader(); index === 1 && showLoader();
await http index != 0 &&
.get(config.API.msgInbox + `?page=${index}&pageSize=${10}`) (await http
.then((res) => { .get(config.API.msgInbox + `?page=${index}&pageSize=${10}`)
let data = res.data.result.data; .then((res) => {
totalInbox.value = res.data.result.total; let data = res.data.result.data;
let listItem: any = []; totalInbox.value = res.data.result.total;
data.map((e: any) => { let listItem: any = [];
listItem.push({ data.map((e: any) => {
no: e.id ?? "", listItem.push({
sender: no: e.id ?? "",
e.createdFullName == "" || e.createdFullName == null sender:
? "เจ้าหน้าที่" e.createdFullName == "" || e.createdFullName == null
: e.createdFullName, ? "เจ้าหน้าที่"
subject: e.subject ?? "", : e.createdFullName,
timereceive: date2Thai(e.createdAt), subject: e.subject ?? "",
body: e.body ?? "-", timereceive: date2Thai(e.createdAt),
ratingModel: 0, body: e.body ?? "-",
receiveDate: date2Thai(e.receiveDate), ratingModel: 0,
payload: e.payload, receiveDate: date2Thai(e.receiveDate),
payload: e.payload,
});
}); });
}); inboxList.value.push(...listItem);
inboxList.value.push(...listItem); })
}) .catch((err) => {
.catch((err) => { console.log(err);
console.log(err); })
}) .finally(() => {
.finally(() => { hideLoader();
hideLoader(); }));
});
}; };
const transferToPage = (path?: string) => { const transferToPage = (path?: string) => {
@ -149,23 +150,16 @@ function updateModalDetail(val: boolean) {
const scrollTargetRef = ref<any>(null); const scrollTargetRef = ref<any>(null);
const totalInbox = ref<number>(0); const totalInbox = ref<number>(0);
function onLoad(index: number, done: any) { async function onLoad(index: number, done: any) {
const num = index === 1 ? 0 : index++;
if (inboxList.value.length < totalInbox.value) { if (inboxList.value.length < totalInbox.value) {
setTimeout(() => { setTimeout(() => {
fetchlistInbox(index + 1); fetchlistInbox(num);
done(); done();
}, 2000); }, 2000);
} }
} }
// function onLoadRef(index: number, done: any) {
// if (inboxList.value.length < totalInbox.value) {
// setTimeout(() => {
// fetchlistInbox(index + 1);
// done();
// }, 2000);
// }
// }
</script> </script>
<template> <template>
@ -294,8 +288,11 @@ function onLoad(index: number, done: any) {
</q-item-section> </q-item-section>
</q-item> </q-item>
</div> </div>
<template v-slot:loading v-if="inboxList.length < totalInbox"> <template v-slot:loading>
<div class="row justify-center q-my-md"> <div
class="row justify-center q-my-md"
v-if="inboxList.length < totalInbox"
>
<q-spinner-dots color="primary" size="40px" /> <q-spinner-dots color="primary" size="40px" />
</div> </div>
</template> </template>