<template>
	<view>
		<productsBtn :type="1"></productsBtn>
		<!-- 	<view style="margin:0 20rpx;">
			<u-overlay :show="!isLoad">
				<login @success="reOnLoad()" @fail="failToLoad()"></login>
			</u-overlay>
		</view> -->
	</view>
</template>

<script>
	import login from 'pages/my/login/login'
	export default {
		components: {
			login
		},
		data() {
			return {
				type: '',
				isLoad: true,
			}
		},
		onLoad() {
			if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
				this.isLoad = false
				// uni.navigateTo({
				// 	url: '../../pages/my/login/login'
				// })
				return
			}
			this.isLoad = true
		},
		methods: {
			reOnLoad() {
				if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
					this.$toast.warn('登录失败请重试')
					this.isLoad = false
					// uni.navigateTo({
					// 	url: '../../pages/my/login/login'
					// })
					return
				}
				this.isLoad = true
			},
			failToLoad() {
				this.$toast.warn('登录失败请重试')
			}
		}
	}
</script>
