n20-common-lib 1.3.212 → 1.3.213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-loading="laoding">
|
|
3
|
-
<el-form
|
|
3
|
+
<el-form
|
|
4
|
+
ref="cp-form"
|
|
5
|
+
:model="form"
|
|
6
|
+
:label-width="_lang == 'zh' ? '6em' : '11em'"
|
|
7
|
+
@submit.native.prevent
|
|
8
|
+
>
|
|
4
9
|
<el-form-item :label="'账号' | $lc">
|
|
5
10
|
<el-input :value="form.username" disabled />
|
|
6
11
|
</el-form-item>
|
|
@@ -9,27 +14,36 @@
|
|
|
9
14
|
prop="orginPassword"
|
|
10
15
|
:rules="[
|
|
11
16
|
{ required: true, message: $lc('请输入原始密码'), trigger: 'blur' },
|
|
12
|
-
{ validator: orginPasswordVd, trigger: 'blur' }
|
|
17
|
+
{ validator: orginPasswordVd, trigger: 'blur' },
|
|
13
18
|
]"
|
|
14
19
|
>
|
|
15
|
-
<el-input
|
|
20
|
+
<el-input
|
|
21
|
+
v-model="form.orginPassword"
|
|
22
|
+
type="password"
|
|
23
|
+
:placeholder="'请输入原始密码' | $lc"
|
|
24
|
+
/>
|
|
16
25
|
</el-form-item>
|
|
17
26
|
<el-form-item
|
|
18
27
|
:label="'新密码' | $lc"
|
|
19
28
|
prop="newPassword"
|
|
20
29
|
:rules="[
|
|
21
30
|
{ required: true, message: $lc('请输入新密码'), trigger: 'blur' },
|
|
22
|
-
{ validator: newPasswordVd, trigger: 'blur' }
|
|
31
|
+
{ validator: newPasswordVd, trigger: 'blur' },
|
|
23
32
|
]"
|
|
24
33
|
>
|
|
25
|
-
<el-input
|
|
34
|
+
<el-input
|
|
35
|
+
v-model="form.newPassword"
|
|
36
|
+
:placeholder="'请输入新密码' | $lc"
|
|
37
|
+
show-password
|
|
38
|
+
@change="newPwdChange"
|
|
39
|
+
/>
|
|
26
40
|
</el-form-item>
|
|
27
41
|
<el-form-item
|
|
28
42
|
:label="'确认密码' | $lc"
|
|
29
43
|
prop="validatePassword"
|
|
30
44
|
:rules="[
|
|
31
45
|
{ required: true, message: $lc('请确认新密码'), trigger: 'blur' },
|
|
32
|
-
{ validator: validatePasswordVd, trigger: 'blur' }
|
|
46
|
+
{ validator: validatePasswordVd, trigger: 'blur' },
|
|
33
47
|
]"
|
|
34
48
|
>
|
|
35
49
|
<el-input
|
|
@@ -42,22 +56,24 @@
|
|
|
42
56
|
</el-form>
|
|
43
57
|
|
|
44
58
|
<div class="dialog-footer">
|
|
45
|
-
<el-button type="primary" @click="confirmFn">{{
|
|
46
|
-
|
|
59
|
+
<el-button type="primary" @click="confirmFn">{{
|
|
60
|
+
"确认" | $lc
|
|
61
|
+
}}</el-button>
|
|
62
|
+
<el-button @click="closeFn">{{ "取消" | $lc }}</el-button>
|
|
47
63
|
</div>
|
|
48
64
|
</div>
|
|
49
65
|
</template>
|
|
50
66
|
|
|
51
67
|
<script>
|
|
52
|
-
import { $lc } from
|
|
53
|
-
import auth from
|
|
54
|
-
import axios from
|
|
68
|
+
import { $lc } from "../../../utils/i18n/index";
|
|
69
|
+
import auth from "../../../utils/auth";
|
|
70
|
+
import axios from "../../../utils/axios";
|
|
55
71
|
export default {
|
|
56
72
|
props: {
|
|
57
73
|
visible: {
|
|
58
74
|
type: Boolean,
|
|
59
|
-
default: false
|
|
60
|
-
}
|
|
75
|
+
default: false,
|
|
76
|
+
},
|
|
61
77
|
},
|
|
62
78
|
data() {
|
|
63
79
|
return {
|
|
@@ -66,137 +82,143 @@ export default {
|
|
|
66
82
|
pwdRE: undefined,
|
|
67
83
|
pwdReMsg: undefined,
|
|
68
84
|
form: {
|
|
69
|
-
username: sessionStorage.getItem(
|
|
70
|
-
orginPassword:
|
|
71
|
-
newPassword:
|
|
72
|
-
validatePassword:
|
|
85
|
+
username: sessionStorage.getItem("userNo"),
|
|
86
|
+
orginPassword: "",
|
|
87
|
+
newPassword: "",
|
|
88
|
+
validatePassword: "",
|
|
73
89
|
},
|
|
74
|
-
laoding: false
|
|
75
|
-
}
|
|
90
|
+
laoding: false,
|
|
91
|
+
};
|
|
76
92
|
},
|
|
77
93
|
watch: {
|
|
78
94
|
visible(v) {
|
|
79
95
|
if (!v) {
|
|
80
|
-
this.$refs[
|
|
96
|
+
this.$refs["cp-form"].resetFields();
|
|
81
97
|
}
|
|
82
|
-
}
|
|
98
|
+
},
|
|
83
99
|
},
|
|
84
100
|
created() {
|
|
85
|
-
this.getPwdRule()
|
|
101
|
+
this.getPwdRule();
|
|
86
102
|
},
|
|
87
103
|
methods: {
|
|
88
104
|
getPwdRule() {
|
|
89
|
-
axios
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
axios
|
|
106
|
+
.post("/bems/prod_1.0/user/api/userController/use")
|
|
107
|
+
.then(({ data }) => {
|
|
108
|
+
let { minLength, maxLength, passwordStrength } = data;
|
|
109
|
+
this.pwdMin = minLength;
|
|
110
|
+
this.pwdMax = maxLength;
|
|
111
|
+
switch (passwordStrength) {
|
|
112
|
+
case "0":
|
|
113
|
+
this.pwdRE = [/[A-z0-9]+/];
|
|
114
|
+
this.pwdReMsg = $lc(`密码只能为字母数字`);
|
|
115
|
+
break;
|
|
116
|
+
case "1":
|
|
117
|
+
this.pwdRE = [/[A-z]+/, /[0-9]+/];
|
|
118
|
+
this.pwdReMsg = $lc(`密码只能包含数字 + 字母`);
|
|
119
|
+
break;
|
|
120
|
+
case "2":
|
|
121
|
+
this.pwdRE = [/[A-Z]+/, /[a-z]+/, /[0-9]+/];
|
|
122
|
+
this.pwdReMsg = $lc(`密码只能包含数字 + 大写字母 + 小写字母`);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
108
126
|
},
|
|
109
127
|
|
|
110
128
|
orginPasswordVd(r, value, callback) {
|
|
111
129
|
axios
|
|
112
130
|
.post(
|
|
113
|
-
|
|
131
|
+
"/bems/prod_1.0/uas/api/authorization/password/validate",
|
|
114
132
|
{
|
|
115
133
|
// username: this.form.username,
|
|
116
|
-
password: value
|
|
134
|
+
password: value,
|
|
117
135
|
},
|
|
118
136
|
{ noMsg: true, loading: false }
|
|
119
137
|
)
|
|
120
138
|
.then(() => {
|
|
121
|
-
callback()
|
|
139
|
+
callback();
|
|
122
140
|
})
|
|
123
141
|
.catch(() => {
|
|
124
|
-
callback(new Error($lc(
|
|
125
|
-
})
|
|
142
|
+
callback(new Error($lc("原始密码与旧密码不一致")));
|
|
143
|
+
});
|
|
126
144
|
},
|
|
127
145
|
newPasswordVd(r, value, callback) {
|
|
128
|
-
let _re_1 = new RegExp(`^.{${this.pwdMin},${this.pwdMax}}$`)
|
|
146
|
+
let _re_1 = new RegExp(`^.{${this.pwdMin},${this.pwdMax}}$`);
|
|
129
147
|
if (!_re_1.test(value)) {
|
|
130
|
-
callback(
|
|
148
|
+
callback(
|
|
149
|
+
new Error(
|
|
150
|
+
`${$lc("密码长度范围:")}${this.pwdMin}-${this.pwdMax}${$lc("位")}`
|
|
151
|
+
)
|
|
152
|
+
);
|
|
131
153
|
}
|
|
132
154
|
|
|
133
155
|
if (this.pwdRE) {
|
|
134
156
|
this.pwdRE.some((re) => {
|
|
135
157
|
if (!re.test(value)) {
|
|
136
|
-
callback(new Error(this.pwdReMsg))
|
|
137
|
-
return true
|
|
158
|
+
callback(new Error(this.pwdReMsg));
|
|
159
|
+
return true;
|
|
138
160
|
}
|
|
139
|
-
})
|
|
161
|
+
});
|
|
140
162
|
}
|
|
141
|
-
callback()
|
|
163
|
+
callback();
|
|
142
164
|
},
|
|
143
165
|
validatePasswordVd(r, value, callback) {
|
|
144
166
|
if (value === this.form.newPassword) {
|
|
145
|
-
callback()
|
|
167
|
+
callback();
|
|
146
168
|
} else {
|
|
147
|
-
callback(new Error($lc(
|
|
169
|
+
callback(new Error($lc("两次输入密码不一致!")));
|
|
148
170
|
}
|
|
149
171
|
},
|
|
150
172
|
newPwdChange(val) {
|
|
151
173
|
if (!val) {
|
|
152
|
-
this.form.validatePassword =
|
|
153
|
-
this.$refs[
|
|
174
|
+
this.form.validatePassword = "";
|
|
175
|
+
this.$refs["cp-form"].clearValidate("validatePassword");
|
|
154
176
|
}
|
|
155
177
|
},
|
|
156
178
|
confirmFn() {
|
|
157
|
-
this.$refs[
|
|
179
|
+
this.$refs["cp-form"].validate((v) => {
|
|
158
180
|
if (v) {
|
|
159
181
|
if (this.form.newPassword === this.form.orginPassword) {
|
|
160
|
-
this.$message.error($lc(
|
|
161
|
-
this.form.newPassword =
|
|
162
|
-
this.form.validatePassword =
|
|
163
|
-
return
|
|
182
|
+
this.$message.error($lc("新密码不能与旧密码相同!"));
|
|
183
|
+
this.form.newPassword = "";
|
|
184
|
+
this.form.validatePassword = "";
|
|
185
|
+
return;
|
|
164
186
|
}
|
|
165
187
|
|
|
166
|
-
this.laoding = true
|
|
188
|
+
this.laoding = true;
|
|
167
189
|
axios
|
|
168
190
|
.post(
|
|
169
|
-
|
|
191
|
+
"/bems/prod_1.0/uas/api/authorization/password/update",
|
|
170
192
|
{
|
|
171
193
|
// username: this.form.username,
|
|
172
|
-
password:this.form.orginPassword
|
|
173
|
-
newPassword: this.form.newPassword
|
|
194
|
+
password: this.form.orginPassword,
|
|
195
|
+
newPassword: this.form.newPassword,
|
|
174
196
|
},
|
|
175
197
|
{
|
|
176
198
|
loading: () => {
|
|
177
|
-
this.laoding = false
|
|
178
|
-
}
|
|
199
|
+
this.laoding = false;
|
|
200
|
+
},
|
|
179
201
|
}
|
|
180
202
|
)
|
|
181
203
|
.then(() => {
|
|
182
|
-
this.confirmFnThen()
|
|
183
|
-
})
|
|
204
|
+
this.confirmFnThen();
|
|
205
|
+
});
|
|
184
206
|
}
|
|
185
|
-
})
|
|
207
|
+
});
|
|
186
208
|
},
|
|
187
209
|
confirmFnThen() {
|
|
188
210
|
this.$message({
|
|
189
|
-
message:
|
|
190
|
-
type:
|
|
191
|
-
})
|
|
192
|
-
axios.delete(
|
|
193
|
-
this.closeFn()
|
|
194
|
-
auth.removeToken()
|
|
195
|
-
})
|
|
211
|
+
message: "密码修改成功!",
|
|
212
|
+
type: "success",
|
|
213
|
+
});
|
|
214
|
+
axios.delete("/bems/prod_1.0/uas/api/authorization/logout").then(() => {
|
|
215
|
+
this.closeFn();
|
|
216
|
+
auth.removeToken();
|
|
217
|
+
});
|
|
196
218
|
},
|
|
197
219
|
closeFn() {
|
|
198
|
-
this.$emit(
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
220
|
+
this.$emit("update:visible", false);
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
};
|
|
202
224
|
</script>
|