แก้ไข กล่องข้อความ
This commit is contained in:
parent
94a8969d7d
commit
b7de285e8d
1 changed files with 38 additions and 41 deletions
|
|
@ -87,35 +87,36 @@ onMounted(async () => {
|
|||
});
|
||||
const fetchlistInbox = async (index: number) => {
|
||||
index === 1 && showLoader();
|
||||
await http
|
||||
.get(config.API.msgInbox + `?page=${index}&pageSize=${10}`)
|
||||
.then((res) => {
|
||||
let data = res.data.result.data;
|
||||
totalInbox.value = res.data.result.total;
|
||||
let listItem: any = [];
|
||||
data.map((e: any) => {
|
||||
listItem.push({
|
||||
no: e.id ?? "",
|
||||
sender:
|
||||
e.createdFullName == "" || e.createdFullName == null
|
||||
? "เจ้าหน้าที่"
|
||||
: e.createdFullName,
|
||||
subject: e.subject ?? "",
|
||||
timereceive: date2Thai(e.createdAt),
|
||||
body: e.body ?? "-",
|
||||
ratingModel: 0,
|
||||
receiveDate: date2Thai(e.receiveDate),
|
||||
payload: e.payload,
|
||||
index != 0 &&
|
||||
(await http
|
||||
.get(config.API.msgInbox + `?page=${index}&pageSize=${10}`)
|
||||
.then((res) => {
|
||||
let data = res.data.result.data;
|
||||
totalInbox.value = res.data.result.total;
|
||||
let listItem: any = [];
|
||||
data.map((e: any) => {
|
||||
listItem.push({
|
||||
no: e.id ?? "",
|
||||
sender:
|
||||
e.createdFullName == "" || e.createdFullName == null
|
||||
? "เจ้าหน้าที่"
|
||||
: e.createdFullName,
|
||||
subject: e.subject ?? "",
|
||||
timereceive: date2Thai(e.createdAt),
|
||||
body: e.body ?? "-",
|
||||
ratingModel: 0,
|
||||
receiveDate: date2Thai(e.receiveDate),
|
||||
payload: e.payload,
|
||||
});
|
||||
});
|
||||
});
|
||||
inboxList.value.push(...listItem);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
inboxList.value.push(...listItem);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
}));
|
||||
};
|
||||
|
||||
const transferToPage = (path?: string) => {
|
||||
|
|
@ -149,23 +150,16 @@ function updateModalDetail(val: boolean) {
|
|||
|
||||
const scrollTargetRef = ref<any>(null);
|
||||
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) {
|
||||
setTimeout(() => {
|
||||
fetchlistInbox(index + 1);
|
||||
fetchlistInbox(num);
|
||||
done();
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
// function onLoadRef(index: number, done: any) {
|
||||
// if (inboxList.value.length < totalInbox.value) {
|
||||
// setTimeout(() => {
|
||||
// fetchlistInbox(index + 1);
|
||||
// done();
|
||||
// }, 2000);
|
||||
// }
|
||||
// }
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -294,8 +288,11 @@ function onLoad(index: number, done: any) {
|
|||
</q-item-section>
|
||||
</q-item>
|
||||
</div>
|
||||
<template v-slot:loading v-if="inboxList.length < totalInbox">
|
||||
<div class="row justify-center q-my-md">
|
||||
<template v-slot:loading>
|
||||
<div
|
||||
class="row justify-center q-my-md"
|
||||
v-if="inboxList.length < totalInbox"
|
||||
>
|
||||
<q-spinner-dots color="primary" size="40px" />
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue