diff --git a/components/VNavigationBar.vue b/components/VNavigationBar.vue index 27bd040..00718e1 100644 --- a/components/VNavigationBar.vue +++ b/components/VNavigationBar.vue @@ -19,6 +19,9 @@ {{ title }} + + + @@ -46,6 +49,10 @@ export default { leftTitle: { type: Boolean, default: false + }, + showClear: { + type: Boolean, + default: false } }, mounted() { @@ -78,6 +85,9 @@ export default { methods: { back() { uni.navigateBack() + }, + clearNoReadFun(){ + this.$emit('clearNoRead') } } } @@ -109,5 +119,13 @@ export default { font-size: 36rpx; font-weight: bold; } + .navigationBarIcon { + display: flex; + } + .clear-icon{ + width: 40rpx; + height: 40rpx; + border-radius: 50%; + } } diff --git a/pages-home/home/home.vue b/pages-home/home/home.vue index 9cc4c3c..93e78fc 100644 --- a/pages-home/home/home.vue +++ b/pages-home/home/home.vue @@ -3,14 +3,18 @@ - - - - + + + + {{ userInfo.nickname }} {{ userInfo.roleNames }} - + + + {{noReadNum}} + + @@ -54,6 +58,14 @@ + + + + + 你有{{noticeNum}}条来自平台的通知公告 + + + @@ -163,7 +175,11 @@ export default { workingNum:0, doneNum:0 }, - defaultAvatar: require('@/static/icons/avatar.png') + defaultAvatar: require('@/static/icons/avatar.png'), + //未读消息数量 + noReadNum:0, + //通知公告数量 + noticeNum:0, } }, onLoad(){ @@ -185,6 +201,8 @@ export default { }else{ //直接取缓存中的用户信息 this.userInfo = getUserInfo() + this.getNoReadNum() + this.getNoticeList() this.onRefresherrefresh() if(this.userInfo.roleCodes.includes('repair_staff')){ //维修工 @@ -199,6 +217,12 @@ export default { } }, methods: { + gotoMsg(){ + //去消息中心 + uni.navigateTo({ + url: '/pages-home/msg/message' + }) + }, /** * 上滑加载数据 */ @@ -392,7 +416,49 @@ export default { uni.navigateTo({ url: '/pages-home/service/applyList' }) - } + }, + /** + * 获取未读消息数量 + * @returns {Promise} + */ + async getNoReadNum(){ + await request({ + url: "/admin-api/system/notify-message/get-unread-count", + method: "GET" + }).then((res) => { + if(res.code==200){ + this.noReadNum = res.data>99?99:res.data + } + }) + }, + /** + * 跳转通知公告列表页 + */ + gotoNotice(){ + uni.navigateTo({ + url: '/pages-home/notice/notice' + }) + }, + /** + * 查通知公告--查数量 + */ + async getNoticeList(){ + const res = await request({ + url: "/admin-api/base/notice/page", + method: "get", + params: { + pageNo:1, + pageSize:1, + type:1, + parentServer: "weixiu", + server: "app" + }, + tenantIdFlag:false + }) + if(res.code==200){ + this.noticeNum = res.data.total + } + }, } } @@ -459,6 +525,25 @@ export default { padding: 8rpx 16rpx; } } + + .msg-box{ + position: relative; + margin-right: 40rpx; + .msg-num{ + position: absolute; + right: -15rpx; + color: white; + background: #d74a43; + width: 35rpx; + height: 35rpx; + line-height: 35rpx; + text-align: center; + font-weight: 800; + font-size: 11px; + border-radius: 50%; + top: -15rpx; + } + } } .body-top-grid { display: grid; @@ -556,7 +641,30 @@ export default { } } } + .notice-dom { + margin: 40rpx 32rpx; + background: #FFFFFF; + border-radius: 8rpx 8rpx 8rpx 8rpx; + padding: 20rpx; + display: flex; + align-items: center; + .notice-box{ + display: flex; + width: 100%; + .left-img{ + width: 48rpx; + height: 48rpx; + } + .center-text{ + width: calc(100% - 70rpx); + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + padding:0 20rpx; + } + } + } .orderCount { margin: 40rpx 32rpx; background: #FFFFFF; diff --git a/pages-home/msg/message.vue b/pages-home/msg/message.vue new file mode 100644 index 0000000..a9b005f --- /dev/null +++ b/pages-home/msg/message.vue @@ -0,0 +1,253 @@ + + + + + diff --git a/pages-home/notice/notice.vue b/pages-home/notice/notice.vue new file mode 100644 index 0000000..2421de1 --- /dev/null +++ b/pages-home/notice/notice.vue @@ -0,0 +1,194 @@ + + + + + diff --git a/pages-home/notice/noticeContent.vue b/pages-home/notice/noticeContent.vue new file mode 100644 index 0000000..fe71858 --- /dev/null +++ b/pages-home/notice/noticeContent.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/pages-home/static/msg.png b/pages-home/static/msg.png new file mode 100644 index 0000000..4e3dbf4 Binary files /dev/null and b/pages-home/static/msg.png differ diff --git a/pages-home/static/notice.png b/pages-home/static/notice.png new file mode 100644 index 0000000..ae0d7d1 Binary files /dev/null and b/pages-home/static/notice.png differ diff --git a/pages-warehouse/home/home.vue b/pages-warehouse/home/home.vue index ecfb038..31412e0 100644 --- a/pages-warehouse/home/home.vue +++ b/pages-warehouse/home/home.vue @@ -3,18 +3,31 @@ - - + - - + {{ userInfo.nickname }} {{ userInfo.roleNames }} - + + + {{noReadNum}} + + + + + + + 你有{{ noticeNum }}条来自平台的通知公告 + + + + } + */ + async getNoReadNum(){ + await request({ + url: "/admin-api/system/notify-message/get-unread-count", + method: "GET" + }).then((res) => { + if(res.code==200){ + this.noReadNum = res.data>99?99:res.data + } + }) + }, + /** + * 跳转通知公告列表页 + */ + gotoNotice(){ + uni.navigateTo({ + url: '/pages-home/notice/notice' + }) + }, + /** + * 查通知公告--查数量 + */ + async getNoticeList(){ + const res = await request({ + url: "/admin-api/base/notice/page", + method: "get", + params: { + pageNo:1, + pageSize:1, + type:1, + parentServer: "weixiu", + server: "app" + }, + tenantIdFlag:false + }) + if(res.code==200){ + this.noticeNum = res.data.total + } + }, } } @@ -302,6 +368,31 @@ export default { flex-direction: column; } + .notice-dom { + margin: 40rpx 32rpx; + background: #FFFFFF; + border-radius: 8rpx 8rpx 8rpx 8rpx; + padding: 20rpx; + display: flex; + align-items: center; + + .notice-box{ + display: flex; + + .left-img{ + width: 48rpx; + height: 48rpx; + } + .center-text{ + width: calc(100% - 130rpx); + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + padding:0 20rpx; + } + } + } + .userInfoBox { margin: 0 32rpx 40rpx; @@ -330,6 +421,25 @@ export default { padding: 8rpx 16rpx; } } + + .msg-box{ + position: relative; + margin-right: 40rpx; + .msg-num{ + position: absolute; + right: -15rpx; + color: white; + background: #d74a43; + width: 35rpx; + height: 35rpx; + line-height: 35rpx; + text-align: center; + font-weight: 800; + font-size: 11px; + border-radius: 50%; + top: -15rpx; + } + } } .body-top { diff --git a/pages.json b/pages.json index a348fd6..7773820 100644 --- a/pages.json +++ b/pages.json @@ -129,6 +129,24 @@ "navigationBarTitleText": "" } }, + { + "path": "msg/message", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "notice/notice", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "notice/noticeContent", + "style": { + "navigationBarTitleText": "" + } + }, { "path": "service/todoDetail", "style": { diff --git a/static/images/clear.png b/static/images/clear.png new file mode 100644 index 0000000..2c0f153 Binary files /dev/null and b/static/images/clear.png differ