<template>
	<mobile-frame>
		<view class="main">
			<view class="one">
				<button size="mini" @click="toCommon('pages/login/index')">登录页面</button>
				<button size="mini" @click="toCommon('pages/home/index')">首页</button>
				<button size="mini" @click="toCommon('pages/store/index')">微店</button>
				<button size="mini" @click="toCommon('pages/week/index')">周边</button>
				<button size="mini" @click="toCommon('pages/market/index')">购物车</button>
				<button size="mini" @click="toCommon('pages/my/index')">我的1</button>
			</view>
		</view>
	</mobile-frame>
</template>

<script>
	export default {
		components: {},
		data() {
			return {};
		},
		onShow: function() {
			const that = this;
			// 监听用户是否登录
			that.watchLogin();
		},
		methods: {
			// 公共跳转
			toCommon(e) {
				uni.navigateTo({
					url: `/${e}`
				});
			},
			// 监听用户是否登录
			watchLogin() {
				const that = this;
				uni.getStorage({
					key: 'token',
					success: function(res) {
						// uni.redirectTo({
						// 	url: `/pagesA/adminHome/index`
						// })
					},
					fail: function(res) {
						uni.redirectTo({
							url: `/pages/home/index`
						})
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	.main {
		.one {
			text-align: center;

			button {
				margin: 2vw;
			}
		}
	}
</style>
