<template>

</template>
<script>
	// import {
	// 	getPricePercentReq,
	// } from '@/api/test/index.js'
	// import {
	// 	getUserInfoReq,
	// } from '@/api/test/index.js'
	import uploadUrl from '@/common/config.js'

	// import PrivacyPopup from "@/components/privacyPopup/index.vue";
	export default {
		globalData: {
			showPrivacy: false,
			priceConfig: {},

			userInfo: {}
		},
		async onLaunch(options) {
			let _this = this
			if (uni.getPrivacySetting) {
				uni.getPrivacySetting({
					success: res => {
						console.log("是否需要授权：", res.needAuthorization, "隐私协议的名称为：", res.privacyContractName)
						if (res.needAuthorization) {
							getApp().globalData.showPrivacy = true;
						} else {
							getApp().globalData.showPrivacy = false;
						}
					},
					fail: () => {},
					complete: () => {},
				})
			}

			uni.setStorageSync('switchs', [1, 0, 0])
			uni.request({
				url: uploadUrl.baseUrl + '/api/common/getPriceConfig',
				method: "GET",
				success: (res) => {
					if (res.data.code == 0) {
						console.log('app.vue中获取的会员折扣数据', res.data.data)
						uni.setStorageSync('priceConfig', res.data.data)
					}
				}
			})

			if (uni.getStorageSync('token')) {
				uni.request({
					url: uploadUrl.baseUrl + '/api/users/getUserInfo',
					method: "GET",
					header: {
						Authorization: uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 0) {
							console.log('app.vue中获取的用户信息数据', res.data.data)
							if ((res.data.data.status == 1 && res.data.data.type == 2) || (res.data.data
									.status == 1 && res.data.data.type == 5)) {
								uni.setStorageSync('switchs', [0, 1, 0])
							}
						}
					}
				})
			}
		},
		async onShow() {},
		onHide: function() {
			// console.log('App Hide')
		},

		methods: {

		}
	}
</script>

<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "@/uni_modules/uview-ui/index.scss";

	/*每个页面公共css */
	@import '@/uni_modules/uni-scss/index.scss';
	/* #ifndef APP-NVUE */
	@import '@/static/customicons.css';

	// 设置整个项目的背景色
	page {
		// background-color: #f5f5f5;
	}

	/* #endif */
	.example-info {
		font-size: 14px;
		color: #333;
		padding: 10px;
	}
</style>