<script>
	import IMSDK from "openim-uniapp-polyfill";
	export default {
		onLaunch: function() {
			// #ifndef APP
			console.error(
				`暂时不支持运行到 Web或小程序端，如果需要移动端的 Web 项目，参考 [H5 demo](https://github.com/openimsdk/openim-h5-demo)`
			);
			return ;
			// #endif
			this.init();
		},
		onShow: function() {
			var args= plus.runtime.arguments;
			if(args){
				// 处理args参数，如直达到某新页面等
				console.log(args);
			}
			//console.log("App Show");
			// #ifdef APP
			IMSDK.asyncApi(IMSDK.IMMethods.SetAppBackgroundStatus, IMSDK.uuid(), false);
			// #endif
			//console.log(this.$store.state.contact);
		},
		onHide: function() {
			//console.log("App Hide");
			// #ifdef APP
			IMSDK.asyncApi(IMSDK.IMMethods.SetAppBackgroundStatus, IMSDK.uuid(), true);
			// #endif
		},
		methods: {
			init(){
				this.$store.dispatch("system/getConfig");
				const IMToken = uni.getStorageSync("IMToken");
				const IMUserID = uni.getStorageSync("IMUserID")+'';
				if (IMToken && IMUserID) {
					uni.navigateTo({
						url: "/pages/index/launch"
					});
				}else{
					uni.navigateTo({
						url: "/pages/common/login/index"
					});
				}
			}
		}
	};
</script>

<style lang="scss">
	/*每个页面公共css */
	text,view{
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
	}
	@import "@/uni_modules/uview-ui/index.scss";
	@import "@/styles/login.scss";
	@import "@/styles/global.scss";

	uni-page-body {
		height: 100vh;
		overflow: hidden;
	}

	.uni-tabbar .uni-tabbar__icon {
		width: 28px !important;
		height: 28px !important;
	}
</style>