passwordReset
This commit is contained in:
parent
353114b6a6
commit
29c9752c66
|
@ -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};
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
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{}
|
||||
})
|
||||
},
|
||||
})
|
||||
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"});
|
||||
}
|
||||
//模板示例把用户注册信息储存在本地,实际使用中请替换为上传服务器。
|
||||
// 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>
|
||||
|
|
|
@ -80,6 +80,11 @@
|
|||
|
||||
},1000)
|
||||
},
|
||||
toLogin(){
|
||||
uni.hideKeyboard()
|
||||
uni.redirectTo({url: 'login'});
|
||||
uni.navigateBack();
|
||||
},
|
||||
doReset(){
|
||||
let that = this;
|
||||
uni.hideKeyboard()
|
||||
|
|
Loading…
Reference in New Issue