<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 class="two">

			</view>
		</view>

	</mobile-frame>
</template>

<script>
	export default {
		components: {},
		data() {
			return {

			};
		},
		onLoad: function() {},
		onShow: function() {
			const that = this;
			// 监听用户是否登录
			that.watchLogin();
		},
		methods: {
			// 公共跳转
			toCommon(e) {
				uni.navigateTo({
					url: `/${e}`
				});
			},
			watchLogin() {
				uni.getSystemInfo({
					success: async function(res) {
						uni.setStorage({
							key: 'system',
							data: res,
							success: function() {
								uni.redirectTo({
									url: `/pages/home/index`
								})
							}
						});
					}
				});
				// const key = '5WLBZ-H6RWU-NQVVO-BQG7I-XEHFK-PAFSF'; //使用在腾讯位置服务申请的key
				// const referer = 'test'; //调用插件的app的名称
				// const location = JSON.stringify({
				// 	latitude: 39.89631551,
				// 	longitude: 116.323459711
				// });
				// const category = '';
				// console.log('1');
				// uni.navigateTo({
				// 	url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&location=' + location + '&category=' + category
				// });
			},
		}
	}
</script>

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

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