<script>
	export default {
		onLaunch: function() {
			const that = this
			// 存储手机信息
			uni.getSystemInfo({
				success(res) {
					that.$store.commit('SET_SYSTEMINFO', res)
				}
			})
			if (this.$platform === 'APP-PLUS') {
				const {
					osName, // 操作系统
					osVersion // 操作系统版本号
				} = that.$store.state.info.systemInfo
				plus.runtime.getProperty(plus.runtime.appid, (info) => {
					//版本号
					const {
						version,
						versionCode,
					} = info
					that.$store.commit('SET_VERSIONINFO', {
						version: version,
						versionCode: versionCode,
						osName: osName,
						osVersion: osVersion
					})
				})
			}
			let accessToken = uni.getStorageSync('accessToken')
			if(!accessToken){
				uni.redirectTo({
					url: '/pages/login/index'
				})
			}
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	@import '@/static/icon/iconfont.css';
	@import '@/static/style/common.scss';

	/*每个页面公共css */
	page {
		height: 100%;
		background-color: $bg-color-main;
	}
</style>
