tanxue преди 6 месеца
родител
ревизия
ab795d5ab7
променени са 2 файла, в които са добавени 137 реда и са изтрити 87 реда
  1. 36 22
      common/styles/global/pages.scss
  2. 101 65
      pages/login.vue

+ 36 - 22
common/styles/global/pages.scss

@@ -1,15 +1,15 @@
 /***** 这里放页面样式 *****/
-// 登录页
+// 登录页  padding-bottom: env(safe-area-inset-bottom); box-sizing: unset;
 .ezy-login-page {
-	width:100%;height:100vh;background-color: #01a1ff;position: relative;
-	background-image: url("@/static/images/login/login-bj.jpg");@include ezy-no-repeat-cover(top);
-	.tel-box{
-		display: flex;flex-direction: column;box-sizing: border-box;padding: 0 53rpx;
-		position: absolute;top:calc(690rpx + var(--status-bar-height));
-		left: var(--window-left);right: var(--window-right);
+	
+	width:100%;height:100vh; background-color: #01a1ff;position: relative;overflow:hidden;
+	.ezy-login-wrap{width:100%;height: 1623.08rpx;background-image: url("@/static/images/login/login-bj.jpg");@include ezy-no-repeat-cover(top);}
+	.login-body-box{
+		display: flex;flex-direction: column;display: flex;box-sizing: border-box;
+		position: absolute;top:690rpx;left: 50%;transform: translateX(-50%);
 	}
-	.tel-img{
-		width: 411rpx;height: 73rpx;@include ezy-no-repeat-cover;
+	.login-title-img{
+		width: 411rpx;height: 73rpx;@include ezy-no-repeat-cover;margin-right: auto;
 		background-image: url("@/static/images/login/login-tel.png");
 	}
 	.phone-input-box{
@@ -17,43 +17,57 @@
 		display: flex;align-items: center;margin-top: 50rpx;
 		background-image: url("@/static/images/login/login-tel-bj.png");@include ezy-no-repeat-cover;
 		.phone-prefix {
-		  font-size: 20px;color: #ffffffd9;font-weight: normal;display: flex;align-items: center;
-		  span{padding: 0 10px;}
+		  width: 90rpx;margin-left:18rpx;font-size: 38rpx;color: #ffffffd9;
+		  font-weight: normal;display: flex;align-items: center;justify-content: space-between;flex-shrink: 0;
 		}
-		.phone-prefix::after{content: '';width: 1rpx;height: 40rpx;display: inline-block;;background-color: #ffffffd9;}
-		.phone-input {font-size: 20px;padding: 0 22rpx;box-sizing: border-box;color: #fff;}
-		.uni-input-placeholder {font-size: 16px;color: #ffffffd9;
+		.phone-prefix::after{content: '';width: 1rpx;height: 40rpx;display: inline-block;background-color: #ffffffd9;}
+		.phone-input {font-size: 38rpx;padding: 0 22rpx;box-sizing: border-box;color: #fff;flex: 1;}
+		.uni-input-placeholder {font-size: 30rpx;color: #ffffffd9;
 		}
 		.close-btn{width: 42rpx;height: 42rpx;margin-right: 30rpx;@include ezy-no-repeat-cover;
-		background-image: url("@/static/images/login/login-close-icon.png");}
+		background-image: url("@/static/images/login/login-close-icon.png");flex-shrink: 0;}
 	}
 		 
 	.agreement-checkbox-box {
-		  display: flex;justify-content: center;margin-top: 4rpx;;
+		  display: flex;justify-content: center;margin-top: 10rpx;;
 		  .agreement-checkbox {
 		  	.uni-checkbox-wrapper{
-		  		color: #ffffffd9;font-size: 14px;line-height: 1;
-		  		flex-direction: row;flex-wrap: wrap;
+		  		color: #ffffffd9;font-size: 27rpx;line-height: 1.3;
+		  		flex-direction: row;display: flex;    
 		  		.uni-checkbox-input{
 		  			width: 40rpx;height: 40rpx;border: 0;background-color: unset;@include ezy-no-repeat-cover;
 		  			background-image: url("@/static/images/login/login-checked-bj.png");margin-right: 4rpx;
 		  			svg {width: 28;height: 28rpx;top: 48%;left: 50%;}
 		  		}
 		  	}
-		  	.agreement-text{color: #e3f524;}
+		  	.agreement-text{color: #e3f524;display: contents;}
 		  }
 	}
 		 
-	.yzm-btn-img{
+	.yzm-btn-disabled{
 		width: 644rpx;height: 106rpx;margin-top: 84rpx;
-		background-image: url("@/static/images/login/login-zym-bj.png");@include ezy-no-repeat-cover;
+		background-color: red;
+		@include ezy-no-repeat-cover;
 	}
+	.yzm-btn-normal{background-image: url("@/static/images/login/login-zym-bj.png");}
 	.wx-btn-img{
-		width: 96rpx;height: 96rpx;position: absolute;bottom:3%;
+		width: 96rpx;height: 96rpx;position: absolute;bottom:5%;
 		left: 50%;transform:translateX(-50%) ;
 		background-image: url("@/static/images/login/login-wx-icon.png");@include ezy-no-repeat-cover;
 	}
+	/* 针对小屏幕设备 */
+	@media (max-height: 700px) {
+	  .phone-input-box{margin-top: 24rpx;}
+	  .yzm-btn-img{margin-top: 52rpx;}
+	  .wx-btn-img{bottom:3%;}
+	}
+	@media (max-height: 480px) {
+		overflow:auto;
+		.login-body-box{top:660rpx;}
+		.ezy-login-wrap{height: 1400rpx;position: relative;}
+	}
 }
+
 	
 .lli-develop-expect-page{
 	display: flex;flex-direction: column;justify-content: space-between;align-items: center;

+ 101 - 65
pages/login.vue

@@ -1,79 +1,115 @@
 <template>
   <view class="ezy-login-page">
-	  <view class="tel-box">
-	  		<view class="tel-img"></view>
-	  		<!-- 手机号输入框(使用+86前缀,并隐藏真实号码部分数字) -->
-	  		  <view class="phone-input-box">
-	  		    <text class="phone-prefix">+86</text>
-	  		    <input class="phone-input" type="text" v-model="phoneNumber" placeholder="请输入手机号" />
-				<view class="close-btn"></view>
-	  		  </view>
-	  		  <!-- 协议勾选框和按钮 -->
-	  		  <view class="agreement-checkbox-box">
-	  		    <checkbox class="agreement-checkbox" color="#FFFFFF" :checked="isAgreed" @change="handleAgreementChange">
-				  我已阅读并同意
-				  <text class="agreement-text">《用户协议》</text>
-				  和
-				  <text class="agreement-text">《隐私政策》</text>
-	  		    </checkbox>
-	  		  </view>
-			  <view class="yzm-btn-img" @click="handleLogin"></view>
-	  	  </view>
-		  <view class="wx-btn-img"></view>
+	  <view class="ezy-login-wrap" >
+			<!-- 手机号 -->
+			<template v-if="data.loginTel">
+				<view class="login-body-box">
+					<view class="login-title-img"></view>
+				    <view class="phone-input-box">
+						<view class="phone-prefix">+86</view>
+						<input class="phone-input" type="text" v-model="data.phoneNumber" placeholder="请输入手机号" 
+						maxlength="11" :value="data.phoneNumber" @input="clearTelInput" />
+						<view class="close-btn" v-if="data.clearTelIcon" @click="clearTel"></view>
+				    </view>
+					<!-- 协议勾选框和按钮 -->
+					<view class="agreement-checkbox-box">
+						<checkbox class="agreement-checkbox" color="#FFFFFF" :checked="isAgreed" @change="handleAgreementChange">
+						  我已阅读并同意<view class="agreement-text">《用户协议》</view>和<view class="agreement-text">《隐私政策》</view>
+						</checkbox>
+					</view>
+					<view class="yzm-btn-disabled" @click="getYzmBtn" :class="data.telStatus"></view>
+				</view>
+				<view class="wx-btn-img"></view>
+			</template>
+			<!-- 验证码 -->
+			<template v-if="!data.loginTel">
+				<view class="login-body-box">
+					<view class="login-title-img"></view>
+					<view class="phone-prefix">验证码已发送至:{{data.phoneNumber}}</view>
+					<view class="phone-input-box">
+						<input class="phone-input" type="text" v-model="data.yzmNumber" placeholder="请输入验证码" 
+						maxlength="6" :value="data.yzmNumber" @input="clearYzmInput" />
+						<view class="close-btn" v-if="data.clearYzmIcon" @click="clearYzm"></view>
+					</view>
+					<view class="yzm-btn-disabled" @click="loginBtn" :class="data.yzmStatus"></view>
+				</view>
+			</template>
+		  </view>
+		  
   </view>
 </template>
 
 <script setup>
 	import {
-		getAppConfig,
-		login,
-		kaoshiList
-	} from '@/api/login.js'
-	import JSEncrypt from 'jsencrypt';
-	import {
-		ref
-	} from 'vue';
-	let systemName = ref('麦塔考试系统')
-	let username = ref('')
-	let password = ref('')
-	// 密码公钥
-	const publicKey ='MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1xwHUB9shgHJlVbs3/LK8CbUa0KMrSfw/M2SAdXpy/iYvwyMacigKNkCi+fiLGcnBigzwO9WtiT/oceF431UsJs2MqLS2ZPzaL+BktR9zWWtNAsZpxUfGyI3YT+T7TT94Rs9O80896FHx9MvE1cHR2bvybskgfB2zuzd9c96+yZ9KXebhbIwDZpMW0fwx7vZ+OywTL3/6SSg2pRf+AvHQsBfTPVbMSgIQegAL4WocD2PerpSGlFElnzZT8jKM4TqDVyhfsYT+4/Gi7/RDDCngdtmruCUIoz8OCLfjVrBsvHfuNNBFIwjTbxtWhrRhVii+wz7RfNxT9+pU/3sjIRKtwIDAQAB'
-	const encrypt = new JSEncrypt();
-	encrypt.setPublicKey(publicKey);
-	const changePassword = () => {
-
+		ref,
+		reactive
+	} from "vue"
+	
+	const data = reactive({
+		loginTel: true,
+		phoneNumber: null,
+		clearTelIcon: false,
+		telStatus:'',
+		isAgreed: false,
+		yzmNumber: null,
+		clearYzmIcon: false,
+		yzmStatus:'',
+	})
+	
+	/********* 手机号部分 *********/
+	const getYzmBtn = () => {
+		console.log('123');
+		data.loginTel =false;
+		
+	}
+	
+	// 手机号校验规则
+	const validatePhoneNumber = (value) => {
+	  const phoneRegex = /^1[3-9]\d{9}$/;
+	  if (phoneRegex.test(value)) {
+		console.log('手机号格式正确');
+		data.telStatus = 'yzm-btn-normal';
+	  } else {
+	    console.log('手机号格式不正确');
+	  }
+	}
+	
+	const clearTelInput = (event) => {
+	    if (event.detail.value.length > 0) {
+	        data.clearTelIcon = true;
+			validatePhoneNumber(event.detail.value);
+	    } else {
+	        data.clearTelIcon = false;
+	    }
+	}
+			
+	const clearTel = () => {
+		data.phoneNumber = '';
+		data.clearTelIcon = false;
 	}
-	const handleLogin = () => {
+	
+	/********* 验证码 *********/
+	const loginBtn = () => {
 		uni.switchTab({
 			url: '/pages/index/index'
 		});
-		/* console.log('Username:', username.value);
-		console.log('Password:', password.value);
-		let req = {
-			password: 'sslQR4MPhS/du9qQ7/sRc6OFaVIZ0GwHDWmgAhUj08+BBlTzo+kEMgfgi0rrLFx59mrK5ypJc71Ojn3bHciHSlRGcIJex80RHVQyknC1i1HnkQ1T6vgKWBFHISQpd9qEo2fXCEYSRh8Rl3/qfO8XD5NuCrQxqF/REaVUX3fLVB8=',
-			//password: encrypt.encrypt(password.value),
-			userName: 'root'
-		}
-		login(req).then(res => {
-			let obj = JSON.stringify(res.data)
-			console.log(obj)
-			uni.setStorage({
-				key: 'Mta-Auth',
-				data: obj // 假设 this.userInputValue 是用户输入的数据
-			});
-			uni.switchTab({
-				url: '/pages/index/index'
-			});
-			// setTimeout(() => {
-			// 	let req = {
-			// 		'page': 1,
-			// 		'size': 4,
-			// 		'status': 1,
-			// 	}
-			// 	kaoshiList(req).then(res => {
-			// 		console.log(res)
-			// 	})
-			// }, 5000)
+		/* uni.navigateTo({
+			url: `/pages/study/index?gradeId=${options.grade}&termId=${options.term}&text=${text1}${text2}`
 		}) */
 	}
+	
+	const clearYzmInput = (event) => {
+		if (event.detail.value.length > 0) {
+		    data.clearYzmIcon = true;
+		} else {
+		    data.clearYzmIcon = false;
+		}
+	}
+	
+	const clearYzm = () => {
+		data.yzmNumber = '';
+		data.clearYzmIcon = false;
+	}
+	
+	
 </script>