password-edit.vue
3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<template>
<div class="content">
<div class="user-info">
<el-form
ref="form"
label-width="100px"
:model="form"
class="form-wrapper"
:rules="rules"
>
<el-form-item label="旧密码:" required prop="oldPassword">
<el-input
v-model="form.oldPassword"
clearable
type="password"
show-password
/>
</el-form-item>
<el-form-item label="新密码:" required prop="newPassword">
<el-input
v-model="form.newPassword"
clearable
type="password"
show-password
/>
</el-form-item>
<el-form-item label="确认密码:" required prop="confirmPassword">
<el-input
v-model="form.confirmPassword"
clearable
type="password"
show-password
/>
</el-form-item>
</el-form>
<div class="bottom-wrapper">
<el-button type="primary" @click="updatePassword">确认修改</el-button>
</div>
</div>
</div>
</template>
<script>
// import { updateUserPassword } from '@api/organizationManage'
export default {
props: {
// userInfo: {
// type: Object,
// default: null
// }
},
data() {
return {
form: {},
sexList: [],
userId: '',
rules: {
oldPassword: [
{ required: true, message: '旧密码不能为空', trigger: 'blur' }
],
newPassword: [
{ required: true, message: '新密码不能为空', trigger: 'blur' }
],
confirmPassword: [
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
{ validator: this.validatorConfirmPassword, trigger: 'blur' }
]
}
}
},
computed: {},
watch: {
// userInfo: {
// handler: function(val) {
// if (val) {
// this.userId = val.id
// }
// }
// }
},
mounted() {},
// methods: {
// validatorConfirmPassword(rule, value, callback) {
// const { newPassword } = this.form
// if (value !== newPassword) {
// callback('两次输入密码不一致')
// } else {
// callback()
// }
// },
// updatePassword() {
// this.$refs.form.validate((valid) => {
// if (valid) {
// const params = Object.assign({}, this.form, { id: this.userId })
// updateUserPassword(params).then((res) => {
// if (res.status === 1) {
// this.$message.success({ message: res.message, showClose: true })
// } else {
// this.$message.error({ message: res.message, showClose: true })
// }
// })
// }
// })
// }
// }
}
</script>
<style scoped lang="scss">
.user-info {
margin: 36px 200px;
background: #ffffff;
max-height: 90%;
overflow-y: auto;
.form-wrapper {
padding: 24px 120px 0px;
.el-form-item {
margin-bottom: 24px;
.el-form-item__label {
color: #747e8c;
}
::v-deep .el-input .el-input__inner {
padding: 0 8px;
height: 40px;
line-height: 40px;
border: 1px solid #dfe7f3;
}
}
}
.bottom-wrapper {
padding: 32px 120px 24px;
text-align: right;
}
}
</style>