Procházet zdrojové kódy

忘记密码

娄底高职分支
yxq před 2 týdny
rodič
revize
0f2bc86282
1 změnil soubory, kde provedl 25 přidání a 41 odebrání
  1. +25
    -41
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/forgotPassword.vue

+ 25
- 41
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/forgotPassword.vue Zobrazit soubor

@@ -1,47 +1,36 @@
<template>
<view class="page">
<view class="content" v-if="type == 'sendCode'">
<view class="content">
<l-input v-model="phone" placeholder="请输入手机号" left>
<l-icon slot="title" type="phone" />
</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-icon slot="title" type="lock" />
</l-input>
<l-input v-model="form.newpassword1" placeholder="请再次输入新密码" left password>
<l-icon slot="title" type="lock" />
</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>
</view>
</template>

<script>
// import moment from 'moment';
export default{
data() {
return {
type:'sendCode',
phone:'',
verifycode:'',
hasSendCode:false,
time: 0,
timeT: '',
@@ -70,8 +59,7 @@ export default{
if(!res){
return
}
this.type = 'checkCode'
this.hasSendCode = true
this.time = 60
this.timeT = setInterval(() => {
this.time--
@@ -83,23 +71,15 @@ export default{
}, 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(){
if(!this.phone){
this.TOAST('请输入手机号!')
return
}else if(!/^1[0-9]{10}$/.test(this.phone)){
this.TOAST('手机号格式不正确!')
return
}
if(!this.form.newpassword){
this.TOAST('请输入新密码');
return
@@ -116,11 +96,15 @@ export default{
this.TOAST('两次密码输入不一致');
return
}
if (!this.verifycode) {
this.TOAST('请输入验证码');
return
}
this.LOADING()
let res = await this.HTTP_POST('learun/adms/usernologin/forgetpass', {
newpassword:this.MD5(this.form.newpassword),
// this.MD5()
phone:this.phone
phone:this.phone,
verifycode: this.verifycode
})
this.HIDE_LOADING()
if(!res)return


Načítá se…
Zrušit
Uložit