<template>
	<view>
		<view class="head">
			<text>智能高效客户管理平台</text>
		</view>
		<view class="input">
			<view class="cwjs-cells item-flex">
				<view class="cwjs-item center">
					<input type="text" v-model="username" placeholder="请输入手机号码" maxlength="11"
						placeholder-style='color:#AAAAAA' />
				</view>
			</view>
			<view class="textbox">
				<view class="textbox-1" @tap="bindVerification">密码登录</view>
				<view class="textbox-2"></view>
				<view class="textbox-11"></view>
			</view>
		</view>
		<view class="button" @tap="bindWxBLogin">获取验证码</view>
		
		<image src="https://qufang.oss-cn-beijing.aliyuncs.com/upload/icon/xcx/jjycrm/login/footer.png" class="footer">
		</image>
	</view>
</template>

<script>
	var util = require("../../utils/util.js");
	var config = require("../../config");
	var app = getApp();
	export default {
		data() {
			return {
				username: '',
				role: ''
			};
		},
		onLoad: function(options) {
			this.role=options.role;
		},
		methods: {
			//账号密码登录
			bindVerification() {
				uni.navigateTo({
					url: '/pages/login/index',
				})
			},
			//获取验证码
			bindWxBLogin: function(e) {
				if (!(/^1[34578]\d{9}$/.test(this.username))) {
					util.showNone("手机号码错误");
					this.username='';
					return false;
				} else {
					uni.request({
						url: config.service.sendCode + "?mobile=" + this.username,
						method: "GET",
						header: {
							'content-type': 'application/json',
							'Access-Token': uni.getStorageSync('weapp_session_login_data').token
						},
						success: (data) => {
							console.log(data)
							// 成功地响应会话信息
							if (data.data.code == 10000) {
								util.showSuccess('发送成功');
								if(this.role==1){
									uni.navigateTo({
										url: '/pages/login/yinzhongmalogin?username=' + this.username +
											'&role=' + this.role,
									})
								}else{
									uni.navigateTo({
										url: '/pages/login/Verifythelogin?username=' + this.username +
											'&role=' + this.role,
									})
								}
								// 没有正确响应会话信息
							} else {
								util.showNone(data.data.message);
								return false;
							}
						},
					})	
				}
			},
		}
	};
</script>
<style lang="scss">
	.cwjs-logo {
		display: block;
		width: 219rpx;
		height: 158rpx;
		margin: 54rpx auto 66rpx;
	}

	.cwjs-tips {
		font-size: 24rpx;
		padding: 80rpx 0;
		color: #8a8a8a;
	}

	.cwjs-form {
		position: relative;
		margin: 0;
		background-color: #fff;
		border-radius: 10px;
		padding: 20rpx 40rpx 113rpx;
	}

	.cwjs-cells {
		width: 569rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		margin: 0 auto;
		height: 88rpx;
		overflow: hidden;
		border-bottom: 1rpx solid #BFC7D3;
		position: relative;
	}

	.center {
		flex: 1;
	}

	.cwjs-input {
		height: 48rpx;
		line-height: 48rpx;
		padding: 23rpx 23rpx 23rpx 78rpx;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		color: #000;
	}

	.images {
		display: block;
		width: 40rpx;
		height: 21rpx;
		margin-right: 30rpx;
		margin-top: 33.5rpx;
	}

	.mod-btn {
		position: absolute;
		bottom: -80rpx;
		left: 50%;
		margin-left: -80rpx;
	}

	.mod-btn .button {
		width: 160rpx;
		height: 160rpx;
		background: linear-gradient(180deg, rgba(116, 197, 230, 1) 0%, rgba(64, 147, 201, 1) 100%);
		border: 10rpx solid rgba(255, 255, 255, 1);
		border-radius: 100%;
		font-size: 36rpx;
		color: #fff;
		display: flex;
		justify-content: center;
		align-items: center;

	}

	.mod-btn .button::after {
		content: ""
	}

	.retPassword {
		display: inline;
		width: auto;
		font-size: 28rpx;
		color: rgba(64, 147, 201, 1);
		line-height: 40rpx;
		float: right;
	}

	.retPassword:active {
		background-color: #fff;
	}

	.appliyAdmin {
		position: absolute;
		left: 50%;
		margin-left: -57rpx;
		bottom: 100rpx;
		width: 114rpx;
		font-size: 28rpx;
		color: rgba(255, 255, 255, 1);
		line-height: 40rpx;
	}

	/* 头部 */

	.head {
		width: 750rpx;
		height: 410rpx;
		background-image: url(https://qufang.oss-cn-beijing.aliyuncs.com/channelHelper/background.png);
		background-size: 100vw auto;
		background-repeat: no-repeat;
	}

	.background {
		width: 750rpx;
		height: 400rpx;
		position: absolute;
		top: -3rpx;
		left: 0;
	}

	.logo {
		width: 248upx;
		height: 248upx;
		display: block;
		position: absolute;
		top: 134rpx;
		left: 240.5rpx;
	}

	.head text {
		font-size: 34rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #008EF2;
		position: absolute;
		top: 300rpx;
		width: 100%;
		text-align: center;

	}

	/* 输入框 */
	.input {
		width: 100%;
		height: auto;
		padding: 0 105rpx;
		box-sizing: border-box;
	}

	.logo_input {
		width: 34rpx;
		height: 38rpx;
		position: absolute;
		top: 25rpx;
		left: 0;
	}

	/* 登录 */
	.button {
		width: 603rpx;
		height: 89rpx;
		background: rgba(72, 149, 255, 1);
		box-shadow: 0rpx 2rpx 14rpx 0rpx rgba(151, 192, 255, 1);
		border-radius: 45rpx;
		text-align: center;
		line-height: 89rpx;
		color: #fff;
		margin: 0 auto;
		margin-top: 239rpx;
		font-size: 34rpx;
	}

	.footer {
		width: 100%;
		height: 157rpx;
		position: absolute;
		bottom: 0;
		left: 0;
	}

	.agreeBox {
		/* text-align: center; */
		/* width: 450rpx; */
		/* padding-left: 145rpx; */
		font-size: 28rpx;
		color: #88909E;
		margin: 0 auto;
		margin-top: 30rpx;
		position: relative;
		display: flex;
		margin-left: 83upx;
	}

	checkbox {
		transform: scale(0.5);
	}

	checkbox-group {
		display: inline;
	}

	navigator {
		display: inline
	}

	.agreeBox image {
		width: 26rpx;
		height: 26rpx;
		display: block;
		position: absolute;
		top: 9rpx;
		left: 18rpx;
		margin-right: 19rpx;
	}

	.imagesBox {
		width: 80rpx;
		height: 88rpx;
	}

	.chooseBox {
		width: 60rpx;
		height: 60rpx;
	}

	.login {
		text-decoration: underline;
		text-align: center;
		margin-top: 40px;
		color: #88909E;
		font-size: 28rpx;
	}

	.textbox {
		width: 569rpx;
		display: flex;
		margin-top: 40rpx;
	}

	.textbox-1 {
		width: 30%;
		font-size: 30rpx;
		color: #999999;
	}

	.textbox-11 {
		width: 30%;
		text-align: right;
		font-size: 30rpx;
		color: #999999;
	}

	.textbox-2 {
		width: 40%;
	}
</style>
