<script>
	import {
		mapMutations
	} from 'vuex'
	import {
		version
	} from './package.json'


	import store from '@/store'
	
	import { getToken, setToken } from '@/common/auth'
	import { login } from '@/api/auth'

	export default {
		onLaunch: async function() {
			const url = 'http://127.0.0.1:8080/app/';
			//---------------------------------------------------------------
			// #ifdef H5
			if (!store.state.requestUrl) {
				store.commit('setRequestUrl', url + 'forward')
			}
			if (!getToken() || !store.state.hasLogin) {
				const userData = await login({ empNo: '012893' });
				setToken(userData.token);
				store.commit('setUser', userData.user)
			}
			//	#endif
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		globalData: {
			test: ''
		},
		methods: {
			...mapMutations(['setUniverifyErrorMsg', 'setUniverifyLogin'])
		}
	}
</script>

<style lang="scss">
	@import '@/uni_modules/uni-scss/index.scss';
	/* #ifndef APP-PLUS-NVUE */
	/* uni.css - 通用组件、模板样式库，可以当作一套ui库应用 */
	@import './common/uni.scss';
	@import '@/static/customicons.css';
	/* H5 兼容 pc 所需 */
	/* #ifdef H5 */
	@media screen and (min-width: 768px) {
		body {
			overflow-y: scroll;
		}
	}

	uni-page-body {
		min-height: 100% !important;
		height: auto !important;
	}

	.uni-top-window uni-tabbar .uni-tabbar {
		background-color: #fff !important;
	}

	.uni-app--showleftwindow .hideOnPc {
		display: none !important;
	}

	/* #endif */

	/* 以下样式用于 hello uni-app 演示所需 */
	page {
		height: 100%;
		font-size: 28rpx;
		/* line-height: 1.8; */
	}

	/* #endif*/
</style>
