Fix:4895 【商城小程序】用户看完新消息后,首页红点数字提示未消除
This commit is contained in:
@@ -124,6 +124,7 @@ export default {
|
||||
this.fetchUnreadCount()
|
||||
} else {
|
||||
this.unreadCount = 0
|
||||
uni.$emit('updateUnreadMessageCount', 0)
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -133,8 +134,23 @@ export default {
|
||||
if (this.isLogin) {
|
||||
this.fetchUnreadCount()
|
||||
}
|
||||
uni.$on('updateUnreadMessageCount', this.handleUpdateUnreadMessageCount)
|
||||
},
|
||||
beforeDestroy() {
|
||||
uni.$off('updateUnreadMessageCount', this.handleUpdateUnreadMessageCount)
|
||||
},
|
||||
methods: {
|
||||
handleUpdateUnreadMessageCount(count) {
|
||||
if (!this.isLogin) {
|
||||
this.unreadCount = 0
|
||||
return
|
||||
}
|
||||
if (typeof count === 'number') {
|
||||
this.unreadCount = count
|
||||
} else {
|
||||
this.fetchUnreadCount()
|
||||
}
|
||||
},
|
||||
getElementData(el) {
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
query.select(el).boundingClientRect().exec((res)=> {
|
||||
@@ -155,12 +171,16 @@ export default {
|
||||
getUnreadMessageCount().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.unreadCount = data || 0
|
||||
const count = data || 0
|
||||
this.unreadCount = count
|
||||
uni.$emit('updateUnreadMessageCount', count)
|
||||
} else {
|
||||
this.unreadCount = 0
|
||||
uni.$emit('updateUnreadMessageCount', 0)
|
||||
}
|
||||
}).catch(() => {
|
||||
this.unreadCount = 0
|
||||
uni.$emit('updateUnreadMessageCount', 0)
|
||||
})
|
||||
},
|
||||
gotoPage(url, type = 1, index) {
|
||||
|
||||
+2
-1
@@ -440,6 +440,7 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
this.isEdit = false
|
||||
uni.$emit('updateUnreadMessageCount')
|
||||
if (!this.isLoad) {
|
||||
return
|
||||
}
|
||||
@@ -1222,4 +1223,4 @@ view {
|
||||
background-color: #C52733;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -242,6 +242,7 @@ export default {
|
||||
this.queryGuide('findFunIndex')
|
||||
},
|
||||
onShow() {
|
||||
uni.$emit('updateUnreadMessageCount')
|
||||
const memCityName = uni.getStorageSync('cityName')
|
||||
// this.typeIndex = 0
|
||||
this.name = ''
|
||||
|
||||
@@ -497,6 +497,7 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
this.pageToShowHandle()
|
||||
uni.$emit('updateUnreadMessageCount')
|
||||
},
|
||||
onHide() {
|
||||
this.pageToHideHandle()
|
||||
@@ -2002,4 +2003,4 @@ export default {
|
||||
.price-wrap{
|
||||
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -402,6 +402,7 @@ export default {
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
uni.$emit('updateUnreadMessageCount')
|
||||
if (this.$store.getters.token) {
|
||||
this.isNoLogin = false
|
||||
uni.showLoading({
|
||||
|
||||
@@ -111,6 +111,7 @@ export default {
|
||||
*/
|
||||
toMessage() {
|
||||
markMessagesAsRead().then(res => {
|
||||
uni.$emit('updateUnreadMessageCount', 0)
|
||||
uni.navigateTo({url: '/pkg_common/views/message'})
|
||||
})
|
||||
},
|
||||
@@ -120,7 +121,9 @@ export default {
|
||||
*/
|
||||
getUnreadMessageCount(item) {
|
||||
getUnreadMessageCount().then(res => {
|
||||
this.unreadNum = res.data
|
||||
const count = res.data || 0
|
||||
this.unreadNum = count
|
||||
uni.$emit('updateUnreadMessageCount', count)
|
||||
})
|
||||
},
|
||||
goRoom(item) {
|
||||
@@ -279,4 +282,4 @@ export default {
|
||||
box-sizing: border-box;
|
||||
padding: 4rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user