手机登录bug修改

master
Lee-1203 2022-04-22 18:00:16 +08:00
parent e57c1c9bd8
commit 2e43ad19c1
5 changed files with 19 additions and 26 deletions

3
app.js
View File

@ -5,8 +5,7 @@ import http from './utils/requst'
dd['$http'] = http; dd['$http'] = http;
import utils from '/utils/utils' import utils from '/utils/utils'
dd['utils'] = utils; dd['utils'] = utils;
// dd['baseUrl'] = 'http://aspiration.scdxtc.cn'; dd['baseUrl'] = 'https://sy.emingren.com';
dd['baseUrl'] = 'https://ypzy.emingren.com';
App({ App({
onLaunch(options) { onLaunch(options) {
// 第一次打开 // 第一次打开

View File

@ -1,4 +1,3 @@
export default { export default {
// BASE_URL: 'http://aspiration.scdxtc.cn' // api接口服务器地址 BASE_URL: 'https://sy.emingren.com' // api接口服务器地址
BASE_URL: 'https://ypzy.emingren.com' // api接口服务器地址
} }

View File

@ -8,11 +8,11 @@ Page({
console.log(userType,123) console.log(userType,123)
if(userType==1){ if(userType==1){
this.setData({ this.setData({
url: 'http://aspevel.scdxtc.cn/#/consultant?token='+token url: 'https://sy.h5.emingren.com/#/consultant?token='+token
}) })
}else if(userType==0){ }else if(userType==0){
this.setData({ this.setData({
url: 'http://aspevel.scdxtc.cn/#/index?token='+token url: 'https://sy.h5.emingren.com/#/index?token='+token
}) })
} }

View File

@ -181,7 +181,7 @@ Page({
console.log(res,'验证码数据') console.log(res,'验证码数据')
// 跳转页面 // 跳转页面
dd.redirectTo ({ dd.redirectTo ({
url: '/pages/login/verification/verification?phone='+this.data.phoneNumber+'&code='+res.data.code url: '/pages/login/verification/verification?phone='+this.data.phoneNumber
}) })
}) })
} }

View File

@ -9,15 +9,14 @@ Page({
userType: 0, userType: 0,
placeholder:'-', placeholder:'-',
number:4, number:4,
code:'',
isToast: false, isToast: false,
}, },
onLoad(options) { onLoad(options) {
this.setData({ this.setData({
phoneData: options.phone, phoneData: options.phone,
code: options.code,
}) })
console.log(this.data.code,'传过来的验证码')
dd.setNavigationBar({ dd.setNavigationBar({
title: '手机验证码', title: '手机验证码',
@ -55,33 +54,21 @@ Page({
}); });
if(this.data.value.length==4){ if(this.data.value.length==4){
this. handleInput(); this. handleInput();
console.log(this.data.value,'输入的验证码')
} }
}, },
handleInput() { handleInput() {
if(this.data.code == this.data.value){
this.hideKeyboard(); this.hideKeyboard();
}else{
this.setData({
value: '',
toastText: '验证码错误',
isToast: true
});
setTimeout(()=> {
this.setData({
isToast: false
})
}, 1000)
}
}, },
getCode(){ getCode(){
let params = { let params = {
phone: this.data.phoneData, phone: this.data.phoneData,
type: "login", type: "login",
} }
dd.$http.post('/api/common/send-sms-captcha',params).then(res=>{ dd.$http.post('/api/common/send-sms-captcha',params).then(res=>{
console.log(res,'验证码数据')
if (!this.data.timer) { if (!this.data.timer) {
this.setData({ this.setData({
count: 60, count: 60,
@ -115,7 +102,6 @@ Page({
} }
dd.$http.post('/api/user/login-by-Phone',params).then(res=>{ dd.$http.post('/api/user/login-by-Phone',params).then(res=>{
console.log(res,'登录认证数据') console.log(res,'登录认证数据')
if (res.code == 0) { if (res.code == 0) {
// 缓存token // 缓存token
dd.$toolAll.setCache('token',res.data.token); dd.$toolAll.setCache('token',res.data.token);
@ -126,8 +112,17 @@ Page({
dd.redirectTo ({ dd.redirectTo ({
url: '/pages/home/home' url: '/pages/home/home'
}) })
}else{
this.setData({
toastText: '验证码错误',
isToast: true
});
setTimeout(()=> {
this.setData({
isToast: false
})
}, 1000)
} }
}) })
}, },
}); });