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 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 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 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 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);//修改密码 let changepwd = ( params)=>vm.$u.post(`/index.php/api/login/changepwd`, params);//修改密码
@ -82,6 +83,7 @@ const install = (Vue, vm) => {
getCode, getCode,
getCodeRepass, getCodeRepass,
changepwd, changepwd,
checkUserName,
register}; register};
} }

View File

@ -7,7 +7,8 @@
</view> </view>
<view class="form re"> <view class="form re">
<view class="username"> <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>
<view class="username"> <view class="username">
<view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()">{{getCodeText}}</view> <view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()">{{getCodeText}}</view>
@ -39,7 +40,8 @@
password:"", password:"",
getCodeText:'获取验证码', getCodeText:'获取验证码',
getCodeBtnColor:"#ffffff", getCodeBtnColor:"#ffffff",
getCodeisWaiting:false getCodeisWaiting:false,
unique:true,
} }
}, },
onLoad() { onLoad() {
@ -89,9 +91,25 @@
},1000) },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(){ doReg(){
let that = this; let that = this;
if(that.unique){
uni.hideKeyboard() uni.hideKeyboard()
// //
if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(that.phoneNumber))){ if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(that.phoneNumber))){
@ -114,6 +132,10 @@
}) })
}, },
}) })
}else{
uni.showToast({title: '用户名已存在,请重新选择用户名',icon:"none"});
}
//使 //使
// setTimeout(()=>{ // setTimeout(()=>{
// uni.getStorage({ // uni.getStorage({
@ -167,4 +189,10 @@
<style lang="scss"> <style lang="scss">
@import "../../static/css/login.scss"; @import "../../static/css/login.scss";
.nameAlready{
font-size: 20rpx;
width: 170rpx;
color: #ff0000;
text-decoration: underline;
}
</style> </style>

View File

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