<template>
	<view class="content">
		<view class="container">
			<headers :titles="titles"><u-icon name="arrow-left" color="#fff" size="22"></u-icon></headers>
			<view class="top-box">
				<view class="title_">京博加油站</view>
				<view class="bai-box">
					<view class="input_box">

						<u-icon name="account" color="#0864E9" size="22"></u-icon>
						<input type="text" v-model="form.username" placeholder="请输入账号" />
					</view>
					<view class="input_box">

						<u-icon name="lock" color="#0864E9" size="22"></u-icon>
						<input type="text" v-model="form.password" placeholder="请输入密码" />
					</view>

					<view class="anniu" @click="goGoGo">
						登录
					</view>

					<view class="ds-d">
						<view class="qiu" v-if="show == false" @click="show =! show"></view>
						<view class="qiu-x" v-if="show == true" @click="show =! show">
							<u-icon name="checkmark" color="#fff" size="12"></u-icon>
						</view>
						<view class="">登录即代表同意《隐私政策》和《服务协议》</view>
					</view>
				</view>
			</view>

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

<script>
	import request from "../../utils/request";
	import headers from '../../components/header/headers.vue'

	export default {
		data() {
			return {
				titles: "",
				show: false,
				form: {
					username: "",
					password: "",
				}
			}
		},
		onShow() {
			// this.actList = ["1", "1", "1", "1", "1", ]
			// this.status = "nomore" 底部刷新结束
		},
		onPullDownRefresh() {
			console.log("刷新");
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			// this.show = true
			setTimeout(() => {
				console.log("加载执行");
			}, 2000)
		},
		components: {
			headers
		},
		methods: {
			goGoGo() {
				request({
					url: 'backendApi/login/doLoginApp',
					method: 'post',
					data: this.form

				}).then((res) => {
					if (res.data.token) {
						uni.setStorageSync('App-Token', res.data.token);
						uni.setStorageSync('storeId', res.data.storeId);
						uni.setStorageSync('accountId', res.data.accountId);
						uni.navigateTo({
							url: '/pages/index/index'
						})
					}else{
						uni.showToast({
							title:res.data,
							icon:"none"
						})
					}
				})
			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #f4f5f6;
		// background: linear-gradient(180deg, #B2D2FC 0%, #B2D2FC 14%, rgba(255, 255, 255, 0.84) 24%, rgba(255, 255, 255, 0.84) 100%);
		height: 100vh;
	}

	.container {
		width: 100%;
		background: #f4f5f6;
		box-sizing: border-box;
		padding-top: 88px;
	}

	.top-box {
		width: 100%;
		height: 225px;
		background: url('../../static/imgs/myback.png');
		background-size: 100% 100%;
		box-sizing: border-box;
		padding: 15px;
		color: #fff;
		padding-top: 0px;
		position: relative;
		box-sizing: border-box;
		padding: 1px;
	}

	.title_ {
		width: 100%;
		text-align: center;
		font-weight: bold;
		font-size: 30px;
		color: #FFFFFF;
		margin: 55px auto;
	}

	.bai-box {
		width: 95%;
		background: #fff;
		border-radius: 8px;
		box-sizing: border-box;
		padding: 10px 10px;
		margin: 0 auto;
	}

	.input_box {
		width: 100%;
		border-radius: 50px;
		border: 1px solid #0864E9;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		padding: 10px 15px;
		margin: 15px auto;

	}

	.anniu {
		width: 100%;
		border-radius: 50px;
		border: 1px solid #0864E9;
		background: #0864E9;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		padding: 10px 15px;
		margin: 15px auto;
		margin-bottom: 35px;
	}

	.ds-d {
		display: flex;
		align-items: center;
		color: #333;
		font-size: 12px;
	}

	.qiu {
		width: 14px;
		height: 14px;
		border-radius: 50%;
		border: 1px solid #999999;
		margin: 0 15px;
	}

	.qiu-x {
		width: 14px;
		height: 14px;
		border-radius: 50%;
		border: 1px solid #0864E9;
		background: #0864E9;
		margin: 0 15px;
		display: flex;
		align-items: center;
		justify-content: center;

	}
</style>