project init
This commit is contained in:
107
pageMy/my/changePassword.vue
Normal file
107
pageMy/my/changePassword.vue
Normal file
@@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<view class="change-password-body">
|
||||
<view class="nothing" style="height: 200rpx;"></view>
|
||||
<jl-input type="text" v-model="oldPassword" placeholder="请输入旧密码" showPassword clearable></jl-input>
|
||||
<jl-input type="text" v-model="newPassword" placeholder="设置长度6至20位的密码" showPassword clearable></jl-input>
|
||||
<jl-input type="text" v-model="newPassword1" placeholder="请重新输入新密码" showPassword clearable></jl-input>
|
||||
<view class="btn" v-if='loading'>
|
||||
正在修改...
|
||||
</view>
|
||||
<view class="btn" v-else-if="validate" @click="submit">
|
||||
确认修改
|
||||
</view>
|
||||
<view class="btn nocheck" v-else>
|
||||
确认修改
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
changePassword
|
||||
} from '@/api/changePassword.js'
|
||||
import {
|
||||
password
|
||||
} from '@/untils/validate.js'
|
||||
import jlInput from '@/components/jl-input/main.vue'
|
||||
import md5 from 'js-md5'
|
||||
|
||||
const resendTime = 120
|
||||
export default {
|
||||
components: {
|
||||
jlInput
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
oldPassword: '',
|
||||
newPassword: '',
|
||||
newPassword1: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
if(password(this.newPassword)) {
|
||||
uni.showToast({
|
||||
title: '请设置长度6至20位的密码',
|
||||
icon: 'none'
|
||||
});
|
||||
return
|
||||
}
|
||||
if (this.newPassword1 !== this.newPassword) {
|
||||
uni.showToast({
|
||||
title: '两次输入的新密码不一致',
|
||||
icon: 'none'
|
||||
});
|
||||
return
|
||||
}
|
||||
this.loading = true
|
||||
changePassword(md5(this.oldPassword), md5(this.newPassword), md5(this.newPassword1)).then(() => {
|
||||
uni.navigateBack();
|
||||
uni.showToast({
|
||||
title: '操作成功',
|
||||
icon: 'none'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
validate() {
|
||||
return this.newPassword && this.oldPassword && this.newPassword1
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.phoneDel {
|
||||
margin-left: auto !important;
|
||||
}
|
||||
|
||||
.nocheck {
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin: 0 auto;
|
||||
margin-top: 50rpx;
|
||||
background-color: #1B66FF;
|
||||
color: #fefefe;
|
||||
border-radius: 10rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
|
||||
page {
|
||||
background-color: #fefefe;
|
||||
}
|
||||
|
||||
.change-password-body{
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user