feat:单聊页面bug修复+后台管理端好友页面bug修复+项目进度、记忆文件更新
This commit is contained in:
@@ -1,14 +1,44 @@
|
||||
<script>
|
||||
/**
|
||||
* 应用入口
|
||||
*
|
||||
* 全局生命周期:
|
||||
* - onLaunch: 初始化 WebSocket 连接(如果用户已登录)和事件监听
|
||||
* - onShow: 检查 WebSocket 连接状态并恢复
|
||||
*/
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { useWebSocketStore } from '@/store/websocket'
|
||||
import { useChatStore } from '@/store/chat'
|
||||
import { useContactStore } from '@/store/contact'
|
||||
|
||||
export default {
|
||||
onLaunch: function () {
|
||||
onLaunch() {
|
||||
console.log('App Launch')
|
||||
this._initGlobalWS()
|
||||
},
|
||||
onShow: function () {
|
||||
onShow() {
|
||||
console.log('App Show')
|
||||
const userStore = useUserStore()
|
||||
const wsStore = useWebSocketStore()
|
||||
if (userStore.isLoggedIn && !wsStore.isConnected) {
|
||||
wsStore.connect()
|
||||
}
|
||||
},
|
||||
onHide: function () {
|
||||
onHide() {
|
||||
console.log('App Hide')
|
||||
},
|
||||
methods: {
|
||||
_initGlobalWS() {
|
||||
const userStore = useUserStore()
|
||||
if (!userStore.isLoggedIn) return
|
||||
const wsStore = useWebSocketStore()
|
||||
wsStore.connect()
|
||||
const chatStore = useChatStore()
|
||||
const contactStore = useContactStore()
|
||||
chatStore.initWsListeners()
|
||||
contactStore.initWsListeners()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user