<template>
	<view class="content">
		<view class="logo">

			<image src="../../static/images/lolo.png" style="width: 340px; height: 240px; "></image>

		</view>
		<view class="btn">
			<!-- <u-button text="一键登录" color="linear-gradient(to right, #FF6100, #FF0000)" open-type="getPhoneNumber"
				@getphonenumber="getPhone"></u-button>
			<view class="mask" @click="authorize" v-if="isShow"> -->
			<view class="title_">输入账号</view>
			<u--input placeholder="请输入内容" border="surround" v-model="account"></u--input>
			<view class="title_">输入密码</view>
			<u--input placeholder="请输入内容" border="surround" v-model="password"></u--input>
			<u-button text="账密登陆" style=" margin-top: 25px; " color="linear-gradient(to right, #FF6100, #FF0000)"
				@click="login()"></u-button>

		</view>


		<view class="mask" @click="authorize" v-if="isShow">

		</view>
	</view>
	<!-- 		<view class="privacy-policy-area">
			<view class="privacy-policy-checkbox">
				<u-checkbox-group v-model="privacyPolicyChecked" @change="checkboxChange">
					<u-checkbox activeColor="#1684FC" size="16" name="1"></u-checkbox>
				</u-checkbox-group>
			</view>
			<view class="privacy-policy-text">
				<text>请阅读</text>
				<text class="privacy-policy-text-btn" @click="goPolicy">《用户协议》、《隐私政策》</text>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				privacyPolicyChecked: false,
				isShow: true,
				loginStatus: null,
				account: 'admin',
				password: 'admin123'
			}
		},
		onShow() {
			if (uni.getStorageSync('TOKEN')) {
				uni.navigateTo({
					url: "/essayPackage/pages/Home"
				})
			}
		},
		methods: {

			// 账密登陆
			login() {
				uni.request({
					url: this.baseUrl + '/login',
					method: 'POST',

					data: {
						username: this.account,



						password: this.password
					},
					success: (res) => {
						console.log(res);
						if (res.data.code == 200) {
							uni.setStorageSync('TOKEN', res.data.token);
							this.$store.commit("setPropName", {
								propName: "token",
								value: res.data.token,
							})
							console.log(68)

							uni.navigateTo({
								url: "/essayPackage/pages/Home"
							})
						} else {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}
					}
				})
			},

			//复选框
			checkboxChange(e) {
				console.log('141', e);
				if (e.length) {
					this.isShow = false;
				} else {
					this.isShow = true;
				}
			},
		}
	}
</script>

<style scoped lang="less">
	.title_ {
		margin: 10px auto;
	}

	.content {
		width: 100%;
		overflow: hidden;

		.logo {
			text-align: center;
			margin: 0px auto;
			margin-top: 0px;


		}

		.btn {
			width: 50%;
			margin: 0 auto;
			margin-bottom: 60rpx;
			position: relative;

			.mask {
				position: absolute;
				width: 100%;
				height: 100%;
				top: 0;
				left: 0;
				z-index: 2;
				background-color: transparent;
			}
		}

		.privacy-policy-area {
			width: 90%;
			margin: 20rpx auto;
			display: flex;
			align-items: center;

			.privacy-policy-checkbox {
				margin-left: 20rpx;
			}

			.privacy-policy-text {
				margin-left: 10rpx;
				font-size: 26rpx;

				.privacy-policy-text-btn {
					color: #1684FC;
				}
			}
		}
	}
</style>