|
@@ -1,47 +1,36 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view class="page"> |
|
|
<view class="page"> |
|
|
<view class="content" v-if="type == 'sendCode'"> |
|
|
|
|
|
|
|
|
<view class="content"> |
|
|
<l-input v-model="phone" placeholder="请输入手机号" left> |
|
|
<l-input v-model="phone" placeholder="请输入手机号" left> |
|
|
<l-icon slot="title" type="phone" /> |
|
|
<l-icon slot="title" type="phone" /> |
|
|
</l-input> |
|
|
</l-input> |
|
|
<view class="btn" @click="sendCode">发送验证码</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="content" v-if="type == 'checkCode'"> |
|
|
|
|
|
<l-input v-model="phone" placeholder="请输入手机号" left disabled> |
|
|
|
|
|
<l-icon slot="title" type="phone" /> |
|
|
|
|
|
</l-input> |
|
|
|
|
|
<l-input v-model="verifycode" placeholder="请输入验证码" left password> |
|
|
|
|
|
<l-icon slot="title" type="lock" /> |
|
|
|
|
|
</l-input> |
|
|
|
|
|
<view style="margin-top: 4px;color: color: #606266;"> |
|
|
|
|
|
未收到验证码?<text :style="{color:time==0?'#409EFF':'#999'}" @click="()=>{if(time==0)type='sendCode'}">重新发送</text> |
|
|
|
|
|
{{time?'( '+time+ 's'+' )' :''}} |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="btn" @click="checkverifycode">下一步</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="content" v-if="type == 'setPassword'"> |
|
|
|
|
|
<l-input v-model="phone" placeholder="请输入手机号" left disabled> |
|
|
|
|
|
<l-icon slot="title" type="phone" /> |
|
|
|
|
|
</l-input> |
|
|
|
|
|
<l-input v-model="form.newpassword" placeholder="请输入新密码" left password> |
|
|
<l-input v-model="form.newpassword" placeholder="请输入新密码" left password> |
|
|
<l-icon slot="title" type="lock" /> |
|
|
<l-icon slot="title" type="lock" /> |
|
|
</l-input> |
|
|
</l-input> |
|
|
<l-input v-model="form.newpassword1" placeholder="请再次输入新密码" left password> |
|
|
<l-input v-model="form.newpassword1" placeholder="请再次输入新密码" left password> |
|
|
<l-icon slot="title" type="lock" /> |
|
|
<l-icon slot="title" type="lock" /> |
|
|
</l-input> |
|
|
</l-input> |
|
|
|
|
|
<l-input v-model="verifycode" placeholder="请输入验证码" left password> |
|
|
|
|
|
<l-icon slot="title" type="lock" /> |
|
|
|
|
|
<template #suffix> |
|
|
|
|
|
<view style="margin-top: 4px;color: #606266;"> |
|
|
|
|
|
<text :style="{color:time==0?'#409EFF':'#999'}" @click="time==0&&sendCode()">{{hasSendCode?'重新发送':'发送验证码'}}</text> |
|
|
|
|
|
{{time?'('+time+ 's'+')' :''}} |
|
|
|
|
|
</view> |
|
|
|
|
|
</template> |
|
|
|
|
|
</l-input> |
|
|
<view class="btn" @click="setPassword">确认修改</view> |
|
|
<view class="btn" @click="setPassword">确认修改</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
// import moment from 'moment'; |
|
|
|
|
|
export default{ |
|
|
export default{ |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
type:'sendCode', |
|
|
|
|
|
phone:'', |
|
|
phone:'', |
|
|
verifycode:'', |
|
|
verifycode:'', |
|
|
|
|
|
hasSendCode:false, |
|
|
time: 0, |
|
|
time: 0, |
|
|
timeT: '', |
|
|
timeT: '', |
|
|
|
|
|
|
|
@@ -70,8 +59,7 @@ export default{ |
|
|
if(!res){ |
|
|
if(!res){ |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.type = 'checkCode' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.hasSendCode = true |
|
|
this.time = 60 |
|
|
this.time = 60 |
|
|
this.timeT = setInterval(() => { |
|
|
this.timeT = setInterval(() => { |
|
|
this.time-- |
|
|
this.time-- |
|
@@ -83,23 +71,15 @@ export default{ |
|
|
}, 1000); |
|
|
}, 1000); |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// 验证码校验 |
|
|
|
|
|
async checkverifycode() { |
|
|
|
|
|
if (!this.verifycode) { |
|
|
|
|
|
this.TOAST('请输入验证码'); |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.LOADING('正在校验...') |
|
|
|
|
|
let codeResult = await this.HTTP_POST('learun/adms/user/logincodeverify', { |
|
|
|
|
|
mobile: this.phone, |
|
|
|
|
|
verifycode: this.verifycode |
|
|
|
|
|
}) |
|
|
|
|
|
this.HIDE_LOADING() |
|
|
|
|
|
if(!codeResult)return |
|
|
|
|
|
this.type = 'setPassword' |
|
|
|
|
|
}, |
|
|
|
|
|
// 设置密码 |
|
|
// 设置密码 |
|
|
async setPassword(){ |
|
|
async setPassword(){ |
|
|
|
|
|
if(!this.phone){ |
|
|
|
|
|
this.TOAST('请输入手机号!') |
|
|
|
|
|
return |
|
|
|
|
|
}else if(!/^1[0-9]{10}$/.test(this.phone)){ |
|
|
|
|
|
this.TOAST('手机号格式不正确!') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if(!this.form.newpassword){ |
|
|
if(!this.form.newpassword){ |
|
|
this.TOAST('请输入新密码'); |
|
|
this.TOAST('请输入新密码'); |
|
|
return |
|
|
return |
|
@@ -116,11 +96,15 @@ export default{ |
|
|
this.TOAST('两次密码输入不一致'); |
|
|
this.TOAST('两次密码输入不一致'); |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
if (!this.verifycode) { |
|
|
|
|
|
this.TOAST('请输入验证码'); |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
this.LOADING() |
|
|
this.LOADING() |
|
|
let res = await this.HTTP_POST('learun/adms/usernologin/forgetpass', { |
|
|
let res = await this.HTTP_POST('learun/adms/usernologin/forgetpass', { |
|
|
newpassword:this.MD5(this.form.newpassword), |
|
|
newpassword:this.MD5(this.form.newpassword), |
|
|
// this.MD5() |
|
|
|
|
|
phone:this.phone |
|
|
|
|
|
|
|
|
phone:this.phone, |
|
|
|
|
|
verifycode: this.verifycode |
|
|
}) |
|
|
}) |
|
|
this.HIDE_LOADING() |
|
|
this.HIDE_LOADING() |
|
|
if(!res)return |
|
|
if(!res)return |
|
|