Parcourir la source

支付宝登录调整

DELL il y a 3 ans
Parent
commit
d58fe30260
2 fichiers modifiés avec 18 ajouts et 8 suppressions
  1. 12 8
      src/pages/login/code.vue
  2. 6 0
      src/pages/login/index.vue

+ 12 - 8
src/pages/login/code.vue

@@ -5,13 +5,13 @@
 			<view class="login">
 				<view class="login-title">验证码登录</view>
 				<view class="login-input pat">
-					<u-input placeholder="请输入手机号" type="number" v-model="mobile" border="none" clearable/>
+					<u-input placeholder="请输入手机号" type="number" v-model="mobile" border="none" clearable @blur="changeNumber"/>
 				</view>
 				<view class="login-input">
-					<u-input placeholder="请输入短信验证码" type="number" v-model="code" clearable>
+					<u-input placeholder="请输入短信验证码" type="number" v-model="code" clearable  @blur="changeCode">
 						<template slot="suffix">
 							<u-code ref="uCode" @change="codeChange" seconds="60" changeText="Xs"></u-code>
-							<u-button @tap="getCode" :text="tips" type="default" size="mini"></u-button>
+							<u-button @click="getCode" :text="tips" type="default" size="mini"></u-button>
 						</template>
 					</u-input>
 				</view>
@@ -55,10 +55,7 @@
 					return
 				}
 				if (this.$refs.uCode.canGetCode) {
-					// 模拟向后端请求验证码
-					uni.showLoading({
-						title: '正在获取验证码'
-					})
+					
 					// 这里此提示会被this.start()方法中的提示覆盖
 					uni.$u.toast('验证码已发送');
 					// 通知验证码组件内部开始倒计时
@@ -76,6 +73,13 @@
 				}
 			},
 
+			changeNumber(e) {
+				this.mobile = e
+			},
+			changeCode(e) {
+				this.code = e
+			},
+			
 			login() {
 				let _this = this
 				if (!_this.mobile) {
@@ -105,7 +109,7 @@
 						uni.setStorageSync('token', res.token)
 						_this.getBaseInfo()
 						// #endif
-						// #ifdef H5
+						// #ifdef H5 || MP-ALIPAY
 						uni.$u.toast('登录成功');
 						uni.setStorageSync('token', res.token)
 						setTimeout(() => {

+ 6 - 0
src/pages/login/index.vue

@@ -13,10 +13,16 @@
 				<image src="../../static/public/logo.png" mode="scaleToFill"></image>
 				<view class="login-image-txt">盲票</view>
 			</view>
+			<!-- #ifdef MP-ALIPAY -->
+			<!-- <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="checked">支付宝登录</button>
+			<button @click="getPhoneNumber" v-else>支付宝登录</button> -->
+			<!-- #endif -->
+			<!-- #ifndef MP-ALIPAY -->
 			<view class="login-btn">
 				<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="checked">微信登录</button>
 				<button @click="getPhoneNumber" v-else>微信登录</button>
 			</view>
+			<!-- #endif -->
 			<view class="flex login-code" @click="toCode">手机号登录/注册</view>
 		</view>