<template>
	<view class="login">
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isShow: false,
				tips: '',
				id: "",
				code: "",
				seconds: 60,
				model: {
					mobile: '',
					code: '',
				},
				openid: "",
				unionid: "",
				
			}
		},
		onLoad(o) {
			this.code = o.code
			this.getInit();
		},
		methods: {
			async getInit() {
				const { code, data, msg } = await this.$api.wxPublicLogin({
					code: this.code,
					platform: "wechat"
				})
				if(code == 1){
					uni.showToast({
						title: "登录成功"
					})
					uni.setStorageSync("userInfo", data.userinfo)
					uni.setStorageSync('token', data.userinfo.token);
					setTimeout(() => {
						uni.switchTab({
							url: "/pages/user/index"
						})
					}, 2000)
				}
			},
		}
	}
</script>
<style lang="scss" scoped>
	page{
		background-color: #fff;
	}
	.login {
		overflow: hidden;
		&-form {
			width: 90%;
			margin: 240rpx auto 0;
			.verify{
				display: flex;
				justify-content: space-between;
				.l {
					width: calc(100% - 180rpx);
				}
				
				.r {
					width: 160rpx;
				
					button {
						width: 100%;
						padding: 0;
						font-size: 20rpx;
						text-align: center;
					}
				}
			}
			
		}
		.logo{
			width: 650rpx;
			height: 650rpx;
			display: block;
			margin: 0 auto;
		}
		.btn {
			width: 580rpx;
			line-height: 98rpx;
			background: #2B62B2;
			border-radius: 98rpx;
			position: relative;
			font-size: 30rpx;
			color: #fff;
			text-align: center;
			margin: 220rpx auto 0;

			button {
				width: 100%;
				height: 100%;
				position: absolute;
				left: 0;
				top: 0;
				z-index: 2;
				opacity: 0;
			}
		}

		.tip {
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 24rpx;
			color: #333333;
			width: 100%;
			position: absolute;
			left: 0;
			bottom: 80rpx;
			z-index: 2;

			.txt {
				margin-bottom: 8px;

				text {
					color: #2B62B2;
					padding: 0 10rpx;

				}
			}
		}
	}
</style>