guhongwei před 2 roky
rodič
revize
ff96e82b32
1 změnil soubory, kde provedl 52 přidání a 12 odebrání
  1. 52 12
      pages/login/index.vue

+ 52 - 12
pages/login/index.vue

@@ -7,8 +7,14 @@
 						<uni-easyinput type="text" v-model="form.phone" placeholder="请输入手机号" />
 					</uni-forms-item>
 					<uni-forms-item label="验证码" name="code">
-						<uni-easyinput type="text" v-model="form.code" placeholder="请输入验证码" />
-						<button type="default" size="mini">验证码</button>
+						<view class="yzm">
+							<view class="l">
+								<uni-easyinput type="text" v-model="form.code" placeholder="请输入手机验证码" />
+							</view>
+							<view class="r">
+								<button type="default" size="mini" @tap.stop="sendCount">{{time_count==0?'验证码':time_count}}</button>
+							</view>
+						</view>
 					</uni-forms-item>
 					<view class="btn">
 						<button type="default" size="mini" @click="toSubmit('form')">提交登录</button>
@@ -279,9 +285,13 @@
 			// 获取验证码
 			sendCount() {
 				const that = this;
-				let form = that.phoneForm;
+				let form = that.form && that.form.phone ? that.form : that.phoneForm;
 				if (form && form.phone) {
 					let time_count = 60;
+					uni.showToast({
+						title: '发送成功',
+						icon: 'none'
+					});
 					that.$set(that, `time_count`, time_count);
 					that.timeDown();
 				} else {
@@ -345,6 +355,31 @@
 					that.wxLogins();
 				}
 			},
+			// 账号登录
+			toSubmit(ref) {
+				const that = this;
+				let agree = that.agree;
+				that.$refs[ref].validate().then(async params => {
+					let code = '1234';
+					if (params.code == code) {
+						if (agree) {
+							console.log(params);
+						} else {
+							uni.showToast({
+								title: '请阅读并同意用户协议和隐私政策',
+								icon: 'none'
+							})
+						}
+					} else {
+						uni.showToast({
+							title: '验证码错误',
+							icon: 'none'
+						})
+					}
+				}).catch(err => {
+					console.log(err);
+				})
+			},
 			// 同意隐私协议
 			changeAgree() {
 				const that = this;
@@ -369,11 +404,14 @@
 			.btn {
 				text-align: center;
 				margin: 0 0 2vw 0;
+				width: 96vw;
 
 				button {
-					margin: 0 2vw;
+					width: 40%;
+					padding: 1vw 2vw;
 					background-color: var(--f35BColor);
 					color: var(--fffColor);
+					font-size: var(--font20Size);
 				}
 			}
 		}
@@ -422,16 +460,18 @@
 				width: 100%;
 			}
 		}
-	}
 
-	.uni-data-checklist {
-		border: 1px solid #E5E5E5;
-		padding: 1vw;
-		border-radius: 5px;
-	}
+		.uni-data-checklist {
+			border: 1px solid #E5E5E5;
+			padding: 1vw;
+			border-radius: 5px;
+		}
+
+		.uni-forms-item {
+			margin-bottom: 2vw !important;
+		}
+
 
-	.uni-forms-item {
-		margin-bottom: 2vw !important;
 	}
 
 	.yzm {