<script>
	import { isWechat, wxConfigH5, weixinLogin, getQueryString } from '@/utils/utils';

	export default {
		async onLaunch(options) {
			await this.initData();
		},
		async onShow() {},
		onHide() {
			console.log('App Hide')
		},
		methods: {
			async initData() {
				// #ifdef H5
				if (isWechat()) {
					const url = window.location.href.split('#')[0];
					await wxConfigH5(url);
					wxShare();
				}
				// #endif
				// 获取页面设置配置
				if(process.env.NODE_ENV === 'production') {
					const code = getQueryString('code');
					const storageCode = uni.getStorageInfoSync('code');
					if (code && code != storageCode) {
						uni.setStorageSync('code', code)
						weixinLogin();
					}
				}
			}
		}
	}
</script>

<style lang="scss">
// 导入colorUI
@import '/static/css/colorui/main.css';
@import '/static/css/colorui/icon.css';
@import '/static/css/colorui/animation.css';

@import '@/static/css/reset.scss';
@import '@/static/css/uni.scss';
</style>
