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