<template>
	<uv-popup
	round="40rpx"
	:safeAreaInsetBottom="false"
	:closeOnClickOverlay="false"
	ref="popup">
		<view class="toast">
			<view class="title">
				提示
			</view>
			<view class="content">
				本小程序需要登录之后才可以正常使用
			</view>
			<view class="btnstwo">
				<view class="btn c"
				@click="cancel">
					取消
				</view>
				<view class="btn"
				@click="login">
					登录
				</view>
			</view>
		</view>
	</uv-popup>
</template>

<script>
	export default {
		name : 'toast',
		methods : {
			checkLogin(){
				if(!uni.getStorageSync('token')){
					this.$refs.popup.open();
				}
			},
			cancel(){
				this.$refs.popup.close();
				uni.redirectTo({
					url: '/pages/index/index'
				})
			},
			login(){
				this.$store.commit('login')
				this.$refs.popup.close()
			},
		}
	}
</script>

<style lang="scss" scoped>
	.toast{
		width: 500rpx;
		.title{
			min-height: 70rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 32rpx;
		}
		.content{
			font-size: 28rpx;
			min-height: 200rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
		}
		.btnstwo{
			display: flex;
			.btn{
				flex: 1;
				background: $uni-linear-gradient-btn-color;
				color: #fff;
				padding: 20rpx 0;
				text-align: center;
			}
			.c{
				background: #fff;
				border-top: 1px solid #999;
				color: #333;
			}
		}
	}
</style>