<script>
	export default {
		onLaunch: function() {
			let reToken = uni.getStorageSync('reToken')
			let token = uni.getStorageSync('token')
			if(reToken){
				if(token){
					uni.switchTab({ 
						url:'/pages/index/buy'
					})
				}else{
					uni.redirectTo({
						url:'/pages/index/adIndex'
					})
				}
			}else{
				
				uni.authorize({
				  scope: 'scope.userLocation',
				  success: function () {
				    console.log('用户同意了授权')
				  }
				})
				uni.redirectTo({
					url:'/pages/index/adIndex'
				})
			}
			
		},

		// onLaunch: function(e) {
		// 	let that = this;
		// 	// #ifdef MP-WEIXIN
		// 	// uni.login({
		// 	// 	provider: 'weixin',
		// 	// 	success(ret) {
		// 	// 		uni.$u.http.post('/api/common/mobile', {
		// 	// 			code: ret.code
		// 	// 		}, {
		// 	// 			custom: {
		// 	// 				toast: false,
		// 	// 				catch: true
		// 	// 			}
		// 	// 		}).then((res) => {
		// 	// 			console.log(res);
		// 	// 			// uni.setStorageSync('token', res.result.token || '')
		// 	// 			// that.$isResolve()
		// 	// 		}).catch((res) => {
		// 	// 			console.log(res);
		// 	// 			// let token = uni.getStorageSync('token') || '';
		// 	// 			// if (token == '') {
		// 	// 			// 	uni.reLaunch({
		// 	// 			// 		url: '/pages/index/login'
		// 	// 			// 	})
		// 	// 			// }
		// 	// 			// that.$isResolve()
		// 	// 		});
		// 	// 	}
		// 	// })
		// 	// #endif
		// },
		onShow: function() {

		},
		onHide: function() {

		},
		globalData: {

		}

	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";
	@import "@/common/demo.scss";
	page{
		background-color: #F7F8FA;
		height: 100%!important;
	}
</style>