passwordReset

This commit is contained in:
““shijing 2021-08-27 15:34:01 +08:00
parent 353114b6a6
commit 29c9752c66
3 changed files with 59 additions and 24 deletions

View File

@ -44,6 +44,7 @@ const install = (Vue, vm) => {
let tjfk = (params={})=>vm.$u.post('index.php/api/order/payment_voucher', params);//提交付款凭证
let getCode = (id)=>vm.$u.get(`/index.php/api/login/getnum/type/mobphone/to/${id}`);//获取注册码
let register = (params={})=>vm.$u.post('/index.php/api/login/reg', params);//注册
let checkUserName = (params={})=>vm.$u.get(`/index.php/api/login/check_username`, params);//注册时检查用户名是否
let getCodeRepass = (id,params)=>vm.$u.get(`/index.php/api/login/getpwdnum/type/mobphone/to/${id}`,params);//获取验证码
let changepwd = ( params)=>vm.$u.post(`/index.php/api/login/changepwd`, params);//修改密码
@ -82,6 +83,7 @@ const install = (Vue, vm) => {
getCode,
getCodeRepass,
changepwd,
checkUserName,
register};
}

View File

@ -7,7 +7,8 @@
</view>
<view class="form re">
<view class="username">
<input placeholder="请输入用户账号" v-model="userName" placeholder-style="color: rgba(255,255,255,0.8);"/>
<input placeholder="请输入用户账号" v-model="userName" @blur="nameSearch" @input="nameSearch" placeholder-style="color: rgba(255,255,255,0.8);"/>
<text v-if="!unique" class="nameAlready">用户名已存在</text>
</view>
<view class="username">
<view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()">{{getCodeText}}</view>
@ -39,7 +40,8 @@
password:"",
getCodeText:'获取验证码',
getCodeBtnColor:"#ffffff",
getCodeisWaiting:false
getCodeisWaiting:false,
unique:true,
}
},
onLoad() {
@ -89,31 +91,51 @@
},1000)
},
//
nameSearch(){
let params = {username:this.userName};
this.$u.api.checkUserName(params).then(res=>{
if(res.code===0){
if(res.data==='true'){
this.unique = false;
}else{
this.unique = true;
}
debugger;
console.log(res)
}else{}
})
},
//
doReg(){
let that = this;
uni.hideKeyboard()
//
if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(that.phoneNumber))){
uni.showToast({title: '请填写正确手机号码',icon:"none"});
return false;
if(that.unique){
uni.hideKeyboard()
//
if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(that.phoneNumber))){
uni.showToast({title: '请填写正确手机号码',icon:"none"});
return false;
}
uni.showLoading({
title: '提交中...'
})
uni.login({
provider: 'weixin',
success: function (wxLoginRes) {
let params = {username:that.userName,mobphone:that.phoneNumber,code:wxLoginRes.code,phone_code:that.code,password:that.password};
that.$u.api.register(params).then(registerRes=>{
uni.hideLoading();
debugger;
if(registerRes.code===0){
that.toLogin();
}else{}
})
},
})
}else{
uni.showToast({title: '用户名已存在,请重新选择用户名',icon:"none"});
}
uni.showLoading({
title: '提交中...'
})
uni.login({
provider: 'weixin',
success: function (wxLoginRes) {
let params = {username:that.userName,mobphone:that.phoneNumber,code:wxLoginRes.code,phone_code:that.code,password:that.password};
that.$u.api.register(params).then(registerRes=>{
uni.hideLoading();
debugger;
if(registerRes.code===0){
that.toLogin();
}else{}
})
},
})
//使
// setTimeout(()=>{
// uni.getStorage({
@ -167,4 +189,10 @@
<style lang="scss">
@import "../../static/css/login.scss";
.nameAlready{
font-size: 20rpx;
width: 170rpx;
color: #ff0000;
text-decoration: underline;
}
</style>

View File

@ -80,6 +80,11 @@
},1000)
},
toLogin(){
uni.hideKeyboard()
uni.redirectTo({url: 'login'});
uni.navigateBack();
},
doReset(){
let that = this;
uni.hideKeyboard()