From 8380524d80ffd083de8cc8153384c8b8a09bf91e Mon Sep 17 00:00:00 2001
From: liudan <18634735655@163.com>
Date: Fri, 19 May 2023 14:53:08 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/modules/base.js | 4 ++++
pages/login.vue | 32 ++++++++++++++++++++++++--------
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/api/modules/base.js b/api/modules/base.js
index 2a9eeb4..b00c9e8 100644
--- a/api/modules/base.js
+++ b/api/modules/base.js
@@ -18,6 +18,10 @@ export default {
setCode(param){
return req.post("index/sendMsm", param)
},
+ //登录
+ smsLogin(param){
+ return req.post("index/msmLogin", param)
+ },
// 登录协议
getLoginProtocol(param) {
return req.post("index/getLoginProtocol", param)
diff --git a/pages/login.vue b/pages/login.vue
index 7e577e6..09fbbda 100644
--- a/pages/login.vue
+++ b/pages/login.vue
@@ -45,7 +45,7 @@
-
+
@@ -175,6 +175,21 @@
}
},
+ async smsLogin(){
+ let res = await this.$api.base.smsLogin({
+ phone:this.phone,
+ code:this.code
+ })
+ console.log(res,"---")
+ this.$util.showLoading({
+ title: "登录中..."
+ })
+ try {
+ this.toLogin(res)
+ } catch (e) {
+ this.$util.hideAll()
+ }
+ },
async toLogin(userInfo) {
let user_info = await this.$api.base.appLogin({
data: userInfo
@@ -238,13 +253,14 @@
phone:this.phone
})
console.log(res,"999")
- setTimeout(() => {
- uni.hideLoading();
- // 这里此提示会被this.start()方法中的提示覆盖
- uni.$u.toast('验证码已发送');
- // 通知验证码组件内部开始倒计时
- this.$refs.uCode.start();
- }, 2000);
+ if(res){
+ uni.hideLoading();
+ // 这里此提示会被this.start()方法中的提示覆盖
+ uni.$u.toast('验证码已发送');
+ // 通知验证码组件内部开始倒计时
+ this.$refs.uCode.start();
+ }
+
} else {
uni.$u.toast('倒计时结束后再发送');
}