<script>
	export default {
		methods: {
			// 提前获取二维码并保存起来
			async getQrcode() {
				uni.getImageInfo({
					src: `${this.$config.baseURL}/promotion/qrCode?token=${uni.getStorageSync('token')}`,
					success: (image) => {
						this.Qrcode = image.path;
						this.$store.commit('setQrcode', this.Qrcode)
					},
					fail: (err) => {
						console.error('获取二维码失败:', err);
					}
				});
			}
		},
		onLaunch() {
			// 提前获取二维码
			this.getQrcode()
		},
		async onShow() {
			// if(!uni.getStorageSync('token')){
			// 	uni.redirectTo({
			// 		url: '/subPages/login/login',
			// 	})
			// }
			await this.$store.dispatch('initData')
			console.log('配置数据初始化完成')
		},
		onHide: function() {
			console.log('App Hide')
		}

	}
</script>

<style lang="scss">
	// @import '@/uni_modules/uv-ui-tools/index.scss';
	
	/* 富文本全局样式 - rich-text组件的class样式必须写在全局中 */
	h1, h2, h3, h4, h5, h6 {
		font-weight: bold;
		margin: 10px 0;
		line-height: 1.4;
	}
	
	h2 {
		font-size: 20px;
		color: #333;
	}
	
	p {
		margin: 8px 0;
		line-height: 1.6;
		color: #666;
	}
	
	strong {
		font-weight: bold;
		color: #333;
	}
	
	/* 首行缩进样式 */
	.text-indent {
		text-indent: 2em;
	}
</style>
