<script>
	export default {
		onLaunch: function() {
			// 设备高度
			const systemInfo = uni.getWindowInfo();
			uni.$windowHeight = systemInfo.windowHeight;
		},
		// 在页面的onShow生命周期中
		onShow() {
			// 尝试从本地存储中恢复数据
			const savedState = uni.getStorageSync('vuex_state');
			if (savedState) this.$store.replaceState(Object.assign({}, this.$store.state, savedState));
			if (this.$store.getters.user.userId) this.$chat.connect('workark' + this.$store.getters.user.userId);
		},
		// 在页面的onHide生命周期中
		onHide() {
			// 保存状态到本地存储
			uni.setStorageSync('vuex_state', this.$store.state);
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/static/scss/common.scss';

	page {
		background-color: $uv-bg-color;
		font-size: 28rpx;
	}
</style>