Explorar o código

消息中心增加全部已读功能

sunlupeng hai 5 meses
pai
achega
a421432e29
Modificáronse 2 ficheiros con 18 adicións e 2 borrados
  1. 8 0
      src/api/allApi.js
  2. 10 2
      src/views/NoticeCenter.vue

+ 8 - 0
src/api/allApi.js

@@ -113,6 +113,14 @@ export function prizeList(query) {
   })
 }
 
+//用户阅读消息中心
+export function readAllMsg(query) {
+  return request({
+    url: '/mall-user/msg/readAll',
+    method: 'post',
+    params:query
+  })
+}
 
 //用户阅读消息中心
 export function readMsg(query) {

+ 10 - 2
src/views/NoticeCenter.vue

@@ -1,5 +1,6 @@
 <template>
   <div class="container">
+    <el-button type="primary" style="margin-top: 20px;" size="mini" @click="readAll">全部已读</el-button>
     <div class="notification-view">
       <div class="chat-view">
         <el-empty v-if="dataList.length==0" :image-size="200"></el-empty>
@@ -54,7 +55,7 @@
   </div>
 </template>
 <script>
-import { msgList,readMsg } from "@/api/allApi";
+import { msgList,readMsg,readAllMsg} from "@/api/allApi";
 import SiderInfo from '@/components/SiderInfo.vue';
 import { debounce } from '@/utils/index';
 export default{
@@ -75,6 +76,13 @@ export default{
     this.getDataList();
   },
   methods:{
+    readAll(){
+      readAllMsg().then(response=>{
+        this.page=1;
+        this.$store.dispatch('GetUserInfo');
+        this.getDataList();
+      })
+    },
     handleClickMag(val) {
       readMsg({msgId:val.msgId}).then(response=>{
         this.page=1;
@@ -148,7 +156,7 @@ export default{
     max-width: 960px;
 }
 .notification-view{
-  margin-top: 1.767rem;
+  margin-top: 1rem;
 }
 .chat-view{
     position: relative;