Browse Source

add unread number

pull/13/head
zhangtao 1 year ago
parent
commit
34473ae4fe
7 changed files with 42 additions and 8 deletions
  1. +10
    -0
      api/mine.js
  2. +2
    -1
      package_first/pages/ProtectionActivity/index.json
  3. +2
    -2
      package_first/pages/ProtectionActivity/index.wxml
  4. +3
    -3
      package_first/pages/ProtectionActivity/index.wxss
  5. +12
    -1
      pages/mine/index.js
  6. +2
    -1
      pages/mine/index.wxml
  7. +11
    -0
      pages/mine/index.wxss

+ 10
- 0
api/mine.js View File

@@ -86,4 +86,14 @@ export const readAll = function (data) {
method: 'PUT',
data
})
}
/**
* 全部已读
*/
export const messageSum = function (data) {
return request({
url: '/message/sum',
method: 'get',
data
})
}

+ 2
- 1
package_first/pages/ProtectionActivity/index.json View File

@@ -3,5 +3,6 @@
"list": "../../../components/List/index",
"ImageList": "../../../components/ImageList/index"
},
"navigationStyle": "custom"
"navigationBarTitleText": "护河活动",
"navigationBarBackgroundColor": "#2C81F6"
}

+ 2
- 2
package_first/pages/ProtectionActivity/index.wxml View File

@@ -1,8 +1,8 @@
<!--package_first/pages/ProtectionActivity/index.wxml-->
<view class="pageContainer">
<!-- <view class="pageContainer">
<image class="navBg" mode="widthFix" src="../../../assets/img/activitytitle.png" />
<image class="home" bindtap="homepage" src="../../../assets/img/back.png" mode=""/>
</view>
</view> -->
<view class="activity_container">
<view class="top">
<image class="activity_bg" src="../../../assets/img/activitybg.png" mode=""/>

+ 3
- 3
package_first/pages/ProtectionActivity/index.wxss View File

@@ -1,12 +1,12 @@
/* package_first/pages/ProtectionActivity/index.wxss */

.navBg {
/* .navBg {
width: 100%;
position: absolute;
top: 0;
}
} */
.activity_container{
margin-top: 175rpx;
/* margin-top: 175rpx; */
width: 103%;
height: 1664rpx;
background-color: #F2F3F6;

+ 12
- 1
pages/mine/index.js View File

@@ -1,5 +1,6 @@
// pages/mine/index.js
import {getUserData} from '../../api/login.js'
import {messageSum} from '../../api/mine.js'
Page({

/**
@@ -13,10 +14,11 @@ Page({
{title: '我的兑换', type: 'exchange', path: '/package_mine/pages/exchange/index'},
{title: '河湖问题反馈', type: 'feedback', path: '/package_mine/pages/records/index'},
// {title: '我的美拍', type: 'beauty', path: '/package_mine/pages/beauties/index'},
{title: '消息通知', type: 'notice', path: '/package_mine/pages/notice/index'},
{title: '消息通知', type: 'notice', path: '/package_mine/pages/notice/index',showNumbers: true},
],
myId: '', // 身份
integral: 0, // 积分
numbers: 0
},

/**
@@ -30,6 +32,7 @@ Page({
},
onShow:function() {
this.getUserInfo()
this.getUnReadNums()
},

goRecords(e) {
@@ -52,6 +55,14 @@ Page({
this.setData({userInfo})
})
},
getUnReadNums(){
const openId = wx.getStorageSync('openid')
messageSum({openId}).then(res=>{
this.setData({
numbers: res.data || 0
})
})
},
// 进入申请身份页面
goApprove() {
wx.navigateTo({

+ 2
- 1
pages/mine/index.wxml View File

@@ -21,7 +21,8 @@
<view class="function_item" wx:for="{{list}}" wx:key="index" bindtap="goRecords" data-path="{{item.path}}">
<view class="item_title">
<image style="height: 60rpx;width: 60rpx;margin-right: 20rpx;" src="{{'../../assets/img/'+ item.type +'.png'}}"></image>
<text style="font-size: 26rpx;">{{item.title}}</text>
<view style="font-size: 26rpx;z-index:99">{{item.title}}</view>
<text wx:if="{{item.showNumbers && numbers > 0}}" class="badge">{{numbers > 99 ? '99+' : numbers }}</text>
</view>
<image style="height: 30rpx;width: 30rpx;" src="../../assets/img/more.png"></image>
</view>

+ 11
- 0
pages/mine/index.wxss View File

@@ -94,4 +94,15 @@
display: flex;
justify-content: flex-start;
align-items: center;
}

.badge{
background: #E73F3F;
border-radius: 10px;
padding: 0 15rpx;
color: #FFFFFF;
font-size: 24rpx;
position: relative;
top: -10rpx;
right: 20rpx;
}

Loading…
Cancel
Save