<template>
	<view class="login-box">
		<view class="login-background"></view>
		<view class="login-content">
			<view class="login-image">
				<van-image width="398rpx" height="398rpx" fit="cover"
				src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1653448851000_616.png" />
			</view>
			<view class="btnBox" open-type="getUserInfo" @tap="getUserProfile">
				账号登录
			</view>
			<view class="flex_center_center">
				<indexassembly width="440rpx" height="90rpx" @success='againdata' >
					<view class="btnBox authBtn">
						授权登录
					</view>
				</indexassembly>
			</view>
			<view class="indicate">
				仅适用于“进阶思维”内部学员或教师使用，暂不对外开放
			</view>	
		</view>
		
	</view>
</template>

<script>
	import indexassembly from '../index/components/indexassembly.vue'
	export default {
		components:{
			indexassembly
		},
		setup(props, context) {
			uni.clearStorageSync()

			let methods = {
				login() {
					uni.navigateTo({
						url: '/pages/login/accountLogin' 
					});
				},
				againdata() {
					uni.reLaunch({
						url: '/pages/index/index' 
					});
				},
				getUserProfile() {
					//新的获取用户资料
					var that = this;
					wx.getUserProfile({
						desc: "用于完善资料", // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
						success: (info) => {
							console.log(info)
							uni.setStorageSync('userWxInfo',info)
							methods.login()
						},
						fail: () => {
							uni.showToast({
								title: "微信登录授权失败",
								icon: "none",
							});
						},
					});
				},
			};
			return {
				...methods,
			};
		},
		onLoad(options) {
			
		}
	};
</script>

<style scoped>
	.indicate{
		font-size: 24rpx;
		color: rgba(255,255,255,.3);
		padding: 50rpx 50rpx;
		text-align: center;
		line-height: 35rpx;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 30rpx;
	}
	.login-content{
		position: relative;
		width: 100%;
		z-index: 2;
		height: 100%;
	}
	.login-background{
		position: fixed;
		width: 100%;
		top: 0;
		bottom: 0;
		background: -moz-linear-gradient(top, #C41726 0%, #831D1C 100%);
		background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C41726), color-stop(100%,#831D1C));
		background: -webkit-linear-gradient(top, #C41726 0%,#831D1C 100%);
		background: -o-linear-gradient(top, #C41726 0%,#831D1C 100%);
		background: -ms-linear-gradient(top, #C41726 0%,#831D1C 100%);
		background: linear-gradient(top bottom, #C41726 0%,#831D1C 100%);
	}
	.login-image {
		text-align: center;
		padding: 198rpx 0 284rpx 0;
	}
	.btnBox {
		width: 280rpx;
		height: 88rpx;
		border-radius: 44rpx;
		overflow: hidden;
		margin: 0 auto;
		margin-bottom: 53rpx;
		background-color: #C91727;
		font-size: 30rpx;
		font-weight: 500;
		color: #FFFFFF;
		text-align: center;
		line-height: 88rpx;
	}
	.authBtn{
		background-color: #282828 !important;
		color: #FFFFFF !important;
	}
</style>
