新增消息一键已读
This commit is contained in:
@@ -58,6 +58,7 @@ const unreadCount = ref(0)
|
||||
const total = ref(0)
|
||||
const sentTotal = ref(0)
|
||||
const loading = ref(false)
|
||||
const markingAllRead = ref(false)
|
||||
const sending = ref(false)
|
||||
const composerLoading = ref(false)
|
||||
const recipientLoading = ref(false)
|
||||
@@ -380,6 +381,8 @@ async function openNotification(notification: any) {
|
||||
}
|
||||
|
||||
async function markAllRead() {
|
||||
if (markingAllRead.value) return
|
||||
markingAllRead.value = true
|
||||
try {
|
||||
await http.post('/notifications/read-all')
|
||||
notifications.value.forEach(notification => {
|
||||
@@ -389,6 +392,8 @@ async function markAllRead() {
|
||||
ElMessage.success('全部消息已标为已读')
|
||||
} catch (error) {
|
||||
ElMessage.error(apiErrorMessage(error))
|
||||
} finally {
|
||||
markingAllRead.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,7 +546,13 @@ onMounted(() => load())
|
||||
@clear="load(true)"
|
||||
/>
|
||||
<el-checkbox v-model="unreadOnly" @change="load(true)">仅看未读</el-checkbox>
|
||||
<el-button v-if="unreadCount" :icon="Check" text @click="markAllRead">
|
||||
<el-button
|
||||
v-if="unreadCount"
|
||||
:icon="Check"
|
||||
:loading="markingAllRead"
|
||||
text
|
||||
@click="markAllRead"
|
||||
>
|
||||
全部已读
|
||||
</el-button>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user