Browse Source

调整注册功能

master
453530270@qq.com 2 years ago
parent
commit
c08092f8e2
  1. 10
      api/reg/index.js
  2. 31
      pages/reg/reg.vue

10
api/reg/index.js

@ -2,10 +2,16 @@ import request from '@/utils/request'
// api地址
const api = {
smsurl:'slb/userself/v1/account/username/unique-validate/'
smsurl:'slb/userself/v1/account/username/unique-validate/',
verifycode:'slb/userself/v1/verify-code'
}
// 发送验证码(手机号+验证码)
// 校验手机号是否唯一
export function sendSms(params) {
return request.get(api.smsurl+params)
}
// 发送验证码(手机号+验证码)
export function sendVerifyCode(params){
return request.get(api.verifycode,params)
}

31
pages/reg/reg.vue

@ -46,7 +46,7 @@
<!-- 找回密码 注册 -->
<view class="regtips">
<view>已拥有账户?<a class="loginnow" @tap="gologin">登录</a></view>
<view>已拥有账户?<a class="loginnow" @tap="debounce(gologin,500)">登录</a></view>
</view>
<!-- 弹框 -->
@ -92,6 +92,8 @@
utchk2:false,
//
murl:"",
//
isCutdown:false,
//
st:120,
// /
@ -133,14 +135,27 @@
getsmscode(){
//
let mb = this.mobile
if(this.validteMobile(mb)){
if(this.validteMobile(mb) && this.isCutdown!=true){
regApi.sendSms(mb).then(res=>{
if(res.resultCode=="00000000"){
if(res.data ==1){
this.$toast("手机号已被注册")
//
this.countDown()
this.st = 60
}else{ //
//
let pars={username:mb,purpose:1}
regApi.sendVerifyCode(pars).then(res=>{
// console.log("verify code",res)
if(res.resultCode === "00000000"){
//
this.countDown()
this.$toast("发送成功")
}else{
this.$error(res.resultMsg)
}
})
}
//
}
console.log(res)
});
@ -152,15 +167,17 @@
let app = this
app.$refs.abtn.$el.innerText=app.st+"秒"
let qq = app.st
console.log(qq)
// console.log(qq)
setTimeout(function(){
if(app.st>1){
app.st--
app.countDown(app.st)
//ing
app.isCutdown=true
}else{
app.st = "获取验证码"
app.st=0
app.$refs.abtn.$el.innerText = "获取验证码"
}
},1000)
},

Loading…
Cancel
Save