xiatian há 5 anos atrás
pai
commit
30cbfa1c1b

+ 13 - 4
src/modules/portal/views/home/SiteMessageDetail.vue

@@ -55,13 +55,21 @@ export default {
           this.$route.params.id;
         this.$httpWithMsg.post(url).then(() => {});
       }
+    },
+    init() {
+      var url = EXAM_WORK_API + "/notice/" + this.$route.params.id;
+      this.$httpWithMsg.get(url).then(response => {
+        this.message = response.data;
+      });
     }
   },
   created() {
-    var url = EXAM_WORK_API + "/notice/" + this.$route.params.id;
-    this.$httpWithMsg.get(url).then(response => {
-      this.message = response.data;
-    });
+    this.init();
+  },
+  watch: {
+    $route: function() {
+      this.init();
+    }
   }
 };
 </script>
@@ -86,5 +94,6 @@ export default {
   background-color: #ffffff;
   text-align: center;
   min-height: 400px;
+  overflow-y: auto;
 }
 </style>

+ 9 - 4
src/modules/portal/views/home/SiteMessageHome.vue

@@ -18,6 +18,14 @@
             >
               返回
             </el-button>
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-refresh"
+              @click="searchForm"
+            >
+              刷新
+            </el-button>
             <el-button
               size="small"
               type="primary"
@@ -157,14 +165,11 @@ export default {
           });
         })
         .finally(() => (this.loading = false));
-    },
-    init() {
-      this.searchForm();
     }
   },
   //初始化查询
   created() {
-    this.init();
+    this.searchForm();
   }
 };
 </script>

+ 22 - 8
src/modules/portal/views/home/SiteMessagePopup.vue

@@ -22,12 +22,14 @@
         {{ unreadMessageContent }}
       </p>
       <div style="text-align: left; margin-left: 20px; margin-bottom: 10px;">
-        <router-link :to="'/home/site-message/' + unreadMessage.id">
-          详情 >>>
-        </router-link>
         <span
-          @click="ignoreMessage"
-          style="display: inline-block; margin-left: 20px; cursor: pointer;"
+          @click="toDetail"
+          style="display: inline-block; margin-left: 20px; cursor: pointer;color: #2d8cf0;"
+          >详情</span
+        >
+        <span
+          @click="ignoreMessage(null)"
+          style="display: inline-block; margin-left: 20px; cursor: pointer;color: #777;"
           >忽略</span
         >
       </div>
@@ -52,8 +54,19 @@ export default {
     };
   },
   methods: {
-    ignoreMessage() {
-      this.ignoreMessageIds.push(this.unreadMessage.id + "-" + this.user.id);
+    toDetail() {
+      let unid = this.unreadMessage.id;
+      this.ignoreMessage(unid);
+      this.$router.push({
+        path: "/home/site-message/" + unid
+      });
+    },
+    ignoreMessage(id) {
+      let unid = this.unreadMessage.id;
+      if (id) {
+        unid = id;
+      }
+      this.ignoreMessageIds.push(unid + "-" + this.user.id);
       window.sessionStorage.setItem(
         "ignoreMessageIds",
         JSON.stringify(this.ignoreMessageIds)
@@ -87,7 +100,8 @@ export default {
             this.ignoreMessageIds.includes(v.id + "-" + this.user.id) === false
         )
         .reverse();
-      this.$emit("changeUnreadMessageCount", unreadMessages.length);
+      const unreads = this.siteMessages.filter(v => v.hasRead === false);
+      this.$emit("changeUnreadMessageCount", unreads.length);
       if (unreadMessages.length > 0) {
         return unreadMessages[0];
       } else {