Browse Source

feat(market): 修改密码功能升级

- 添加验证旧密码功能- 新增上一步按钮,优化用户体验
- 完善新密码设置流程,增加密码长度和一致性校验
- 实现密码修改后的成功提示和自动跳转到个人中心
- 优化页面样式,调整按钮布局
master
liutong 10 months ago
parent
commit
c1f59759f7
  1. 16
      api/apiRoute.js
  2. 165
      pages/market/my/update_pass.vue

16
api/apiRoute.js

@ -52,6 +52,22 @@ export default {
return res; return res;
}) })
}, },
//公共端-教师/销售端验证旧密码是否正确
common_personnelCheckOldPwd(data = {}) {
let url = '/personnel/checkOldPwd'
return http.post(url, data).then(res => {
return res;
})
},
//公共端-教师/销售端验证旧密码是否正确
common_personnelEdidPassword(data = {}) {
let url = '/personnel/edidPassword'
return http.post(url, data).then(res => {
return res;
})
},

165
pages/market/my/update_pass.vue

@ -2,7 +2,7 @@
<template> <template>
<view> <view>
<view class="title"> <view class="title">
<view :class="{'green-text': tset_style === 1}">1.验证手机号</view> <view :class="{'green-text': tset_style === 1}">1.验证旧密</view>
<view :class="{'green-text': tset_style === 2}">2.设置新密码</view> <view :class="{'green-text': tset_style === 2}">2.设置新密码</view>
</view> </view>
<view :style="{'background-color':'#fff','width':'100%','height':'100vh' }"> <view :style="{'background-color':'#fff','width':'100%','height':'100vh' }">
@ -12,24 +12,36 @@
为保障您的账号安全修改密码前请填写原密码 为保障您的账号安全修改密码前请填写原密码
</view> </view>
<view style="width: 95%;margin:30rpx auto;"> <view style="width: 95%;margin:30rpx auto;">
<fui-input borderTop placeholder="请输入原登录密码" v-model="user" @input="input" <fui-input borderTop placeholder="请输入原登录密码" v-model="old_password"
backgroundColor="#f2f2f2"></fui-input> backgroundColor="#f2f2f2"></fui-input>
</view> </view>
</view> </view>
<view v-if="tset_style == 2"> <view v-if="tset_style == 2">
<view style="width: 95%;margin:30rpx auto;"> <view style="width: 95%;margin:30rpx auto;">
<fui-input borderTop placeholder="请设置6-20位新的登录密码" v-model="user" @input="input" <fui-input borderTop placeholder="请设置6-20位新的登录密码" v-model="formData.new_password" @input="input"
backgroundColor="#f2f2f2"></fui-input> backgroundColor="#f2f2f2"></fui-input>
</view> </view>
<view style="width: 95%;margin: auto;"> <view style="width: 95%;margin: auto;">
<fui-input borderTop :padding="['20rpx','32rpx']" v-model="code" placeholder="请再次输入新的登录密码" @input="input" <fui-input borderTop :padding="['20rpx','32rpx']" v-model="formData.new_password_2" placeholder="请再次输入新的登录密码" @input="input"
backgroundColor="#f2f2f2"> backgroundColor="#f2f2f2">
</fui-input> </fui-input>
</view> </view>
</view> </view>
<view style="width: 95%;margin:60rpx auto;"> <view style="width: 95%;margin:60rpx auto;">
<fui-button background="#00be8c" radius="5rpx" @click="nextStep" v-if="tset_style == 1">下一步</fui-button> <view class="btn_box">
<fui-button background="#00be8c" radius="5rpx" @click="submit" v-if="tset_style == 2">提交</fui-button> <fui-button
background="#465cff"
radius="5rpx"
@click="nextStep(1)"
v-if="tset_style != 1">上一步
</fui-button>
<fui-button background="#00be8c" radius="5rpx" @click="nextStep(2)" v-if="tset_style == 1">下一步</fui-button>
<fui-button background="#00be8c" radius="5rpx" @click="submit" v-if="tset_style == 2">提交</fui-button>
</view>
<view style="width: 95%;margin:60rpx auto;"> <view style="width: 95%;margin:60rpx auto;">
<fui-button background="#fff" radius="5rpx" @click="forgot" color="#999999" v-if="tset_style == 1">忘记原密码</fui-button> <fui-button background="#fff" radius="5rpx" @click="forgot" color="#999999" v-if="tset_style == 1">忘记原密码</fui-button>
</view> </view>
@ -39,36 +51,139 @@
</template> </template>
<script> <script>
import apiRoute from '@/api/apiRoute.js';
export default { export default {
data() { data() {
return { return {
code: '', code: '',
user: '', user: '',
tset_style: 1, tset_style: 1,//tab|1=,2=
}
}, old_password:'',//
onLoad() {
formData:{
phone:'',//
new_password:'',//
new_password_2:'',//
key_value:'',//key_value
},
}
}, },
onLoad() {},
onShow() {
this.init()//
},
methods: { methods: {
sendCode() { //
// async init(){
setTimeout(() => { await this.getUserInfo()
// },
//... //
//success async getUserInfo() {
this.$refs.fui_cdv && this.$refs.fui_cdv.success() let res = await apiRoute.getPersonnelInfo({})
}, 800) if (res.code != 1) {
}, uni.showToast({
nextStep(){ title: res.msg,
this.tset_style = 2 icon: 'none'
})
return
}
this.formData.phone = res.data.phone//
},
///
async nextStep(tset_style){
//tset_style|1=,2=
if(tset_style == 2){
if(!this.old_password){
uni.showToast({
title: '请输入原登录密码',
icon: 'none'
})
return
}
//
let params = {
old_password: this.old_password
}
//
let res = await apiRoute.common_personnelCheckOldPwd(params)
if(!res.code){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.formData.key_value = res.data.key_value
}
this.tset_style = Number(tset_style)
}, },
//
forgot() { forgot() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/student/login/forgot' url: '/pages/student/login/forgot'
}) })
}, },
}
//
async submit() {
//
if (!this.formData.new_password) {
uni.showToast({
title: '请输入新密码',
icon: 'none'
})
return
}
if (this.formData.new_password.length < 6 || this.formData.new_password.length > 20) {
uni.showToast({
title: '新密码长度为6-20位',
icon: 'none'
})
return
}
if (!this.formData.new_password) {
uni.showToast({
title: '请输入新密码',
icon: 'none'
})
return
}
//
if (this.formData.new_password != this.formData.new_password_2) {
uni.showToast({
title: '两次密码不一致',
icon: 'none'
})
return
}
let res = await apiRoute.common_personnelEdidPassword(this.formData)
if(!res.code){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
uni.showToast({
title: res.msg,
icon: 'success'
})
//1s
setTimeout(() => {
//-
uni.navigateTo({
url: `/pages/market/my/index`
})
}, 1000)
},
}
} }
</script> </script>
@ -104,4 +219,10 @@
color: #999999; color: #999999;
padding-left: 30rpx; padding-left: 30rpx;
} }
.btn_box{
display: flex;
flex-direction: column;
gap: 40rpx;
}
</style> </style>
Loading…
Cancel
Save