<template>
	<view class="content">
		<view class="logo">
			<img class="img" src="../../static/ceshi.jpg">
		</view>

		<button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
			<img class="img" src="../../static/weixin.svg">
			<span>微信一键登录</span>
		</button>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		myRequest
	} from '../../util/api.js'

	const code = ref('')

	const getPhoneNumber = async (e) => {
		console.log(e);
		code.value = e.detail.code
		if (code.value) {
			const res = await myRequest({
				url: "/wx/getPhone",
				data: {
					code: code.value
				}
			})
			console.log(res);
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100vw;
		height: 100vh;
		overflow: hidden;

		.logo {
			margin: 300rpx auto 0;
			width: 150rpx;
			height: 150rpx;
			border-radius: 20rpx;

			.img {
				width: 100%;
				height: 100%;
				border-radius: 20rpx;
			}
		}

		.button {
			display: flex;
			justify-content: center;
			align-items: center;
			margin: 150rpx auto 0;
			width: 600rpx;
			height: 100rpx;
			font-size: 32rpx;
			color: #fff;
			border-radius: 50rpx;
			background-color: #1E7DFB;

			.img {
				margin-right: 20rpx;
				width: 50rpx;
				height: 50rpx;
				color: #fff;
			}
		}
	}
</style>
