<template>
	<view>
		<view class="logo">
			<image src="../../static/image/login/8eef2e54055a5b072a5dc000919a7ae.png" mode=""></image>
		</view>
		<form @submit="formSubmit">
			<view class="uni-form-item uni-column">
				<view class="username">
					<u-icon name="account"  size="36" style="margin-right:30rpx;color: #72CD9C;"></u-icon>
					<!-- <input class="uni-input" name="username" placeholder-class="icon iconfont icon-bianji1" placeholder="请输入用户名" /> -->
					<u-input class="uni-input" name="username" v-model="formdata.username" placeholder-class="icon iconfont icon-bianji1" placeholder="请输入用户名"/>
				</view>
				<view class="passwold">
					<u-icon name="lock" size="36" style="margin-right:30rpx;color: #72CD9C;"></u-icon>
					<!-- <input class="uni-input" name="pass" password  placeholder-class="icon iconfont icon-bianji1" placeholder="请输入密码" /> -->
					<u-input class="uni-input" name="pass" v-model="formdata.passwold" type="password"   placeholder-class="icon iconfont icon-bianji1" placeholder="请输入密码"/>
				</view>
				<view class="aboutpass">
					<p>忘记密码？</p>
					<u-radio-group>
						<u-checkbox v-model="checked"  :label-disabled="true" size="22">记住密码</u-checkbox>
					</u-radio-group>
				</view>
				<view class="uni-btn-v">
					<button form-type="submit">登 录</button>
				</view>
			</view>
		</form>
		<view class="bg">
			<image src="../../static/image/login/850c9307f4ef2d7dc6db1049711ab55.jpg" mode=""></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				checked:false,
				formdata:{
					username:'',
					passwold:''
				}
			}
		},
		onLoad() {

		},
		methods: {
			async formSubmit() {
				const res = await this.$myRequest({
					url: '/api/api_gateway?method=user.login.login_user',
					data: {
						username: this.formdata.username,
						password: this.formdata.passwold
					}
				})
				let session_key = res.session_key
				uni.setStorage({
					key: 'session_key',
					data: session_key,
					success: ()=> {
						uni.switchTab({
							url:"../index/index"
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.logo {
		width: 100%;
		height: 340rpx;
		text-align: center;
		padding-top: 120rpx;

		image {
			width: 280rpx;
			margin: 0 auto;
			height: 120rpx;
		}
	}

	.bg {
		width: 100%;
		position: absolute;
		bottom: 0;

		image {
			width: 100%;
		}
	}
	.uni-form-item {
		// margin-top: 50rpx;
		width: 100%;

		.username {
			width: 80%;
			margin: 0 auto;
			display: flex;
			margin-bottom: 40rpx;
			padding-bottom: 10rpx;
			border-bottom: 2rpx solid #C3C3C3;
		}

		.passwold {
			width: 80%;
			margin: 0 auto;
			display: flex;
			margin-bottom: 40rpx;
		}
		.aboutpass{
			width: 80%;
			margin: 0 auto;
			display: flex;
			justify-content: space-between;
			p{
				color: #C0C0C0;
			}
			/deep/.u-checkbox__label{
				font-size: 14rpx;
				color: #C0C0C0;
			}
		}
		.uni-btn-v{
			width: 80%;
			margin: 112rpx auto 0;
			button{
				width: 100%;
				height: 72rpx;
				line-height: 75rpx;
				background-color: #5DC18B;
				color: #FFFFFF;
				border-radius: 36rpx;
				font-size: 28rpx;
			}
		}
	}
</style>
