|
@@ -1,11 +1,12 @@
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { SiteMessage } from "@/types/student-client";
|
|
import { SiteMessage } from "@/types/student-client";
|
|
-import { messageListApi, updateNotieReadStatusApi } from "@/api/siteMessage";
|
|
|
|
|
|
+import { updateNotieReadStatusApi } from "@/api/siteMessage";
|
|
import { store } from "@/store/store";
|
|
import { store } from "@/store/store";
|
|
-import { DataTableColumns, useMessage } from "naive-ui";
|
|
|
|
|
|
+import { DataTableColumns, NIcon, useMessage } from "naive-ui";
|
|
import { h, computed, onMounted } from "vue";
|
|
import { h, computed, onMounted } from "vue";
|
|
import { useRouter } from "vue-router";
|
|
import { useRouter } from "vue-router";
|
|
import { RowKey } from "naive-ui/lib/data-table/src/interface";
|
|
import { RowKey } from "naive-ui/lib/data-table/src/interface";
|
|
|
|
+import { MailOpen, MailUnread } from "@vicons/ionicons5";
|
|
|
|
|
|
const message = useMessage();
|
|
const message = useMessage();
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
@@ -19,12 +20,11 @@ const columns: DataTableColumns<SiteMessage> = [
|
|
key: "title",
|
|
key: "title",
|
|
render(row) {
|
|
render(row) {
|
|
return h("p", { class: "qm-link-text", onClick: () => toDetail(row) }, [
|
|
return h("p", { class: "qm-link-text", onClick: () => toDetail(row) }, [
|
|
- h("i", {
|
|
|
|
- class: [
|
|
|
|
- "icon",
|
|
|
|
- "qm-mr-10",
|
|
|
|
- row.hasRead ? "icon-sms-read" : "icon-sms-unread",
|
|
|
|
- ],
|
|
|
|
|
|
+ h(NIcon, {
|
|
|
|
+ component: row.hasRead ? MailOpen : MailUnread,
|
|
|
|
+ size: 18,
|
|
|
|
+ class: "qm-mr-10 qm-vertical-mid",
|
|
|
|
+ color: row.hasRead ? "#999" : "#2d8cf0",
|
|
}),
|
|
}),
|
|
h("span", {}, row.title),
|
|
h("span", {}, row.title),
|
|
]);
|
|
]);
|
|
@@ -46,18 +46,6 @@ const pagination = $ref({
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
-const getList = async () => {
|
|
|
|
- const res = await messageListApi(store.user.id, store.siteMessagesTimeStamp);
|
|
|
|
- const messages = res.data.map((item) => {
|
|
|
|
- let nitem = { ...item };
|
|
|
|
- if (item.hasRecalled) {
|
|
|
|
- nitem.title = "发送者已撤回消息:" + nitem.title;
|
|
|
|
- nitem.content = "该消息已经被发送者撤回。";
|
|
|
|
- }
|
|
|
|
- return nitem;
|
|
|
|
- });
|
|
|
|
- store.siteMessage.messages = messages;
|
|
|
|
-};
|
|
|
|
const selectedChange = (ids: RowKey[]) => {
|
|
const selectedChange = (ids: RowKey[]) => {
|
|
selectedMessageIds = ids;
|
|
selectedMessageIds = ids;
|
|
};
|
|
};
|
|
@@ -73,11 +61,11 @@ const toMarkRead = async () => {
|
|
await updateNotieReadStatusApi(selectedMessageIds.join());
|
|
await updateNotieReadStatusApi(selectedMessageIds.join());
|
|
message.success("修改成功!");
|
|
message.success("修改成功!");
|
|
store.updateSiteMessagesTimeStamp();
|
|
store.updateSiteMessagesTimeStamp();
|
|
- void getList();
|
|
|
|
|
|
+ void store.fetchSiteMessage();
|
|
};
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- void getList();
|
|
|
|
|
|
+ void store.fetchSiteMessage();
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -85,7 +73,8 @@ onMounted(() => {
|
|
<div class="box-justify qm-mb-20">
|
|
<div class="box-justify qm-mb-20">
|
|
<h3 class="qm-big-text">公告通知</h3>
|
|
<h3 class="qm-big-text">公告通知</h3>
|
|
<n-button @click="toMarkRead"
|
|
<n-button @click="toMarkRead"
|
|
- ><i class="icon icon-message-read qm-mr-10"></i> 标记为已读</n-button
|
|
|
|
|
|
+ ><n-icon class="qm-mr-5" :component="MailOpen" :size="16"></n-icon
|
|
|
|
+ >标记为已读</n-button
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
<div class="part-box">
|
|
<div class="part-box">
|