shish 3 лет назад
Родитель
Сommit
d4fc14a98e
2 измененных файлов с 41 добавлено и 8 удалено
  1. 37 8
      ghsApp/src/admin/notice/index.vue
  2. 4 0
      ghsApp/src/api/notice/index.js

+ 37 - 8
ghsApp/src/admin/notice/index.vue

@@ -4,7 +4,10 @@
             <view class="tabs">
                 <Tabs :tabs="tabs" :currentTab="tabIndex" @change="changeTabEvent" itemWidth="33%"></Tabs>
             </view>
-            <scroll-view scroll-y class="allot-list">
+            <view @click="allRead" class="set-all-read">
+                全部置为已读
+            </view>
+            <view class="allot-list">
                 <block v-if="!$util.isEmpty(list.data)">
                     <view class="allot-item" v-for="(item, index) in list.data" :key="index" @click="goTo(item)" >
                         <view class="info">
@@ -17,7 +20,7 @@
                 <block v-else>
                     <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
                 </block>
-            </scroll-view>
+            </view>
         </view>
     </view>
 </template>
@@ -25,7 +28,7 @@
 import Tabs from "@/components/plugin/tabs";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import { list } from "@/mixins";
-import { getNotifyList,readNotify } from "@/api/notice";
+import { getNotifyList,readNotify,allReadNotify } from "@/api/notice";
 export default {
     name: "index",
     components: { Tabs, AppWrapperEmpty },
@@ -68,12 +71,24 @@ export default {
         }
     },
     methods: {
+        allRead(){
+            let that = this
+            this.$util.confirmModal({content:'确认全部设为已读?'},() => {
+                allReadNotify().then(res=>{
+                    if(res.code == 1){
+                        that.$msg(res.msg)
+                        that.resetList()
+                        that.getNoticeList()
+                    }
+                })
+            })
+        },
         init() {
-            this.getNoticeList();
+            this.getNoticeList()
         },
         getNoticeList() {
             return getNotifyList({read:this.tabs[this.tabIndex].key,page: this.list.page}).then(res => {
-                    this.completes(res);
+                this.completes(res)
             })
         },
         changeTabEvent(info) {
@@ -87,8 +102,10 @@ export default {
             }
         },
         goTo(item) {
-            item.read = 1
-            readNotify({id:item.id})
+            if(item.read == 0){
+                item.read = 1
+                readNotify({id:item.id})
+            }
             if (item.page && !this.$util.isEmpty(item.page)){
                 this.$util.pageTo({url: item.page})
             }
@@ -102,10 +119,22 @@ export default {
     display: flex;
     flex-direction: column;
     background-color: #f9fbfc;
+    .set-all-read{
+        width:190upx;
+        height:80upx;
+        line-height:80upx;
+        text-align:center;
+        bottom:10upx;
+        background-color: #3385FF;
+        border-radius: 60upx;
+        position: fixed;
+        color:white;
+        right:10upx;
+    }
     .allot-list {
         margin-top: 20upx;
         flex: 1;
-        padding-bottom: 30upx;
+        padding-bottom:100upx;
         .allot-item {
             margin-bottom: 1upx;
             padding: 30upx;

+ 4 - 0
ghsApp/src/api/notice/index.js

@@ -1,5 +1,9 @@
 import https from '@/plugins/luch-request_0.0.7/request'
 
+export const allReadNotify = data => {
+	return https.get('/notify/all-read', data)
+}
+
 export const getNotifyList = data => {
 	return https.get('/notify/list', data)
 }