fix(notify): update read status for tablet
This commit is contained in:
@@ -57,6 +57,9 @@ const props = withDefaults(defineProps<{
|
|||||||
}>(), {
|
}>(), {
|
||||||
notifyId: ""
|
notifyId: ""
|
||||||
});
|
});
|
||||||
|
const emit = defineEmits<{
|
||||||
|
read: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -171,6 +174,7 @@ async function markRead(item: NotifyDetail, requestToken: number): Promise<void>
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await NotifyAPI.markInternalRead(item.id);
|
await NotifyAPI.markInternalRead(item.id);
|
||||||
|
emit("read");
|
||||||
if (requestToken === loadToken && detail.value) {
|
if (requestToken === loadToken && detail.value) {
|
||||||
detail.value = {
|
detail.value = {
|
||||||
...detail.value,
|
...detail.value,
|
||||||
|
|||||||
@@ -94,6 +94,7 @@
|
|||||||
<user-notify-detail
|
<user-notify-detail
|
||||||
:key="`detail-${selectedId}`"
|
:key="`detail-${selectedId}`"
|
||||||
:notify-id="selectedId"
|
:notify-id="selectedId"
|
||||||
|
@read="handleDetailRead"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</master-detail-page>
|
</master-detail-page>
|
||||||
@@ -233,6 +234,16 @@ async function refresh(): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleDetailRead(): Promise<void> {
|
||||||
|
try {
|
||||||
|
await reloadList();
|
||||||
|
await loadUnreadCount();
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("已读通知刷新失败", error);
|
||||||
|
Message.error("通知列表刷新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---------- 操作 ----------
|
// ---------- 操作 ----------
|
||||||
|
|
||||||
const isMarkingAllRead = ref(false);
|
const isMarkingAllRead = ref(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user