<script>
// import WebSocketManager from '@/utils/WebSocketManager.js';
import { watch } from 'vue';
import store from '@/store'
export default {
	data:{
		userId: uni.getStorageSync('userId') //读取本地存储
	},
	onLaunch: function () {
		console.log('App Launch')
		
	},
	onShow: function () {
		//设置默认角色
		 uni.setStorageSync('userType', 1);
		console.log('App Show')
	},
	onHide: function () {
		console.log('App Hide')
	},
	watch: {
        userId: {
            handler() {
                // console.log('yong---------------',this.userId);
				// const wsManager = new WebSocketManager(this.userId);
				// // 设置消息回调
				// wsManager.onMessage(data => {
				// 	console.log('app-接收到的消息:', data);
				// 	// 处理消息逻辑
				// 	if(data.type === 'msgUnreadCount'){
				// 		store.dispatch('handleMessageCount',data.data)
				// 	}
				// });
				// // 建立连接
				// wsManager.connect();
            },
            immediate: true,
            deep: true
        }
    },
	onMounted() { 
		 
		console.log("TCL: onMounted -> onMounted", onMounted)
		
	},
}
</script>

<style lang="scss">
@import "uview-plus/index.scss";
@import '@/static/scss/index.scss';
</style>