Prechádzať zdrojové kódy

接入消息数量统计接口

LinWuTai 1 týždeň pred
rodič
commit
768cb98aff
2 zmenil súbory, kde vykonal 8 pridanie a 5 odobranie
  1. 0 1
      pages/chat/chat.vue
  2. 8 4
      pages/index/index.vue

+ 0 - 1
pages/chat/chat.vue

@@ -154,7 +154,6 @@
 				})
 			}
 		})
-		
 	})
 </script>
 

+ 8 - 4
pages/index/index.vue

@@ -84,6 +84,7 @@
 	import {
 		useAuthStore
 	} from '@/store/authStore'
+	import { count } from '@/api/chat.js'
 	const authStore = useAuthStore()
 	// 屏幕状态栏高度
 	const statusBarHeight = ref(0)
@@ -267,10 +268,13 @@
 		})
 	})
 	onLoad(() => {
-		console.log(isLogin);
-		uni.setTabBarBadge({ //显示数字
-			index: 1, //tabbar下标
-			text: '999' //数字
+		count().then(res => {
+			if (res && res.message === 'success') {
+				uni.setTabBarBadge({ //显示数字
+					index: 1, //tabbar下标
+					text: `${res.data.amount}` ?? '0' //数字
+				})
+			}
 		})
 	})
 </script>