<script>
	import configpath from 'config/setting.config.js';
	import api from 'api/index.js'
	import Vue from 'vue'

	const inforeq = (cb) => {
		fetch('/static/.config.json')
			.then((res) => res.json())
			.then(async (res) => {
				let obj = {
					...res,
					img_local_host: (process.env.NODE_ENV === 'production' ?
						res.prodIp || configpath.prodIp :
						process.env.NODE_ENV === 'test' ?
						res.testIp || configpath.testIp :
						res.devIp || configpath.devIp) + '/file/',
					// 请求 地址
					baseURL: (process.env.NODE_ENV === 'production' ?
						res.prodIp || configpath.prodIp :
						process.env.NODE_ENV === 'test' ?
						res.testIp || configpath.testIp :
						res.devIp || configpath.devIp) + '/api/h5',
				}
				cb && cb(obj)
			})
	}
	export default {
		globalData: {
			SET_STATUS_BAR: 0,
			SET_CUSTOM_BAR: 0,
			SET_SYSTEM_INFO: {},
			configData: {},
			token: ''
		},
		onLaunch: function(option) {
			let token = window.location.search.split('token=')[1]
			console.log('App Launch')
			console.log(token)

			let t = this;
			inforeq((res) => {
				t.globalData.configData = res
				if (token && token.length > 0) {
					console.log(token)
					uni.setStorage({
						key: 'token',
						data: token,
						success: function() {
							console.log('success');
						}
					});
					t.globalData.token = token
				}

			})
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
	}
</script>
uni.getSystemInfo({
success: (e) => {
let statusBar = 0
let customBar = 0

// #ifdef MP
statusBar = e.statusBarHeight
customBar = e.statusBarHeight + 45
if (e.platform === 'android') {
customBar = e.statusBarHeight + 50
}
// #endif

// #ifdef MP-WEIXIN
statusBar = e.statusBarHeight
const custom = wx.getMenuButtonBoundingClientRect()
customBar = custom.bottom + custom.top - e.statusBarHeight
// #endif

// #ifdef MP-ALIPAY
statusBar = e.statusBarHeight
customBar = e.statusBarHeight + e.titleBarHeight
// #endif

// #ifdef APP-PLUS
console.log('app-plus', e)
statusBar = e.statusBarHeight
customBar = e.statusBarHeight + 45
// #endif

// #ifdef H5
statusBar = 0
customBar = e.statusBarHeight + 45
// #endif

this.globalData.SET_SYSTEM_INFO = e
this.globalData.SET_CUSTOM_BAR = customBar
this.globalData.SET_STATUS_BAR = statusBar
}
})

<style>
	/*每个页面公共css */
	@import url("@/static/style/style.css");
	@import url("@/static/style/icon.css");
	@import url("@/static/style/color.css");

	page {
		background: #f5f5f5;
	}

	.my-button {
		border-radius: 0px;
		transform: initial;
		background-color: transparent;
	}

	.my-button:after {
		border-width: 0px !important;
		border-radius: 0px !important;
		transform: initial;
		background-color: transparent;
	}

	.bule_line {
		width: 10rpx;
		height: 30rpx;
		background-color: #1e8ff9;
		border-radius: 6rpx;
		box-shadow: 0px 2px 4px 0px rgba(121, 190, 254, 0.59);
	}
</style>
