<script>
	import {
		conn
	} from "./utils/WebIM";
	import {
		initEid
	} from "./mp_ecard_sdk/main";
	// import {
	// 	index
	// } from "@/units/inquire.js"
	export default {
		onLaunch: function() {
			initEid();

			// console.log('App Launch')
			setTimeout(() => {
				if (uni.getStorageSync("token")) {
					this.HXlogin();
					/* if (uni.getStorageSync("company_id") == 0) {
						if (getCurrentPages()[0].route != 'pages/login/login') {
							uni.reLaunch({
								url: "/pages/login/login"
							})
						}
					} else {
						index().then(res => {
							if (res.code != 1) {
								if (getCurrentPages()[0].route != 'pages/login/login') {
									uni.reLaunch({
										url: "/pages/login/login"
									})
								}
							}
						})
					} */
				} else {
					// if (getCurrentPages()[0].route != 'pages/login/login') {
					// 	uni.reLaunch({
					// 		url: "/pages/login/login"
					// 	})
					// }
				}
			}, 800);
		},
		onShow: function() {
			// console.log('App Show')
		},
		onHide: function() {
			// console.log('App Hide')
		},
		methods: {
			HXlogin() {
				// logger.enableAll();
				if (uni.getStorageSync("user_no") && uni.getStorageSync("pwd")) {
					var user_no = uni.getStorageSync("user_no");
					var pwd = uni.getStorageSync("pwd");
					conn
						.open({
							user: user_no,
							pwd: pwd,
							appKey: conn.appkey,
						})
						.then(() => {
							console.log("res");
						})
						.catch((reason) => {
							console.log("失败", reason);
						});
				}
			},
		},
	};
</script>

<style lang="scss">
	page {
		background-color: #f4f4f4;
	}

	.uni-bar {
		background-color: #f4f4f4;
	}

	/*每个页面公共css */
	@import "@/uview-ui/index.scss";
</style>