<template>
	<view>
		<!-- <view class="username">{{username}}</view> -->
		<view class="content1">
			<image src="../../static/sm.png" mode="widthFix" class="img"></image>
			<view class="row1">
				即将通过扫码
			</view>
			<view class="row2">
				登录畅运通网站
			</view>
			<button @click="mobileOkPcLogin()" class="row3 btn">确认登录</button>
			<button @click="mobileOkPcLogin()" class="row4 btn">取消登录</button>
		</view>
		<u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
			confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick" @cancel="cancelClick"></u-modal>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	export default {
		data() {
			return {
				token: '',
				phone: '',
				alertTitle: '登录成功！',
				isShowAlert: false
			}
		},
		computed: {
			...mapState(['hasLogin', 'userInfo', "firstAuthentication"]),
		},
		onLoad(option) {
			this.token = option.token;
			console.log(option);
		},
		methods: {
			confirmClick() {
				this.isShowAlert = false
				uni.switchTab({
					url: '/pages/mine/index'
				});
			},
			cancelClick() {
				this.isShowAlert = false
			},
			mobileOkPcLogin() {
				this.$request.baseRequest('post', '/login/loginCode', {
						phone: this.userInfo.phone,
						token: this.token
					}).then(res => {
						console.log(1111111111111111111)
						console.log(res)
						this.isShowAlert = true
					})
					.catch(res => {
						uni.$u.toast(res.message);
					});

			}
		}
	}
</script>

<style scoped lang="scss">
	.content1 {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		padding-top: 300rpx;
	}

	.img {
		width: 50%;
	}

	.row1 {
		font-size: 14rpx;
		color: #AFB3BF;
		margin: 40rpx 0 10rpx 0;
	}

	.row2 {
		font-size: 46rpx;
		font-weight: 500;
		color: #333333;
	}

	.row3 {
		margin-top: 300rpx;

		background: #2772FB;
		color: white;
	}

	.row4 {
		margin-top: 60rpx;
		background: #F1F3F6;
		color: #AFB3BF;
	}

	.btn {
		border-radius: 50rpx;
		width: 90%;
	}
</style>
