Jelajahi Sumber

消息通知加上消息提醒

bayi 2 tahun lalu
induk
melakukan
e16cc82ab1

+ 13 - 1
custom-tab-bar/index.js

@@ -1,5 +1,17 @@
-// custom-tab-bar/index.js
+import {
+  storeBindingsBehavior
+} from 'mobx-miniprogram-bindings'
+import {
+  store
+} from '~/store/index'
 Component({
+  behaviors: [storeBindingsBehavior],
+  storeBindings: {
+    store,
+    fields: {
+      userInfo: 'userInfo'
+    },
+  },
   /**
    * 组件的属性列表
    */

+ 1 - 1
custom-tab-bar/index.less

@@ -23,7 +23,7 @@
 
     .noticeTips {
       position: absolute;
-      left: 11  6rpx;
+      left: 116rpx;
       top: -12rpx;
       width: 28rpx;
       padding: 4rpx 0rpx;

+ 1 - 1
custom-tab-bar/index.wxml

@@ -1,7 +1,7 @@
 <view class="tab-bar">
   <view wx:for="{{listTab}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}"
     bindtap="switchTab">
-    <view class="noticeTips" wx:if="{{item.pagePath=='/pages/my/index'}}">31</view>
+    <view class="noticeTips" wx:if="{{item.pagePath=='/pages/my/index'&&userInfo.messageCount>0}}">{{userInfo.messageCount}}</view>
     <image src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image>
     <view style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</view>
   </view>

+ 1 - 1
custom-tab-bar/index.wxss

@@ -23,7 +23,7 @@
 }
 .tab-bar .tab-bar-item .noticeTips {
   position: absolute;
-  left: 11  6rpx;
+  left: 116rpx;
   top: -12rpx;
   width: 28rpx;
   padding: 4rpx 0rpx;

+ 0 - 1
mixins/reachBottom.js

@@ -99,7 +99,6 @@ module.exports = Behavior({
           list,
         })
       }
-
     },
     resetData(data) {
       if (this.data.loading) return; // 如果接口已经在请求中,则不重置数据,防止用户持续下拉刷新

+ 1 - 1
pages/my/index.wxml

@@ -31,7 +31,7 @@
         <text class="title">作品 {{filters.numFilter(userInfo.readAmount)}}</text>
       </view>
       <view class="sBox" bindtap='jump' data-url="/pages/notice/index">
-        <view class="noticeTips">31</view>
+        <view class="noticeTips" wx:if="{{userInfo.user.messageCount>0}}">{{userInfo.user.messageCount}}</view>
         <image class="img" src="/static/message.png" mode="" />
         <text class="title">消息通知</text>
       </view>