<script>
	import {
		conn
	} from './utils/WebIM';
	import {
		index
	} from "@/units/inquire.js"
	export default {
		onLaunch: function() {
			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() {

		},
		onHide: function() {

		},
		methods: {
			HXlogin() {
				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">
	/*每个页面公共css */
	* {
		margin: 0;
		padding: 0;
	}

	@import "uview-ui/index.scss";

	.u-font-xs {
		font-size: 22rpx;
	}

	.u-font-sm {
		font-size: 26rpx;
	}

	.u-font-md {
		font-size: 28rpx;
	}

	.u-font-lg {
		font-size: 30rpx;
	}

	.u-font-xl {
		font-size: 34rpx;
	}

	.u-flex {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
	}

	.u-flex-wrap {
		flex-wrap: wrap;
	}

	.u-flex-nowrap {
		flex-wrap: nowrap;
	}

	.u-col-center {
		align-items: center;
	}

	.u-col-top {
		align-items: flex-start;
	}

	.u-col-bottom {
		align-items: flex-end;
	}

	.u-row-center {
		justify-content: center;
	}

	.safe-area-inset-bottom {
		padding-bottom: 0;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	}

	.u-row-left {
		justify-content: flex-start;
	}

	.u-row-right {
		justify-content: flex-end;
	}

	.u-row-between {
		justify-content: space-between;
	}

	.u-row-around {
		justify-content: space-around;
	}

	.u-text-left {
		text-align: left;
	}

	.u-text-center {
		text-align: center;
	}

	.u-text-right {
		text-align: right;
	}

	.u-flex-col {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
	}

	.u-flex-1 {
		flex: 1
	}

	.web_box {
		width: 100%;
		background: #F3F3F3;
		box-sizing: border-box;
		min-height: 100vh;
		// overflow: auto;
		position: relative;
	}

	.hflex {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
	}

	.vflex {
		display: flex;
		flex-direction: column;
		flex-wrap: nowrap;
	}

	.jbetween {
		justify-content: space-between;
	}

	.jaround {
		justify-content: space-around;
	}

	.jend {
		justify-content: flex-end;
	}

	.jcenter {
		justify-content: center;
	}

	.acenter {
		align-items: center;
	}

	.abetween {
		align-content: space-between;
	}

	.aaround {
		align-content: space-around;
	}

	.astart {
		align-items: flex-start !important;
	}

	.aend {
		align-items: flex-end;
	}

	.fwrap {
		flex-wrap: wrap;
	}

	.text_hide {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.text_hide3 {
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 3;
		line-clamp: 3;
		-webkit-box-orient: vertical;
	}

	.text_hide2 {
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.no_wrap {
		white-space: nowrap;
	}
</style>