zhaoxiaohai 2 роки тому
батько
коміт
49de6e7bbb
2 змінених файлів з 14 додано та 5 видалено
  1. 9 3
      pages/tabbar/home/index.js
  2. 5 2
      pages/tabbar/home/index.wxml

+ 9 - 3
pages/tabbar/home/index.js

@@ -9,6 +9,7 @@ Page({
         annunciateList: [], //通告列表
         gridList: [],
         showAnnunciate: false, //显示最新通告
+        unreadNum: 0, //通告未读
     },
 
     /**
@@ -87,7 +88,8 @@ Page({
             console.log("通告列表", res)
             if (res.msg != '成功') return this.queryNoticeList(i + 1);
             this.setData({
-                annunciateList: res.data
+                annunciateList: res.data,
+                unreadNum: res.total - res.tips.readNum
             })
         })
     },
@@ -109,8 +111,12 @@ Page({
     },
     /* 去通告 */
     toAnnunciate() {
-        wx.navigateTo({
-            url: '/pages/annunciate/index'
+        this.applications({
+            currentTarget: {
+                dataset: {
+                    item: this.data.gridList.find(v => v.name == '通告')
+                }
+            }
         })
     },
     /**

+ 5 - 2
pages/tabbar/home/index.wxml

@@ -52,8 +52,11 @@
 <!-- 通告 -->
 <My_card wx:if="{{annunciateList.length>0 && showAnnunciate}}" title='最新通告' class="annunciate">
     <view class="unread" slot='title-r' bindtap="toAnnunciate">
-        12条未读
-        <view class="circle" />
+        <block wx:if="{{unreadNum!=0}}">
+            {{unreadNum}}条未读
+            <view class="circle" />
+        </block>
+        <block wx:else>查看全部</block>
         <van-icon class="icon" name="arrow" />
     </view>
     <block wx:for="{{annunciateList}}">