|
@@ -13,7 +13,7 @@
|
|
公告通知
|
|
公告通知
|
|
</div>
|
|
</div>
|
|
<i-button>
|
|
<i-button>
|
|
- <div class="mark-read-block">
|
|
|
|
|
|
+ <div class="mark-read-block" @click="markRead">
|
|
<img src="./svgs/sms-read.svg" /> 标记为已读
|
|
<img src="./svgs/sms-read.svg" /> 标记为已读
|
|
</div>
|
|
</div>
|
|
</i-button>
|
|
</i-button>
|
|
@@ -23,14 +23,15 @@
|
|
border
|
|
border
|
|
ref="selection"
|
|
ref="selection"
|
|
:columns="columns"
|
|
:columns="columns"
|
|
- :data="messageList"
|
|
|
|
|
|
+ :data="siteMessages"
|
|
></Table>
|
|
></Table>
|
|
</div>
|
|
</div>
|
|
</main-layout>
|
|
</main-layout>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import moment from "moment";
|
|
|
|
|
|
+// import moment from "moment";
|
|
|
|
+import { mapState, mapMutations } from "vuex";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "SiteMessageHome",
|
|
name: "SiteMessageHome",
|
|
@@ -46,14 +47,6 @@ export default {
|
|
title: "标题",
|
|
title: "标题",
|
|
key: "title",
|
|
key: "title",
|
|
render: (h, params) => {
|
|
render: (h, params) => {
|
|
- // return h("div", [
|
|
|
|
- // h("Icon", {
|
|
|
|
- // props: {
|
|
|
|
- // type: "person",
|
|
|
|
- // },
|
|
|
|
- // }),
|
|
|
|
- // h("strong", params.row.title),
|
|
|
|
- // ]);
|
|
|
|
return (
|
|
return (
|
|
<router-link
|
|
<router-link
|
|
to={"/site-message/" + params.row.id}
|
|
to={"/site-message/" + params.row.id}
|
|
@@ -77,37 +70,46 @@ export default {
|
|
width: "150",
|
|
width: "150",
|
|
},
|
|
},
|
|
],
|
|
],
|
|
- messageList: [],
|
|
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- async created() {
|
|
|
|
- try {
|
|
|
|
- const noticeRes = (await this.$http.get(
|
|
|
|
- "/api/ecs_exam_work/notice/getUserNoticeList"
|
|
|
|
- )).data;
|
|
|
|
- // const noticeRes = [
|
|
|
|
- // {
|
|
|
|
- // content: "<div>公告<img src='./svgs/sms-read.svg' /></div>",
|
|
|
|
- // hasRead: true,
|
|
|
|
- // id: 0,
|
|
|
|
- // publishTime: "2019-07-08T11:23:34.646Z",
|
|
|
|
- // publisher: "string",
|
|
|
|
- // title: "string",
|
|
|
|
- // },
|
|
|
|
- // ];
|
|
|
|
- // noticeRes.forEach(
|
|
|
|
- // v =>
|
|
|
|
- // (v.publishTime = moment(v.publishTime).format("YYYY-MM-DD hh:mm:ss"))
|
|
|
|
- // );
|
|
|
|
- this.messageList = noticeRes;
|
|
|
|
- } catch (error) {
|
|
|
|
- this.$Message.error({
|
|
|
|
- content: "获取公告通知异常",
|
|
|
|
- duration: 15,
|
|
|
|
- closable: true,
|
|
|
|
- });
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
|
|
+ async mounted() {
|
|
|
|
+ window._hmt.push(["_trackEvent", "站内消息列表页面", "进入页面"]);
|
|
|
|
+ await this.getList();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ ...mapMutations(["updateSiteMessages", "updateSiteMessagesTimeStamp"]),
|
|
|
|
+ async getList() {
|
|
|
|
+ try {
|
|
|
|
+ const noticeRes = (await this.$http.get(
|
|
|
|
+ "/api/ecs_exam_work/notice/getUserNoticeList?" +
|
|
|
|
+ this.user.id +
|
|
|
|
+ this.siteMessagesTimeStamp
|
|
|
|
+ )).data;
|
|
|
|
+ this.updateSiteMessages(noticeRes);
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error);
|
|
|
|
+ this.$Message.error({
|
|
|
|
+ content: "获取公告通知异常",
|
|
|
|
+ duration: 15,
|
|
|
|
+ closable: true,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ async markRead() {
|
|
|
|
+ // console.log(this.$refs.selection.getSelection());
|
|
|
|
+ const selectIds = this.$refs.selection.getSelection().map(v => v.id);
|
|
|
|
+
|
|
|
|
+ await this.$http.post(
|
|
|
|
+ "/api/ecs_exam_work/notice/updateNoticeReadStatus?noticeId=" +
|
|
|
|
+ selectIds.join(",")
|
|
|
|
+ );
|
|
|
|
+ window._hmt.push(["_trackEvent", "站内消息详情页面", "发送已读成功"]);
|
|
|
|
+ this.updateSiteMessagesTimeStamp(Date.now());
|
|
|
|
+ await this.getList();
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapState(["user", "siteMessages", "siteMessagesTimeStamp"]),
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|