You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.8 KiB

<template>
<view class="page">
<view class="input">
3 years ago
<uni-easyinput type="password" v-model.trim="form.password" placeholder="请输入旧密码"></uni-easyinput>
</view>
<view class="input">
3 years ago
<uni-easyinput type="password" v-model.trim="form.newPassword" placeholder="请输入新密码"></uni-easyinput>
</view>
<view class="input">
3 years ago
<uni-easyinput type="password" v-model.trim="form.reNewPassword" placeholder="请再次输入新密码"></uni-easyinput>
</view>
3 years ago
<button type="primary" @click="submit">确认</button>
</view>
</template>
<script>
3 years ago
import { examinePassword } from '@/apis/modules/user.js'
export default {
data() {
return {
3 years ago
form: {
password: '',
newPassword: '',
reNewPassword: ''
},
}
},
methods: {
3 years ago
submit() {
const { form } = this
const { password, newPassword, reNewPassword } = form
if(!password) return this.$util.errMsg('请输入旧密码')
if(!newPassword) return this.$util.errMsg('请输入新密码')
if(!reNewPassword) return this.$util.errMsg('请确认新密码')
if(newPassword.length < 6 || reNewPassword.length < 6) return this.$util.errMsg('请输入6位数以上的密码')
if(newPassword !== reNewPassword) return this.$util.errMsg('输入的新密码不一致,请重新确认')
if(password === newPassword) return this.$util.errMsg('旧密码跟新密码不能一致')
form.accountId = uni.getStorageSync('team').accountId
examinePassword(form).then(res => {
this.$util.sucMsg('修改成功!')
setTimeout(() => {
uni.navigateBack()
}, 1000)
}).catch(e => {})
}
}
}
</script>
<style scoped lang="scss">
.page {
padding: 20px;
background-color: #fff;
}
3 years ago
/deep/.input {
margin-bottom: 15px;
3 years ago
.is-input-border {
border-color: #dedede !important;
}
}
</style>