<template>
	<view class="page">
		<view class="content">
			<view class="title flex-col justify-center">
				<text>HI,您好!</text>
				<text>欢迎登录</text>
			</view>
			<view class="h-logo  flex-row justify-center">
				<image class="logo-img" src="../../static/logo.png"></image>
			</view>

			<button class="login-btn flex-row justify-center" @click="wechatCodeLogin">
				<u-icon name="weixin-fill" color="green" size="26"></u-icon>
				<text class="weixinLogin">授权微信登录</text>
			</button>


<!--			<view class="login-form flex-row justify-between">-->
<!--				<view class="flex-row">-->
<!--					<view  class="o"></view>-->
<!--					<view  class="v"></view>-->
<!--					<text class="text1">自动登录</text>-->
<!--				</view>-->

<!--				<view @click="gotoRetieveAccount()" class="forget-acconut-password">-->
<!--					<text>找回账号</text>-->
<!--				</view>-->
<!--			</view>-->

			<view class="bottom flex-row justify-between">
					<view  class="o"></view>
					<view  class="v"></view>
					<view class="login-form1 ">
						<text class="text2">允许我们在必要的场景下合理使用你的相关信息，且阅读并同意</text>
						<text class="text3">《会员协议》、《服务对象协《隐私协议》</text>
						<text class="text2">等内容</text>
					</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello'
			}
		},
		onLoad() {

		},
		methods: {
			wechatCodeLogin(){
				let that = this;
				wx.login({
					success(re) {
						that.$api.wxAuthLogin({code:re.code}).then(res=>{
							uni.setStorageSync('userInfo',res.data.data.userInfo)
							uni.setStorageSync('accessToken',res.data.data.access_token)
							uni.setStorageSync('phoneIsBind',res.data.data.phoneIsBind)

							if (res.data.data.phoneIsBind){
								uni.switchTab({
									url: '/pages/index/index',
								})
							}else {
								uni.navigateTo({
									url: '/loginPages/bindAccount/index',
								})
							}

						})

					},
				});
			},
		}
	}
</script>

<style>
	@import '/common/css/common.css';
	@import './index.rpx.css';
</style>
