需新增:添加好友页面,优化各模块页面

This commit is contained in:
cbb
2026-01-22 17:04:43 +08:00
parent 57fec30165
commit 571e91b01c
17 changed files with 223 additions and 87 deletions

View File

@@ -5,7 +5,7 @@
@touchstart="handleTouchStart"
@touchend="handleTouchEnd"
>
<ConversationHeader>
<ConversationHeader :topCount="totalUnreadCount">
<TUISearch searchType="global" />
</ConversationHeader>
<ConversationNetwork />
@@ -28,7 +28,7 @@
import ConversationList from './conversation-list/index.vue'
import ConversationHeader from './conversation-header/index.vue'
import ConversationNetwork from './conversation-network/index.vue'
import { onHide } from '@dcloudio/uni-app'
import { onHide, onShow } from '@dcloudio/uni-app'
// #ifdef MP-WEIXIN
// uniapp packaged mini-programs are integrated by default, and the default initialization entry file is imported here
// TUIChatKit init needs to be encapsulated because uni vue2 will report an error when compiling H5 directly through conditional compilation
@@ -37,7 +37,7 @@
const emits = defineEmits(['handleSwitchConversation'])
const totalUnreadCount = ref(0)
const totalUnreadCount = ref('')
const headerRef = ref<typeof ConversationHeader>()
const conversationListDomRef = ref<typeof ConversationList>()
const touchX = ref<number>(0)
@@ -117,24 +117,24 @@
}
}
TUIStore.watch(StoreName.CONV, {
totalUnreadCount: (count: number) => {
totalUnreadCount.value = count
const tabBarIndex = getTabBarIndex() ?? -1
if (tabBarIndex >= 0) {
if (count > 0) {
uni.setTabBarBadge({
index: tabBarIndex,
text: count > 99 ? '99+' : count.toString()
})
} else {
uni.removeTabBarBadge({
index: tabBarIndex
})
}
}
}
})
// TUIStore.watch(StoreName.CONV, {
// totalUnreadCount: (count: number) => {
// totalUnreadCount.value = count
// const tabBarIndex = getTabBarIndex() ?? -1
// if (tabBarIndex >= 0) {
// if (count > 0) {
// uni.setTabBarBadge({
// index: tabBarIndex,
// text: count > 99 ? '99+' : count.toString()
// })
// } else {
// uni.removeTabBarBadge({
// index: tabBarIndex
// })
// }
// }
// }
// })
TUIStore.watch(StoreName.CUSTOM, {
isShowConversationHeader: (showStatus: boolean) => {
@@ -198,6 +198,25 @@
const getPassingRef = ref => {
ref.value = conversationListDomRef.value
}
onShow(async () => {
TUIStore.watch(StoreName.CONV, {
totalUnreadCount: (count: number) => {
if (count > 0) {
totalUnreadCount.value = count > 99 ? '99+' : String(count)
uni.setTabBarBadge({
index: 0,
text: count > 99 ? '99+' : count.toString()
})
} else {
totalUnreadCount.value = ''
uni.removeTabBarBadge({
index: 0
})
}
}
})
})
</script>
<style lang="scss" scoped src="./style/index.scss"></style>