st-comp 0.0.149 → 0.0.151
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/es/ChartLayout.cjs +1 -1
- package/es/ChartLayout.js +5 -4
- package/es/Dialog.cjs +1 -1
- package/es/Dialog.js +24 -22
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +52 -50
- package/es/Kline.cjs +1 -1
- package/es/Kline.js +18 -16
- package/es/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +26 -24
- package/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +16 -14
- package/es/Pagination.cjs +1 -1
- package/es/Pagination.js +58 -56
- package/es/PasswordPrompt.cjs +1 -0
- package/es/PasswordPrompt.js +13 -0
- package/es/Table.cjs +1 -1
- package/es/Table.js +105 -103
- package/es/User.cjs +1 -1
- package/es/User.js +401 -385
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +230 -228
- package/es/VirtualTable.cjs +3 -3
- package/es/VirtualTable.js +196 -194
- package/es/_initCloneObject-47814efa.cjs +1 -0
- package/es/{_initCloneObject-14b53c6f.js → _initCloneObject-e3d8a9ab.js} +21 -21
- package/es/base-0ca7c43a.cjs +5 -0
- package/es/base-19787dfb.js +303 -0
- package/es/{castArray-4251bbe4.js → castArray-8405000b.js} +1 -1
- package/es/castArray-a78ae889.cjs +1 -0
- package/es/{config-provider-55482a43.js → config-provider-0f6672af.js} +3 -3
- package/es/{config-provider-7cdfca4d.cjs → config-provider-cfbb9cd8.cjs} +1 -1
- package/es/{debounce-ac30be50.js → debounce-6cb0781f.js} +19 -19
- package/es/debounce-cf26af24.cjs +1 -0
- package/es/{dropdown-634b5e27.js → dropdown-17b3ef6a.js} +4 -4
- package/es/{dropdown-d7c59a21.cjs → dropdown-790d31ea.cjs} +1 -1
- package/es/{el-button-e1665717.js → el-button-0bf1d532.js} +17 -16
- package/es/el-button-62966947.cjs +1 -0
- package/es/{el-checkbox-group-492b95cc.cjs → el-checkbox-group-45247bbf.cjs} +1 -1
- package/es/{el-checkbox-group-e8fece80.js → el-checkbox-group-d53bc316.js} +5 -5
- package/es/el-empty-2ece1134.cjs +1 -0
- package/es/{el-empty-bacc6613.js → el-empty-bd5343a7.js} +10 -9
- package/es/{el-form-item-af1855f0.js → el-form-item-05c0e335.js} +52 -51
- package/es/el-form-item-47e255d4.cjs +12 -0
- package/es/{el-input-4961b99f.js → el-input-1e309239.js} +79 -78
- package/es/el-input-6a3805c5.cjs +1 -0
- package/es/{el-input-number-610fc8ba.js → el-input-number-60ebc58f.js} +57 -55
- package/es/el-input-number-96ff2e47.cjs +1 -0
- package/es/el-menu-item-4c9eb7ad.cjs +1 -0
- package/es/{el-menu-item-7d04c11a.js → el-menu-item-6c6236a1.js} +84 -83
- package/es/{el-message-c3b3ac96.js → el-message-7d927756.js} +55 -54
- package/es/el-message-d5ed7a4f.cjs +1 -0
- package/es/{el-overlay-12dd9b35.js → el-overlay-26bf0945.js} +73 -71
- package/es/el-overlay-41994f67.cjs +1 -0
- package/es/{el-popover-0aa071f2.js → el-popover-17e2e66c.js} +26 -24
- package/es/el-popover-7bd8a7c3.cjs +1 -0
- package/es/el-popper-7adbf1c6.cjs +1 -0
- package/es/{el-popper-50100766.js → el-popper-b6527ae2.js} +194 -193
- package/es/{el-scrollbar-562d0595.js → el-scrollbar-29bcab5f.js} +28 -28
- package/es/{el-scrollbar-d1c3e7f7.cjs → el-scrollbar-ac525239.cjs} +1 -1
- package/es/el-select-31f8ac8a.cjs +1 -0
- package/es/{el-select-9381b156.js → el-select-7395562b.js} +42 -40
- package/es/{el-table-column-55bffba5.js → el-table-column-47d80736.js} +329 -327
- package/es/el-table-column-bdc46568.cjs +14 -0
- package/es/{el-tag-985d9aff.js → el-tag-7414e0c7.js} +78 -77
- package/es/el-tag-9732314f.cjs +1 -0
- package/es/{index-deb8de52.cjs → index-1d85ba4b.cjs} +1 -1
- package/es/{index-39ec9741.js → index-273822d1.js} +21 -20
- package/es/index-2d9c78d4.cjs +1 -0
- package/es/index-2f958e56.cjs +3 -0
- package/es/index-375e8de4.cjs +5 -0
- package/es/{index-0cb48e01.js → index-621b092b.js} +1 -1
- package/es/{index-3bf8d597.cjs → index-65b4113e.cjs} +1 -1
- package/es/index-70372cdb.js +519 -0
- package/es/{use-form-common-props-f377e500.js → index-72151b24.js} +150 -312
- package/es/index-75cce588.js +157 -0
- package/es/index-9e6e8d03.cjs +1 -0
- package/es/index-afc88a4b.cjs +1 -0
- package/es/{index-09e01b1d.js → index-c066fe0d.js} +32 -31
- package/es/{index-a902a0d9.js → index-dc22ffe4.js} +2 -2
- package/es/{raf-b128c7b7.js → raf-a532c514.js} +1 -1
- package/es/{raf-8fc301fd.cjs → raf-f46caea0.cjs} +1 -1
- package/es/{scroll-41224831.cjs → scroll-339681d4.cjs} +1 -1
- package/es/{scroll-387fcfdb.js → scroll-d787d648.js} +1 -1
- package/es/style.css +1 -1
- package/es/use-form-common-props-5ff2f51b.js +171 -0
- package/es/use-form-common-props-74a96df2.cjs +2 -0
- package/es/{vnode-7dfd4ed5.js → vnode-6a0c7411.js} +1 -1
- package/es/{vnode-7fbc61e1.cjs → vnode-b15eb11b.cjs} +1 -1
- package/es/{zh-cn-ab9a583d.cjs → zh-cn-36f34912.cjs} +1 -1
- package/es/{zh-cn-eb9c2820.js → zh-cn-f37255ae.js} +2 -2
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +136 -136
- package/lib/{index-d2de454d.js → index-9ea06c35.js} +14674 -14507
- package/lib/{python-22975586.js → python-93a0241d.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/PasswordPrompt/index.ts +8 -0
- package/packages/PasswordPrompt/index.vue +267 -0
- package/packages/User/index.vue +93 -62
- package/packages/index.ts +2 -0
- package/src/pages/PasswordPrompt/index.vue +12 -0
- package/src/router/routes.ts +5 -0
- package/es/_initCloneObject-441db749.cjs +0 -1
- package/es/base-437d17f3.js +0 -816
- package/es/base-ec05f348.cjs +0 -9
- package/es/castArray-a45823fe.cjs +0 -1
- package/es/debounce-b2ff12bd.cjs +0 -1
- package/es/el-button-196807af.cjs +0 -1
- package/es/el-empty-19ea04f4.cjs +0 -1
- package/es/el-form-item-5bdffd07.cjs +0 -12
- package/es/el-input-23e2bac3.cjs +0 -1
- package/es/el-input-number-40a81eb5.cjs +0 -1
- package/es/el-menu-item-78b858f2.cjs +0 -1
- package/es/el-message-d4df8136.cjs +0 -1
- package/es/el-overlay-bc0790a2.cjs +0 -1
- package/es/el-popover-8a77e015.cjs +0 -1
- package/es/el-popper-746070ba.cjs +0 -1
- package/es/el-select-b162dffc.cjs +0 -1
- package/es/el-table-column-6d761fce.cjs +0 -14
- package/es/el-tag-c51a6490.cjs +0 -1
- package/es/index-8a0b1c53.cjs +0 -3
- package/es/index-a387515d.cjs +0 -1
- package/es/use-form-common-props-1b84d8f4.cjs +0 -2
package/package.json
CHANGED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { CircleCheck } from "@element-plus/icons-vue";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
// 密码
|
|
7
|
+
value: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "",
|
|
10
|
+
},
|
|
11
|
+
// 是否聚焦密码框
|
|
12
|
+
isFocus: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false,
|
|
15
|
+
},
|
|
16
|
+
// 文案颜色
|
|
17
|
+
textColor: {
|
|
18
|
+
type: [String, null],
|
|
19
|
+
default: null,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// 密码统一校验
|
|
24
|
+
const pwdValidators = [
|
|
25
|
+
{
|
|
26
|
+
text: "不能包含空格",
|
|
27
|
+
validator: (val) => {
|
|
28
|
+
return !/\s/.test(val);
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
text: "长度为8-18个字符",
|
|
33
|
+
validator: (val) => {
|
|
34
|
+
return val.length >= 8 && val.length <= 18;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
text: "必须包含字母、数字、符号中至少2种",
|
|
39
|
+
validator: (val) => {
|
|
40
|
+
const hasLetter = /[a-zA-Z]/.test(val);
|
|
41
|
+
const hasNumber = /\d/.test(val);
|
|
42
|
+
const hasSymbol = /[^a-zA-Z0-9]/.test(val);
|
|
43
|
+
return [hasLetter, hasNumber, hasSymbol].filter(Boolean).length >= 2;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
text: "请勿输入连续、重复6位以上字母或数字, 0123456, 1111111",
|
|
48
|
+
validator: (val) => {
|
|
49
|
+
// 检查是否有6位以上的重复字符
|
|
50
|
+
const repeatingChars = /([a-zA-Z0-9])\1{6,}/;
|
|
51
|
+
if (repeatingChars.test(val)) return false;
|
|
52
|
+
|
|
53
|
+
// 检查是否有6位以上的连续数字
|
|
54
|
+
const consecutiveNumbers = /(?:0123456|1234567|2345678|3456789|9876543|8765432|7654321|6543210)/;
|
|
55
|
+
if (consecutiveNumbers.test(val)) return false;
|
|
56
|
+
|
|
57
|
+
// 检查是否有6位以上的连续字母
|
|
58
|
+
const lowerVal = val.toLowerCase();
|
|
59
|
+
const isConsecutiveLetters = (str) => {
|
|
60
|
+
if (!/^[a-z]+$/.test(str)) return false;
|
|
61
|
+
for (let i = 1; i < str.length; i++) {
|
|
62
|
+
if (str.charCodeAt(i) !== str.charCodeAt(i - 1) + 1) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
};
|
|
68
|
+
for (let i = 0; i <= lowerVal.length - 7; i++) {
|
|
69
|
+
const segment = lowerVal.substr(i, 7);
|
|
70
|
+
if (isConsecutiveLetters(segment)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
// 基础规则校验是否全部通过
|
|
80
|
+
const allSuccessValidator = computed(() => {
|
|
81
|
+
const result = pwdValidators.map((item) => item.validator(props.value));
|
|
82
|
+
return !result.includes(false);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// 密码强度等级(得分制)
|
|
86
|
+
const levelValue = computed(() => {
|
|
87
|
+
const password = props.value;
|
|
88
|
+
if (!password) return 0;
|
|
89
|
+
// 初始得分
|
|
90
|
+
let score = 0;
|
|
91
|
+
{
|
|
92
|
+
// 长度检查
|
|
93
|
+
if (password.length >= 8) score++;
|
|
94
|
+
if (password.length >= 12) score++;
|
|
95
|
+
// 包含数字
|
|
96
|
+
if (/\d/.test(password)) score++;
|
|
97
|
+
// 包含小写字母
|
|
98
|
+
if (/[a-z]/.test(password)) score++;
|
|
99
|
+
// 包含大写字母
|
|
100
|
+
if (/[A-Z]/.test(password)) score++;
|
|
101
|
+
// 包含特殊字符
|
|
102
|
+
if (/[^a-zA-Z0-9]/.test(password)) score++;
|
|
103
|
+
}
|
|
104
|
+
// 将分数映射到1-3的强度等级
|
|
105
|
+
if (score <= 2) return 1;
|
|
106
|
+
else if (score <= 4) return 2;
|
|
107
|
+
else return 3;
|
|
108
|
+
});
|
|
109
|
+
const levelClass = computed(() => {
|
|
110
|
+
switch (levelValue.value) {
|
|
111
|
+
case 1:
|
|
112
|
+
return "lv1";
|
|
113
|
+
case 2:
|
|
114
|
+
return "lv2";
|
|
115
|
+
case 3:
|
|
116
|
+
return "lv3";
|
|
117
|
+
default:
|
|
118
|
+
return "";
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
const levelText = computed(() => {
|
|
122
|
+
switch (levelValue.value) {
|
|
123
|
+
case 1:
|
|
124
|
+
return "弱";
|
|
125
|
+
case 2:
|
|
126
|
+
return "中";
|
|
127
|
+
case 3:
|
|
128
|
+
return "强";
|
|
129
|
+
default:
|
|
130
|
+
return "";
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
defineExpose({
|
|
135
|
+
pwdValidators,
|
|
136
|
+
levelValue,
|
|
137
|
+
// 提供给表单校验使用
|
|
138
|
+
ruleFormPassword: [
|
|
139
|
+
{ required: true, trigger: "blur", message: "密码不能为空" },
|
|
140
|
+
...pwdValidators.map((item) => {
|
|
141
|
+
return {
|
|
142
|
+
trigger: "blur",
|
|
143
|
+
validator: (rule, value, callback) => {
|
|
144
|
+
if (!item.validator(value)) callback(item.text);
|
|
145
|
+
else callback();
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}),
|
|
149
|
+
],
|
|
150
|
+
});
|
|
151
|
+
</script>
|
|
152
|
+
|
|
153
|
+
<template>
|
|
154
|
+
<div
|
|
155
|
+
class="password-prompt"
|
|
156
|
+
:style="{ color: textColor ?? 'var(--el-color-info)' }"
|
|
157
|
+
>
|
|
158
|
+
<transition name="slide-down">
|
|
159
|
+
<div
|
|
160
|
+
v-if="isFocus"
|
|
161
|
+
class="rule-box"
|
|
162
|
+
>
|
|
163
|
+
<div
|
|
164
|
+
class="rule-item"
|
|
165
|
+
v-for="(item, index) in pwdValidators"
|
|
166
|
+
:key="index"
|
|
167
|
+
>
|
|
168
|
+
<el-icon v-show="item.validator(value)">
|
|
169
|
+
<CircleCheck />
|
|
170
|
+
</el-icon>
|
|
171
|
+
<span>{{ item.text }}</span>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
</transition>
|
|
175
|
+
<div
|
|
176
|
+
v-if="!isFocus && allSuccessValidator"
|
|
177
|
+
class="level-box"
|
|
178
|
+
>
|
|
179
|
+
<div class="level-color">
|
|
180
|
+
<div
|
|
181
|
+
class="levelValue-block"
|
|
182
|
+
:class="[levelValue >= 1 ? levelClass : '']"
|
|
183
|
+
/>
|
|
184
|
+
<div
|
|
185
|
+
class="levelValue-block"
|
|
186
|
+
:class="[levelValue >= 2 ? levelClass : '']"
|
|
187
|
+
/>
|
|
188
|
+
<div
|
|
189
|
+
class="levelValue-block"
|
|
190
|
+
:class="[levelValue >= 3 ? levelClass : '']"
|
|
191
|
+
/>
|
|
192
|
+
</div>
|
|
193
|
+
<div class="level-text">密码强度: {{ levelText }}</div>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
</template>
|
|
197
|
+
|
|
198
|
+
<style scoped>
|
|
199
|
+
.password-prompt {
|
|
200
|
+
width: 100%;
|
|
201
|
+
position: relative;
|
|
202
|
+
.rule-box {
|
|
203
|
+
.rule-item {
|
|
204
|
+
position: relative;
|
|
205
|
+
.el-icon {
|
|
206
|
+
font-size: 16px;
|
|
207
|
+
color: green;
|
|
208
|
+
position: absolute;
|
|
209
|
+
left: 0;
|
|
210
|
+
top: 9px;
|
|
211
|
+
}
|
|
212
|
+
span {
|
|
213
|
+
font-size: 12px;
|
|
214
|
+
display: inline-block;
|
|
215
|
+
padding-left: 20px;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
.level-box {
|
|
220
|
+
position: absolute;
|
|
221
|
+
top: -7px;
|
|
222
|
+
width: 100%;
|
|
223
|
+
display: flex;
|
|
224
|
+
align-items: center;
|
|
225
|
+
justify-content: end;
|
|
226
|
+
gap: 10px;
|
|
227
|
+
.level-color {
|
|
228
|
+
display: flex;
|
|
229
|
+
gap: 4px;
|
|
230
|
+
.levelValue-block {
|
|
231
|
+
width: 30px;
|
|
232
|
+
height: 8px;
|
|
233
|
+
background-color: #ebeef5;
|
|
234
|
+
border-radius: 2px;
|
|
235
|
+
transition: all 0.3s;
|
|
236
|
+
}
|
|
237
|
+
.lv1 {
|
|
238
|
+
background-color: #f33434;
|
|
239
|
+
}
|
|
240
|
+
.lv2 {
|
|
241
|
+
background-color: #e6a23c;
|
|
242
|
+
}
|
|
243
|
+
.lv3 {
|
|
244
|
+
background-color: #67c23a;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
.level-text {
|
|
248
|
+
font-size: 12px;
|
|
249
|
+
color: #909399;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* 校验规则平滑过渡效果 */
|
|
254
|
+
.slide-down-enter-active,
|
|
255
|
+
.slide-down-leave-active {
|
|
256
|
+
transition: all 0.3s ease;
|
|
257
|
+
max-height: 200px;
|
|
258
|
+
overflow: hidden;
|
|
259
|
+
}
|
|
260
|
+
.slide-down-enter-from,
|
|
261
|
+
.slide-down-leave-to {
|
|
262
|
+
opacity: 0;
|
|
263
|
+
max-height: 0;
|
|
264
|
+
transform: translateY(0px);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
</style>
|
package/packages/User/index.vue
CHANGED
|
@@ -23,36 +23,61 @@
|
|
|
23
23
|
前往登录
|
|
24
24
|
<el-icon class="user-login-icon"><Right /></el-icon>
|
|
25
25
|
</div>
|
|
26
|
+
|
|
27
|
+
<!-- 修改密码弹窗 -->
|
|
26
28
|
<el-dialog
|
|
27
29
|
v-model="changePasswordVisible"
|
|
28
30
|
title="修改密码"
|
|
29
31
|
width="500"
|
|
30
32
|
:z-index="200"
|
|
33
|
+
@opened="changePasswordDialogOpen"
|
|
31
34
|
@closed="changePasswordDialogClose"
|
|
32
35
|
>
|
|
33
36
|
<el-form
|
|
34
37
|
ref="changePasswordFormRef"
|
|
35
38
|
:model="changePasswordForm"
|
|
36
39
|
:rules="changePasswordRules"
|
|
40
|
+
:validate-on-rule-change="false"
|
|
37
41
|
@submit.native.prevent="changePasswordFn"
|
|
38
42
|
@keyup.enter.native="changePasswordFn"
|
|
39
43
|
label-width="auto"
|
|
40
44
|
>
|
|
41
|
-
<el-form-item
|
|
45
|
+
<el-form-item
|
|
46
|
+
label="原密码"
|
|
47
|
+
prop="oldPassword"
|
|
48
|
+
>
|
|
42
49
|
<el-input
|
|
43
50
|
v-model="changePasswordForm.oldPassword"
|
|
44
51
|
type="password"
|
|
45
52
|
:show-password="true"
|
|
46
53
|
/>
|
|
47
54
|
</el-form-item>
|
|
48
|
-
<el-form-item
|
|
55
|
+
<el-form-item
|
|
56
|
+
label="新密码"
|
|
57
|
+
prop="newPassword"
|
|
58
|
+
>
|
|
49
59
|
<el-input
|
|
50
60
|
v-model="changePasswordForm.newPassword"
|
|
51
61
|
type="password"
|
|
52
62
|
:show-password="true"
|
|
63
|
+
@focus="
|
|
64
|
+
() => {
|
|
65
|
+
changePasswordFormRef.clearValidate(['newPassword']);
|
|
66
|
+
isFocusNewPassword = true;
|
|
67
|
+
}
|
|
68
|
+
"
|
|
69
|
+
@blur="isFocusNewPassword = false"
|
|
70
|
+
/>
|
|
71
|
+
<PasswordPrompt
|
|
72
|
+
ref="PasswordPromptRef"
|
|
73
|
+
:value="changePasswordForm.newPassword"
|
|
74
|
+
:isFocus="isFocusNewPassword"
|
|
53
75
|
/>
|
|
54
76
|
</el-form-item>
|
|
55
|
-
<el-form-item
|
|
77
|
+
<el-form-item
|
|
78
|
+
label="确认密码"
|
|
79
|
+
prop="confirmPassword"
|
|
80
|
+
>
|
|
56
81
|
<el-input
|
|
57
82
|
v-model="changePasswordForm.confirmPassword"
|
|
58
83
|
type="password"
|
|
@@ -63,7 +88,10 @@
|
|
|
63
88
|
<template #footer>
|
|
64
89
|
<div class="dialog-footer">
|
|
65
90
|
<el-button @click="changePasswordVisible = false">取消</el-button>
|
|
66
|
-
<el-button
|
|
91
|
+
<el-button
|
|
92
|
+
type="primary"
|
|
93
|
+
@click="changePasswordFn"
|
|
94
|
+
>
|
|
67
95
|
修改
|
|
68
96
|
</el-button>
|
|
69
97
|
</div>
|
|
@@ -73,86 +101,89 @@
|
|
|
73
101
|
</template>
|
|
74
102
|
|
|
75
103
|
<script setup>
|
|
76
|
-
import { ref, inject } from
|
|
77
|
-
import { UserFilled, ArrowDown, Right } from "@element-plus/icons-vue"
|
|
78
|
-
import { getUserData, login, loginout } from
|
|
104
|
+
import { ref, inject, nextTick } from "vue";
|
|
105
|
+
import { UserFilled, ArrowDown, Right } from "@element-plus/icons-vue";
|
|
106
|
+
import { getUserData, login, loginout } from "st-func";
|
|
107
|
+
import PasswordPrompt from "../PasswordPrompt/index.vue";
|
|
79
108
|
|
|
80
109
|
const stConfig = inject("stConfig");
|
|
81
|
-
const userData = getUserData()
|
|
110
|
+
const userData = getUserData();
|
|
111
|
+
const PasswordPromptRef = ref(null); // 密码校验强度组件
|
|
82
112
|
|
|
83
|
-
const emit = defineEmits([
|
|
113
|
+
const emit = defineEmits(["loginout"]);
|
|
84
114
|
const props = defineProps({
|
|
85
115
|
config: {
|
|
86
116
|
type: Object,
|
|
87
|
-
default: () => ({
|
|
117
|
+
default: () => ({}), // loginUrl: 登录后的跳转地址 loginoutToLogin: 是否跳转到登录页 loginoutUrl: 退出登录后的跳转地址
|
|
88
118
|
},
|
|
89
|
-
})
|
|
119
|
+
});
|
|
90
120
|
|
|
91
|
-
const changePasswordFormRef = ref(null)
|
|
92
|
-
const changePasswordVisible = ref(false)
|
|
121
|
+
const changePasswordFormRef = ref(null);
|
|
122
|
+
const changePasswordVisible = ref(false);
|
|
93
123
|
const changePasswordForm = ref({
|
|
94
|
-
oldPassword:
|
|
95
|
-
newPassword:
|
|
96
|
-
confirmPassword:
|
|
97
|
-
})
|
|
98
|
-
const checkPassword = (rule, value, callback) => {
|
|
99
|
-
if (value === '') {
|
|
100
|
-
callback(new Error('请输入确认密码'))
|
|
101
|
-
} else if (value !== changePasswordForm.value.newPassword) {
|
|
102
|
-
callback(new Error("两次输入密码不一致!"))
|
|
103
|
-
} else {
|
|
104
|
-
callback()
|
|
105
|
-
}
|
|
106
|
-
}
|
|
124
|
+
oldPassword: "",
|
|
125
|
+
newPassword: "",
|
|
126
|
+
confirmPassword: "",
|
|
127
|
+
});
|
|
107
128
|
const changePasswordRules = ref({
|
|
108
|
-
oldPassword: [
|
|
109
|
-
|
|
110
|
-
{ min: 6, max: 18, trigger: "blur", message: "密码长度为6到18位" },
|
|
111
|
-
],
|
|
112
|
-
newPassword: [
|
|
113
|
-
{ required: true, message: '请输入新密码', trigger: 'blur' },
|
|
114
|
-
{ min: 6, max: 18, trigger: "blur", message: "密码长度为6到18位" },
|
|
115
|
-
],
|
|
129
|
+
oldPassword: [{ required: true, message: "请输入原密码", trigger: "blur" }],
|
|
130
|
+
newPassword: [],
|
|
116
131
|
confirmPassword: [
|
|
117
|
-
{ required: true, message:
|
|
118
|
-
{
|
|
119
|
-
|
|
132
|
+
{ required: true, message: "请输入确认密码", trigger: "blur" },
|
|
133
|
+
{
|
|
134
|
+
validator: (rule, value, callback) => {
|
|
135
|
+
if (value === "") {
|
|
136
|
+
callback(new Error("请输入确认密码"));
|
|
137
|
+
} else if (value !== changePasswordForm.value.newPassword) {
|
|
138
|
+
callback(new Error("两次输入密码不一致!"));
|
|
139
|
+
} else {
|
|
140
|
+
callback();
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
trigger: "blur",
|
|
144
|
+
},
|
|
120
145
|
],
|
|
121
|
-
})
|
|
146
|
+
});
|
|
147
|
+
const isFocusNewPassword = ref(false); // 是否聚焦新密码
|
|
122
148
|
|
|
123
149
|
const loginFn = () => {
|
|
124
|
-
const { loginUrl } = props.config || {}
|
|
125
|
-
login(loginUrl)
|
|
126
|
-
}
|
|
127
|
-
|
|
150
|
+
const { loginUrl } = props.config || {};
|
|
151
|
+
login(loginUrl);
|
|
152
|
+
};
|
|
128
153
|
const loginoutFn = () => {
|
|
129
|
-
const { loginoutToLogin, loginoutUrl } = props.config || {}
|
|
130
|
-
loginout(loginoutToLogin, loginoutUrl)
|
|
131
|
-
emit(
|
|
132
|
-
}
|
|
133
|
-
|
|
154
|
+
const { loginoutToLogin, loginoutUrl } = props.config || {};
|
|
155
|
+
loginout(loginoutToLogin, loginoutUrl);
|
|
156
|
+
emit("loginout");
|
|
157
|
+
};
|
|
134
158
|
const changePasswordFn = () => {
|
|
135
|
-
changePasswordFormRef.value.validate(async(valid, fields) => {
|
|
159
|
+
changePasswordFormRef.value.validate(async (valid, fields) => {
|
|
136
160
|
if (valid) {
|
|
137
|
-
const res = await stConfig.request.post(
|
|
161
|
+
const res = await stConfig.request.post("/invest/sys/user/password", {
|
|
138
162
|
password: changePasswordForm.value.oldPassword,
|
|
139
163
|
newPassword: changePasswordForm.value.newPassword,
|
|
140
164
|
newPassword2: changePasswordForm.value.confirmPassword,
|
|
141
|
-
})
|
|
142
|
-
ElMessage.success(`修改成功!`)
|
|
143
|
-
changePasswordVisible.value = false
|
|
144
|
-
} else {
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
165
|
+
});
|
|
166
|
+
ElMessage.success(`修改成功!`);
|
|
167
|
+
changePasswordVisible.value = false;
|
|
168
|
+
} else {
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
const changePasswordDialogOpen = () => {
|
|
173
|
+
if (changePasswordRules.value.newPassword.length === 0) {
|
|
174
|
+
nextTick(() => {
|
|
175
|
+
changePasswordRules.value.newPassword = PasswordPromptRef.value?.ruleFormPassword;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
148
179
|
const changePasswordDialogClose = () => {
|
|
149
180
|
changePasswordForm.value = {
|
|
150
|
-
oldPassword:
|
|
151
|
-
newPassword:
|
|
152
|
-
confirmPassword:
|
|
153
|
-
}
|
|
154
|
-
changePasswordFormRef.value.resetFields()
|
|
155
|
-
}
|
|
181
|
+
oldPassword: "",
|
|
182
|
+
newPassword: "",
|
|
183
|
+
confirmPassword: "",
|
|
184
|
+
};
|
|
185
|
+
changePasswordFormRef.value.resetFields();
|
|
186
|
+
};
|
|
156
187
|
</script>
|
|
157
188
|
|
|
158
189
|
<style lang="scss" scoped>
|
package/packages/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import StLinearLegend from "./LinearLegend/index.ts"
|
|
|
11
11
|
import StMap from "./Map/index.ts"
|
|
12
12
|
import StMonacoEditor from "./MonacoEditor/index.ts"
|
|
13
13
|
import StPagination from "./Pagination/index.ts"
|
|
14
|
+
import StPasswordPrompt from "./PasswordPrompt/index.ts"
|
|
14
15
|
import StPie from "./Pie/index.ts"
|
|
15
16
|
import StTable from "./Table/index.ts"
|
|
16
17
|
import StTreeMap from "./TreeMap/index.ts"
|
|
@@ -32,6 +33,7 @@ export default {
|
|
|
32
33
|
StMap.install(app)
|
|
33
34
|
StMonacoEditor.install(app)
|
|
34
35
|
StPagination.install(app)
|
|
36
|
+
StPasswordPrompt.install(app)
|
|
35
37
|
StPie.install(app)
|
|
36
38
|
StTable.install(app)
|
|
37
39
|
StTreeMap.install(app)
|
package/src/router/routes.ts
CHANGED
|
@@ -59,6 +59,11 @@ export default [
|
|
|
59
59
|
name: 'Pagination',
|
|
60
60
|
component: () => import('../pages/Pagination/index.vue'),
|
|
61
61
|
},
|
|
62
|
+
{
|
|
63
|
+
path: '/passwordPrompt',
|
|
64
|
+
name: 'PasswordPrompt',
|
|
65
|
+
component: () => import('../pages/PasswordPrompt/index.vue'),
|
|
66
|
+
},
|
|
62
67
|
{
|
|
63
68
|
path: '/pie',
|
|
64
69
|
name: 'Pie',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("./use-form-common-props-1b84d8f4.cjs"),o=require("./el-popper-746070ba.cjs"),s=require("./base-ec05f348.cjs");var a=Object.create,P=function(){function e(){}return function(n){if(!s.isObject$1(n))return{};if(a)return a(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}}();const w=P;function A(e,n){var r=-1,t=e.length;for(n||(n=Array(t));++r<t;)n[r]=e[r];return n}function b(e,n,r,t){var d=!r;r||(r={});for(var f=-1,h=n.length;++f<h;){var i=n[f],u=t?t(r[i],e[i],i,r,e):void 0;u===void 0&&(u=e[i]),d?c.baseAssignValue(r,i,u):c.assignValue(r,i,u)}return r}function C(e){var n=[];if(e!=null)for(var r in Object(e))n.push(r);return n}var x=Object.prototype,B=x.hasOwnProperty;function I(e){if(!s.isObject$1(e))return C(e);var n=o.isPrototype(e),r=[];for(var t in e)t=="constructor"&&(n||!B.call(e,t))||r.push(t);return r}function T(e){return o.isArrayLike(e)?o.arrayLikeKeys(e,!0):I(e)}var U=o.overArg(Object.getPrototypeOf,Object);const y=U;var g=typeof exports=="object"&&exports&&!exports.nodeType&&exports,l=g&&typeof module=="object"&&module&&!module.nodeType&&module,$=l&&l.exports===g,p=$?s.root.Buffer:void 0,v=p?p.allocUnsafe:void 0;function m(e,n){if(n)return e.slice();var r=e.length,t=v?v(r):new e.constructor(r);return e.copy(t),t}function O(e){var n=new e.constructor(e.byteLength);return new o.Uint8Array(n).set(new o.Uint8Array(e)),n}function q(e,n){var r=n?O(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function K(e){return typeof e.constructor=="function"&&!o.isPrototype(e)?w(y(e)):{}}exports.cloneArrayBuffer=O;exports.cloneBuffer=m;exports.cloneTypedArray=q;exports.copyArray=A;exports.copyObject=b;exports.getPrototype=y;exports.initCloneObject=K;exports.keysIn=T;
|