การแจ้งเตือน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-19 15:24:40 +07:00
parent 25fedf5eb0
commit 4ab03e9c4b
2 changed files with 23 additions and 30 deletions

View file

@ -157,7 +157,7 @@ const thaiOptions: Intl.DateTimeFormatOptions = {
<div class="q-px-md q-py-sm row col-12 items-center"> <div class="q-px-md q-py-sm row col-12 items-center">
<div class="text-subtitle1 text-weight-medium">กลองขอความ</div> <div class="text-subtitle1 text-weight-medium">กลองขอความ</div>
<q-space /> <q-space />
<div class="text-grey-5">งหมด {{ totalInbox }} อความ</div> <div class="text-grey-5" style="font-size: 12px;">งหมด {{ totalInbox }} อความ</div>
</div> </div>
<q-separator /> <q-separator />

View file

@ -451,14 +451,14 @@ const clickDelete = async (id: string, index: number) => {
const totalInbox = ref<number>(0); const totalInbox = ref<number>(0);
const totalNoti = ref<number>(0); const totalNoti = ref<number>(0);
const round = ref<number>(0); const round = ref<number>(0);
const page = ref<number>(0);
function onLoad(index: any, done: any) { function onLoad(index: any, done: any) {
if (notiList.value.length < totalInbox.value && isLoad) { page.value++;
setTimeout(() => { setTimeout(() => {
done(); done();
getDataNotification(index + 1, "NOMAL"); getDataNotification(page.value, "NOMAL");
}, 3000); }, 1500);
}
} }
watch( watch(
@ -471,9 +471,6 @@ watch(
})); }));
notiList.value = updatedNotifications; notiList.value = updatedNotifications;
fetchmsgNoread(); fetchmsgNoread();
} else {
round.value++;
round.value === 1 && getDataNotification(round.value, "NOMAL");
} }
} }
); );
@ -534,27 +531,21 @@ watch(
v-if="totalNoti !== 0" v-if="totalNoti !== 0"
>{{ totalNoti }}</q-badge >{{ totalNoti }}</q-badge
> >
<q-menu v-model="notiTrigger" max-width="480px" :offset="[0, 10]"> <q-menu
<div v-model="notiTrigger"
class="q-px-md q-py-sm row col-12 items-center" :offset="[0, 8]"
v-if="notiList.length !== 0" style="height: 400px; width: 480px"
> >
<div class="q-px-md q-py-sm row col-12 items-center">
<div class="text-subtitle1 text-weight-medium">การแจงเตอน</div> <div class="text-subtitle1 text-weight-medium">การแจงเตอน</div>
<q-space /> <q-space />
<div class="text-grey-5">งหมด {{ totalInbox }} อความ</div> <div class="text-grey-5" style="font-size: 12px">
งหมด {{ totalInbox }} อความ
</div>
</div> </div>
<q-infinite-scroll <q-infinite-scroll @load="onLoad" :offset="250">
@load="onLoad" <div v-for="(n, index) in notiList" :key="index" class="caption">
:offset="250"
v-if="notiList.length !== 0"
style="max-height: 400px"
>
<q-list
v-for="(n, index) in notiList"
:key="index"
:class="!n.isOpen ? 'my-menu-link q-mt-sm' : 'q-mt-sm'"
>
<q-item v-ripple class="mytry q-py-xs" dense> <q-item v-ripple class="mytry q-py-xs" dense>
<q-item-section avatar top style="min-width: 40px"> <q-item-section avatar top style="min-width: 40px">
<q-avatar color="primary" size="22px" text-color="white"> <q-avatar color="primary" size="22px" text-color="white">
@ -582,9 +573,11 @@ watch(
@click="clickDelete(n.id, index)" @click="clickDelete(n.id, index)"
></q-btn> ></q-btn>
</q-item> </q-item>
<q-separator color="grey-2" /> </div>
</q-list>
<template v-if="notiList.length < totalInbox"> <q-separator color="grey-2" />
<template v-slot:loading>
<div class="row justify-center q-my-md"> <div class="row justify-center q-my-md">
<q-spinner-dots color="primary" size="40px" /> <q-spinner-dots color="primary" size="40px" />
</div> </div>