二维码识别完成

master
Lee-1203 2022-03-23 13:40:04 +08:00
parent fae702dcab
commit e57c1c9bd8
7 changed files with 61 additions and 14 deletions

View File

@ -28,10 +28,10 @@ Page({
dd.$toolAll.removeCache('userData'); dd.$toolAll.removeCache('userData');
dd.$toolAll.removeCache('isInFirst'); dd.$toolAll.removeCache('isInFirst');
// 钉钉跳转 // 钉钉跳转
dd.navigateTo({url: '/pages/login/login'}); dd.redirectTo({url: '/pages/login/login'});
}else if(e.detail.name !== 'clearAll' && e.detail.name !== ''){ }else if(e.detail.name == 'downImg'){
dd.downloadFile({ dd.downloadFile({
url: e.detail.name, url: e.detail.url,
success({ filePath }) { success({ filePath }) {
dd.previewImage({ dd.previewImage({
urls: [filePath], urls: [filePath],

View File

@ -4,6 +4,7 @@ textarea::-webkit-input-placeholder{
} }
.verification{ .verification{
background-color: #f1f4f7; background-color: #f1f4f7;
height: 100vhhaode ;
} }
.phone-bg{ .phone-bg{
padding: 0 .4rem; padding: 0 .4rem;
@ -43,8 +44,6 @@ textarea::-webkit-input-placeholder{
width: calc(100% - 3.6rem); width: calc(100% - 3.6rem);
} }
.login-btns{ .login-btns{
width: 6.8rem; width: 6.8rem;
margin: .5rem auto 0; margin: .5rem auto 0;
@ -59,6 +58,11 @@ textarea::-webkit-input-placeholder{
font-size: .32rem; font-size: .32rem;
color: #FFFFFF; color: #FFFFFF;
} }
.login-btns>view:last-child{
background-color: rgba(255, 255, 255, 0);
margin-top: .2rem;
color: #999;
}
.addr-select-bg{ .addr-select-bg{
width: 100vw; width: 100vw;
height: 100%; height: 100%;

View File

@ -15,6 +15,7 @@
</view> </view>
<view class="login-btns"> <view class="login-btns">
<view onTap="bindPhone">确认</view> <view onTap="bindPhone">确认</view>
<view onTap="passBind">跳过</view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -166,4 +166,12 @@ Page({
openPhoneTips: false, openPhoneTips: false,
}) })
}, },
// 跳过绑定
passBind(){
// 跳转页面
dd.redirectTo ({
url: '/pages/home/home'
})
},
}); });

View File

@ -12,11 +12,11 @@
</view> </view>
</view> </view>
</view> </view>
<input class="input-code" onBlur="handleInput" onInput="bindValueInput" id="code" type="text" maxlength="6"/> <input class="input-code" onInput="bindValueInput" id="code" type="text" maxlength="{{number}}"/>
</view> </view>
</view> </view>
<view class="span" a:if="{{show}}">{{count}}秒后可重新获取验证码</view> <view class="span" a:if="{{show}}">{{count}}秒后可重新获取验证码</view>
<view a:else @click="getCode()" class="getCode">获取验证码</view> <view a:else onTap="getCode" class="getCode">获取验证码</view>
</view> </view>
</view> </view>
<!-- 提示框 --> <!-- 提示框 -->

View File

@ -45,16 +45,20 @@ Page({
show: true show: true
}) })
},1000); },1000);
} };
}, },
// 获取验证码 // 获取验证码
bindValueInput(e){ bindValueInput(e){
this.setData({ this.setData({
value: e.detail.value, value: e.detail.value,
}); });
if(this.data.value.length==4){
this. handleInput();
}
}, },
// 输入完成获取数据
handleInput() { handleInput() {
if(this.data.code == this.data.value){ if(this.data.code == this.data.value){
this.hideKeyboard(); this.hideKeyboard();
@ -71,6 +75,37 @@ Page({
}, 1000) }, 1000)
} }
}, },
getCode(){
let params = {
phone: this.data.phoneData,
type: "login",
}
dd.$http.post('/api/common/send-sms-captcha',params).then(res=>{
console.log(res,'验证码数据')
if (!this.data.timer) {
this.setData({
count: 60,
show: true
})
let that = this;
const countDown = setInterval(() => {
if(that.data.count <= 1){
that.setData({
count:60,
show: false
})
clearInterval(countDown)
return
}
that.data.count --
that.setData({
count: that.data.count,
show: true
})
},1000);
}
})
},
// 登录 // 登录
hideKeyboard() { hideKeyboard() {
@ -86,7 +121,6 @@ Page({
dd.$toolAll.setCache('token',res.data.token); dd.$toolAll.setCache('token',res.data.token);
// 缓存用户信息 // 缓存用户信息
dd.$toolAll.setCache('userinfo',res.data); dd.$toolAll.setCache('userinfo',res.data);
dd.$toolAll.setCache('centerUserData',res.data);
dd.$toolAll.setCache('userData',res.data); dd.$toolAll.setCache('userData',res.data);
// 跳转页面 // 跳转页面
dd.redirectTo ({ dd.redirectTo ({

View File

@ -20,20 +20,20 @@ Page({
dd.$toolAll.setCache('isInFirst',60000000000000); dd.$toolAll.setCache('isInFirst',60000000000000);
if(dd.$toolAll.getCache('userData')){ if(dd.$toolAll.getCache('userData')){
// 前往首页 // 前往首页
dd.redirectTo({url:'/pages/home/home'}); dd.navigateTo({url:'/pages/home/home'});
}else{ }else{
// 前往登录页 // 前往登录页
dd.redirectTo({url:'/pages/login/login'}); dd.navigateTo({url:'/pages/login/login'});
} }
}, 3000); }, 3000);
}else{ }else{
if(dd.$toolAll.getCache('userData')){ if(dd.$toolAll.getCache('userData')){
// 前往首页 // 前往首页
dd.redirectTo({url:'/pages/home/home'}); dd.navigateTo({url:'/pages/home/home'});
}else{ }else{
// 前往登录页 // 前往登录页
dd.redirectTo({url:'/pages/login/login'}); dd.navigateTo({url:'/pages/login/login'});
} }
} }
}, },