<script>
	import {
		saveFindTokenUser,
		setOrderTemplateWxMini
	} from './js/request.js'
	/**
	 * vuex管理登陆状态，具体可以参考官方登陆模板示例
	 */
	import {
		mapMutations
	} from 'vuex';
	export default {
		methods: {
			...mapMutations(['login'])
		},
		onLaunch: function() {
			let userInfo = uni.getStorageSync('userInfo') || '';
			if (userInfo.id) {
				//更新登陆状态
				uni.getStorage({
					key: 'userInfo',
					success: (res) => {
						this.login(res.data)
					}
				});
			}

		},
		created() {},
		onShow: function(ops) {
			try {
				setOrderTemplateWxMini()
			} catch (e) {
				this.$error(`setOrderTemplateWxMini fail:`, e)
			}
			saveFindTokenUser(ops)
			console.log('App Show')
			// #ifdef MP-WEIXIN
			wx.cloud.init({
				env: wx.cloud.DYNAMIC_CURRENT_ENV
			})
			// #endif
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	html {
		font-size: 18px !important;
	}

	/*每个页面公共css */
</style>
