<template>
	<view>
		<tm-message ref="toast"></tm-message>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		onLoad() {
			let that = this
			this.$refs.toast.show({model:'load',mask:true})
			let route = getCurrentPages()			
			uni.login({
				success(data) {
					let code = data.code
					if (code) {
						that.$tm.request.post('card/login', {
							code
						}).then((res) => {
							uni.setStorageSync('token', res.data.token);
							uni.reLaunch({
								url:route[0].$page.fullPath,
							})
						})
					}
			
				}
			});			
		},
		methods: {
			
		}
	}
</script>

<style>

</style>
