st-comp 0.0.198 → 0.0.200
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/auto-imports.d.ts +3 -0
- package/components.d.ts +0 -3
- package/es/ChartLayout.js +4 -4
- package/es/ConfigProvider.cjs +1 -1
- package/es/ConfigProvider.js +1 -1
- package/es/CustomFunction.cjs +1 -1
- package/es/CustomFunction.js +281 -217
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +68 -71
- package/es/Kline.cjs +1 -1
- package/es/Kline.js +19 -21
- package/es/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +28 -30
- package/es/KlineConfig.cjs +1 -1
- package/es/KlineConfig.js +23 -25
- package/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +18 -20
- package/es/KlinePlus.cjs +1 -1
- package/es/KlinePlus.js +21 -23
- package/es/MonacoEditor.cjs +1 -1
- package/es/MonacoEditor.js +2 -2
- package/es/Pagination.cjs +1 -1
- package/es/Pagination.js +72 -74
- package/es/PasswordPrompt.cjs +1 -1
- package/es/PasswordPrompt.js +157 -9
- package/es/Pie.cjs +1 -1
- package/es/Pie.js +1 -1
- package/es/Table.cjs +1 -1
- package/es/Table.js +50 -53
- package/es/User.cjs +1 -1
- package/es/User.js +1 -1215
- package/es/VarSelectDialog.cjs +1 -1
- package/es/VarSelectDialog.js +26 -28
- package/es/VarietyAutoComplete.cjs +1 -1
- package/es/VarietyAutoComplete.js +18 -19
- package/es/VarietySearch.cjs +7 -7
- package/es/VarietySearch.js +693 -697
- package/es/VarietyTextCopy.cjs +1 -1
- package/es/VarietyTextCopy.js +12 -12
- package/es/VirtualTable.cjs +1 -1
- package/es/VirtualTable.js +79 -80
- package/es/{base-a5af3db3.js → base-8348063b.js} +38 -38
- package/es/{castArray-7741a212.js → castArray-3f45c3ec.js} +1 -1
- package/es/{config-provider-b16efd62.js → config-provider-1a687690.js} +6 -6
- package/es/{config-provider-a584d81e.cjs → config-provider-eb0460f1.cjs} +1 -1
- package/es/el-autocomplete-86c0d989.cjs +1 -0
- package/es/{el-autocomplete-ba808eb6.js → el-autocomplete-d4cd96cd.js} +16 -16
- package/es/{el-button-c95adb85.js → el-button-2e680390.js} +33 -33
- package/es/{el-button-eec58cff.cjs → el-button-4ccd7122.cjs} +1 -1
- package/es/el-checkbox-group-dfdad075.cjs +1 -0
- package/es/el-checkbox-group-e26a4533.js +67 -0
- package/es/{el-dialog-ae86edb8.cjs → el-dialog-6413b4af.cjs} +1 -1
- package/es/{el-dialog-41ab8417.js → el-dialog-bafc4b2b.js} +6 -7
- package/es/{el-divider-4e059794.js → el-divider-93b0ee21.js} +1 -1
- package/es/{el-empty-33cb66f1.js → el-empty-56783dca.js} +3 -3
- package/es/el-form-item-41becb31.js +1749 -0
- package/es/el-form-item-95476197.cjs +12 -0
- package/es/{el-input-7fd293af.cjs → el-input-6c5ac889.cjs} +1 -1
- package/es/{el-input-2f75c4ba.js → el-input-735575f4.js} +34 -34
- package/es/{el-input-number-5193fe6d.js → el-input-number-6634a6ea.js} +35 -35
- package/es/{el-input-number-22e21d16.cjs → el-input-number-d5770776.cjs} +1 -1
- package/es/{el-loading-f6022062.js → el-loading-049dacc5.js} +5 -5
- package/es/{el-loading-cfd86c15.cjs → el-loading-98dcebee.cjs} +1 -1
- package/es/{el-menu-item-17dc717e.cjs → el-menu-item-828bc6fa.cjs} +1 -1
- package/es/{el-menu-item-7e881203.js → el-menu-item-8a210e21.js} +22 -22
- package/es/{el-message-5e6a6be9.cjs → el-message-a1ac37d4.cjs} +1 -1
- package/es/{el-message-e544a8f5.js → el-message-def216ae.js} +24 -24
- package/es/{el-overlay-09ad71cd.js → el-overlay-4ea38eab.js} +51 -51
- package/es/{el-overlay-9e34965f.cjs → el-overlay-69dfacb6.cjs} +1 -1
- package/es/{el-popconfirm-81dcd202.js → el-popconfirm-aace1104.js} +20 -20
- package/es/{el-popconfirm-70a976bf.cjs → el-popconfirm-bdeceeb7.cjs} +1 -1
- package/es/{_initCloneObject-52b6a510.cjs → el-popover-5421d52a.cjs} +1 -1
- package/es/{_initCloneObject-eaef9418.js → el-popover-7a1c6412.js} +9 -9
- package/es/{el-popper-b4f97157.js → el-popper-986a8371.js} +112 -115
- package/es/{el-popper-b6c99b28.cjs → el-popper-b962125f.cjs} +1 -1
- package/es/el-scrollbar-139aa96d.cjs +1 -0
- package/es/el-scrollbar-cdadd788.js +115 -0
- package/es/{el-segmented-f8fce9ac.cjs → el-segmented-6b057ed5.cjs} +1 -1
- package/es/{el-segmented-b868d074.js → el-segmented-f892ec18.js} +8 -8
- package/es/{el-select-95627997.js → el-select-2189a8ac.js} +41 -42
- package/es/el-select-e1046cc6.cjs +1 -0
- package/es/{el-table-column-72c50d58.js → el-table-column-91d69c86.js} +14 -14
- package/es/el-table-column-f1c4af89.cjs +14 -0
- package/es/{el-tag-66cab138.js → el-tag-75a7573a.js} +16 -16
- package/es/{el-tag-a33c4b22.cjs → el-tag-a15520b3.cjs} +1 -1
- package/es/{index-d77a7336.js → index-14c88a1a.js} +1 -1
- package/es/{index-11547a0c.cjs → index-16802b35.cjs} +1 -1
- package/es/{index-098c2447.cjs → index-1fb95601.cjs} +1 -1
- package/es/index-56ea97a9.js +122 -0
- package/es/{index-c108567d.cjs → index-5e0314ac.cjs} +1 -1
- package/es/{index-298075cf.cjs → index-680be212.cjs} +1 -1
- package/es/{index-bc8e277e.js → index-780e7fd2.js} +2 -2
- package/es/{index-d725fef6.cjs → index-78381381.cjs} +2 -2
- package/es/{index-a871c3eb.js → index-847d58bc.js} +62 -92
- package/es/index-8583c047.cjs +1 -0
- package/es/{index-7ed0999e.js → index-9cfb6ccf.js} +0 -2
- package/es/{index-e5566b94.js → index-c94b9543.js} +43 -43
- package/es/{index-8901a38c.cjs → index-cc200b99.cjs} +1 -1
- package/es/index-ce63356a.cjs +1 -0
- package/es/index-db1e1861.js +318 -0
- package/es/{index-960806da.js → index-e00ee015.js} +36 -36
- package/es/{index-844bdd85.js → index-f3a86049.js} +29 -29
- package/es/{index-d91dc23f.js → index-f45c2897.js} +20 -20
- package/es/{python-c27ba105.cjs → python-2e916d28.cjs} +1 -1
- package/es/{python-ecde9ff2.js → python-7cf0b6ba.js} +2 -2
- package/es/{raf-80ef0c0a.js → raf-8e5f0699.js} +1 -1
- package/es/{scroll-679bd6bf.js → scroll-c43468ab.js} +1 -1
- package/es/style.css +1 -1
- package/es/{use-form-common-props-fd9b61a0.cjs → use-form-common-props-d8866dc6.cjs} +1 -1
- package/es/{use-form-common-props-815d48a6.js → use-form-common-props-e6cba60f.js} +69 -69
- package/es/{use-global-config-30d7d8ce.cjs → use-global-config-72d50e62.cjs} +1 -1
- package/es/{use-global-config-b5e9d3d5.js → use-global-config-76ff2e3e.js} +14 -14
- package/es/{validator-764a9db0.js → validator-220652c5.js} +1 -1
- package/es/{validator-1b8a6128.cjs → validator-e759d43d.cjs} +1 -1
- package/es/{zh-cn-90317f62.cjs → zh-cn-33e7aee6.cjs} +1 -1
- package/es/{zh-cn-e963c628.js → zh-cn-c7fa42ea.js} +2 -2
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +205 -205
- package/lib/{index-a75ac019.js → index-410c490f.js} +19955 -19794
- package/lib/{python-0eadb75b.js → python-589861d2.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/CustomFunction/index.vue +141 -30
- package/packages/User/components/EditInfoDialog/Mobile.vue +110 -0
- package/packages/User/components/EditInfoDialog/index.vue +136 -0
- package/packages/User/components/SetPasswordDialog.vue +6 -3
- package/packages/User/index.vue +7 -22
- package/es/debounce-62f5b6e8.cjs +0 -1
- package/es/debounce-8d53f4dd.js +0 -83
- package/es/dropdown-071c5d7e.cjs +0 -1
- package/es/dropdown-a59bba73.js +0 -178
- package/es/el-autocomplete-a07e9439.cjs +0 -1
- package/es/el-form-item-c3fe189b.cjs +0 -12
- package/es/el-form-item-eeb64520.js +0 -1269
- package/es/el-message-box-48d71ee5.cjs +0 -1
- package/es/el-message-box-81ffd21e.js +0 -550
- package/es/el-popover-0ea8fbf8.cjs +0 -1
- package/es/el-popover-4ed993c7.js +0 -1
- package/es/el-scrollbar-323542e7.js +0 -34
- package/es/el-scrollbar-bc3f790d.cjs +0 -1
- package/es/el-select-d8d91db1.cjs +0 -1
- package/es/el-table-column-079b76f5.cjs +0 -14
- package/es/index-1f7d4f70.js +0 -157
- package/es/index-57672682.js +0 -113
- package/es/index-88546436.js +0 -163
- package/es/index-9b9ef5dd.cjs +0 -1
- package/es/index-f3562b52.cjs +0 -1
- package/es/index-f967d6c1.cjs +0 -1
- package/es/vnode-5ddb7ed1.js +0 -14
- package/es/vnode-b906ae6d.cjs +0 -1
- package/packages/User/components/EditInfoDialog.vue +0 -132
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { ref, h, inject, onMounted, watch, reactive, nextTick } from "vue";
|
|
2
3
|
import { Close, Edit, DocumentCopy, Delete, Document } from "@element-plus/icons-vue";
|
|
3
|
-
import { ref, inject, onMounted, watch, reactive, nextTick } from "vue";
|
|
4
4
|
|
|
5
5
|
const { request } = inject("stConfig"); // 组件库全局配置
|
|
6
6
|
const stMonacoEditorRef = ref(null);
|
|
@@ -86,35 +86,6 @@ const handleAddOrEdit = (item, isCopy) => {
|
|
|
86
86
|
}
|
|
87
87
|
visible.value = true;
|
|
88
88
|
};
|
|
89
|
-
// 自定义函数: 测试
|
|
90
|
-
const handleTest = async () => {
|
|
91
|
-
try {
|
|
92
|
-
testLoading.value = true;
|
|
93
|
-
ruleForm.funcExpression = stMonacoEditorRef.value.getValue();
|
|
94
|
-
if (!ruleForm.funcExpression) return ElMessage.error("函数内容不可为空");
|
|
95
|
-
// 检测里面是否包含了变量的写法, 如果包含了则不支持测试功能
|
|
96
|
-
if (/\$\{[^}]*\}/.test(ruleForm.funcExpression)) return ElMessage.error("不支持包含变量用法的函数进行测试");
|
|
97
|
-
// 调用接口
|
|
98
|
-
const { body } = await request.post("/common/qt/testFactorSelect", { factorSelectExpr: ruleForm.funcExpression });
|
|
99
|
-
const { result, detail } = body;
|
|
100
|
-
Object.assign(testResult, { result, detail, code: ruleForm.funcExpression });
|
|
101
|
-
if (result === 1) {
|
|
102
|
-
ElMessage.success("测试通过");
|
|
103
|
-
} else {
|
|
104
|
-
ElMessage.error("测试未能通过");
|
|
105
|
-
testVisible.value = true;
|
|
106
|
-
}
|
|
107
|
-
} finally {
|
|
108
|
-
testLoading.value = false;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
// 自定义函数: 日志明细
|
|
112
|
-
const handleTestLog = () => {
|
|
113
|
-
if (testResult.result === null) {
|
|
114
|
-
return ElMessage.warning("请先进行测试, 等待测试完成后可查看日志");
|
|
115
|
-
}
|
|
116
|
-
testVisible.value = true;
|
|
117
|
-
};
|
|
118
89
|
// 自定义函数: 保存
|
|
119
90
|
const handleSubmit = async () => {
|
|
120
91
|
try {
|
|
@@ -139,6 +110,143 @@ const handleInsert = () => {
|
|
|
139
110
|
emit("insert", funcName, funcExpression);
|
|
140
111
|
};
|
|
141
112
|
|
|
113
|
+
// 提取函数变量
|
|
114
|
+
const extractVariables = (expression) => {
|
|
115
|
+
const regex = /\$\{([^}]*)\}/g;
|
|
116
|
+
const matches = [];
|
|
117
|
+
let match;
|
|
118
|
+
|
|
119
|
+
while ((match = regex.exec(expression)) !== null) {
|
|
120
|
+
matches.push(match[1]);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return [...new Set(matches)];
|
|
124
|
+
};
|
|
125
|
+
// 替换函数变量
|
|
126
|
+
const replaceVariables = (expression, variableValues) => {
|
|
127
|
+
return expression.replace(/\$\{([^}]*)\}/g, (match, variableName) => {
|
|
128
|
+
return variableValues[variableName] !== undefined ? variableValues[variableName] : match;
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
// 生成函数变量key和value的输入框
|
|
132
|
+
const showVariableInputDialog = (variables) => {
|
|
133
|
+
return new Promise((resolve) => {
|
|
134
|
+
const formData = ref(
|
|
135
|
+
variables.reduce((obj, variable) => {
|
|
136
|
+
obj[variable] = "";
|
|
137
|
+
return obj;
|
|
138
|
+
}, {})
|
|
139
|
+
);
|
|
140
|
+
const errors = ref({});
|
|
141
|
+
|
|
142
|
+
// 验证函数
|
|
143
|
+
const validateForm = () => {
|
|
144
|
+
let isValid = true;
|
|
145
|
+
const newErrors = {};
|
|
146
|
+
|
|
147
|
+
variables.forEach((variable) => {
|
|
148
|
+
if (!formData.value[variable]?.trim()) {
|
|
149
|
+
newErrors[variable] = `请输入${variable}的值`;
|
|
150
|
+
isValid = false;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
errors.value = newErrors;
|
|
155
|
+
return isValid;
|
|
156
|
+
};
|
|
157
|
+
// h语法表单组件
|
|
158
|
+
const FormComponent = {
|
|
159
|
+
setup() {
|
|
160
|
+
return () =>
|
|
161
|
+
h("div", [
|
|
162
|
+
h(
|
|
163
|
+
ElForm,
|
|
164
|
+
{
|
|
165
|
+
model: formData.value,
|
|
166
|
+
},
|
|
167
|
+
() =>
|
|
168
|
+
variables.map((variable) =>
|
|
169
|
+
h(
|
|
170
|
+
ElFormItem,
|
|
171
|
+
{
|
|
172
|
+
label: `${variable}: `,
|
|
173
|
+
prop: variable,
|
|
174
|
+
error: errors.value[variable],
|
|
175
|
+
"label-width": "90px",
|
|
176
|
+
},
|
|
177
|
+
() =>
|
|
178
|
+
h(ElInput, {
|
|
179
|
+
modelValue: formData.value[variable],
|
|
180
|
+
"onUpdate:modelValue": (val) => {
|
|
181
|
+
formData.value[variable] = val;
|
|
182
|
+
// 清除错误状态
|
|
183
|
+
if (errors.value[variable]) delete errors.value[variable];
|
|
184
|
+
},
|
|
185
|
+
placeholder: `请输入 ${variable} 的值`,
|
|
186
|
+
status: errors.value[variable] ? "error" : "",
|
|
187
|
+
})
|
|
188
|
+
)
|
|
189
|
+
)
|
|
190
|
+
),
|
|
191
|
+
]);
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
ElMessageBox({
|
|
195
|
+
title: "填写变量值用于接口测试",
|
|
196
|
+
message: h(FormComponent),
|
|
197
|
+
showCancelButton: true,
|
|
198
|
+
confirmButtonText: "确定",
|
|
199
|
+
cancelButtonText: "取消",
|
|
200
|
+
customClass: "variable-input-dialog",
|
|
201
|
+
beforeClose: async (action, instance, done) => {
|
|
202
|
+
if (action !== "confirm") {
|
|
203
|
+
resolve(false);
|
|
204
|
+
done();
|
|
205
|
+
}
|
|
206
|
+
await nextTick();
|
|
207
|
+
if (validateForm()) {
|
|
208
|
+
resolve({ ...formData.value });
|
|
209
|
+
done();
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
}).catch(() => resolve(false));
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
// 自定义函数: 测试
|
|
216
|
+
const handleTest = async () => {
|
|
217
|
+
try {
|
|
218
|
+
testLoading.value = true;
|
|
219
|
+
let testContent = stMonacoEditorRef.value.getValue();
|
|
220
|
+
if (!testContent) return ElMessage.error("函数内容不可为空");
|
|
221
|
+
// 检测函数中是否使用的变量语法, 如果包含, 需要用户二次输入对应的值, 将其替换后进行测试
|
|
222
|
+
if (/\$\{[^}]*\}/.test(testContent)) {
|
|
223
|
+
const variables = extractVariables(testContent);
|
|
224
|
+
const variableValues = await showVariableInputDialog(variables);
|
|
225
|
+
if (!variableValues) return;
|
|
226
|
+
testContent = replaceVariables(testContent, variableValues);
|
|
227
|
+
}
|
|
228
|
+
// 调用接口
|
|
229
|
+
const { body } = await request.post("/common/qt/testFactorSelect", { factorSelectExpr: testContent });
|
|
230
|
+
const { result, detail } = body;
|
|
231
|
+
Object.assign(testResult, { result, detail, code: testContent });
|
|
232
|
+
if (result === 1) {
|
|
233
|
+
ElMessage.success("测试通过");
|
|
234
|
+
} else {
|
|
235
|
+
ElMessage.error("测试未能通过");
|
|
236
|
+
testVisible.value = true;
|
|
237
|
+
}
|
|
238
|
+
} finally {
|
|
239
|
+
testLoading.value = false;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
// 自定义函数: 日志明细
|
|
243
|
+
const handleTestLog = () => {
|
|
244
|
+
if (testResult.result === null) {
|
|
245
|
+
return ElMessage.warning("请先进行测试, 等待测试完成后可查看日志");
|
|
246
|
+
}
|
|
247
|
+
testVisible.value = true;
|
|
248
|
+
};
|
|
249
|
+
|
|
142
250
|
// 变量选择器: 打开
|
|
143
251
|
const handleOpenVarSelectDialog = () => {
|
|
144
252
|
stVarSelectDialogRef.value.open(stMonacoEditorRef.value);
|
|
@@ -495,4 +603,7 @@ watch(
|
|
|
495
603
|
transform: translateX(-50%) !important;
|
|
496
604
|
z-index: 10000 !important;
|
|
497
605
|
}
|
|
606
|
+
.variable-input-dialog {
|
|
607
|
+
width: 360px;
|
|
608
|
+
}
|
|
498
609
|
</style>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, reactive, inject } from "vue";
|
|
3
|
+
import { setUserData } from "st-func";
|
|
4
|
+
|
|
5
|
+
const stConfig = inject("stConfig");
|
|
6
|
+
const userData = inject("userData");
|
|
7
|
+
|
|
8
|
+
const visible = ref(false);
|
|
9
|
+
const ruleFormRef = ref();
|
|
10
|
+
const ruleForm = reactive({
|
|
11
|
+
mobile: "",
|
|
12
|
+
});
|
|
13
|
+
const rules = reactive({
|
|
14
|
+
mobile: [
|
|
15
|
+
{ required: true, message: "请输入手机号", trigger: "blur" },
|
|
16
|
+
{
|
|
17
|
+
validator: (rule, value, callback) => {
|
|
18
|
+
const regex = /^1[3-9]\d{9}$/;
|
|
19
|
+
if (value === userData.mobile) {
|
|
20
|
+
callback("新手机号与旧手机号相同");
|
|
21
|
+
} else if (!regex.test(value)) {
|
|
22
|
+
callback("手机号格式错误");
|
|
23
|
+
} else {
|
|
24
|
+
callback();
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
trigger: "blur",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// 打开
|
|
33
|
+
const handleOpen = () => {
|
|
34
|
+
ruleForm.mobile = "";
|
|
35
|
+
visible.value = true;
|
|
36
|
+
};
|
|
37
|
+
// 提交
|
|
38
|
+
const handleSubmit = () => {
|
|
39
|
+
if (!ruleFormRef.value) return;
|
|
40
|
+
ruleFormRef.value.validate(async (valid) => {
|
|
41
|
+
if (!valid) return false;
|
|
42
|
+
// 仅传递修改过的字段
|
|
43
|
+
const params = {
|
|
44
|
+
...ruleForm,
|
|
45
|
+
userId: userData.id,
|
|
46
|
+
username: userData.username,
|
|
47
|
+
};
|
|
48
|
+
await stConfig.request.post("/invest/sys/user/updateUserInfo", params);
|
|
49
|
+
ElMessage.success(`手机号修改成功!`);
|
|
50
|
+
visible.value = false;
|
|
51
|
+
// 更新userData+本地存储
|
|
52
|
+
userData.mobile = ruleForm.mobile;
|
|
53
|
+
setUserData(userData);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<template>
|
|
59
|
+
<div class="mobile">
|
|
60
|
+
<el-text type="info">{{ userData.mobile ?? "暂无" }}</el-text>
|
|
61
|
+
<el-text
|
|
62
|
+
class="btn"
|
|
63
|
+
size="small"
|
|
64
|
+
type="primary"
|
|
65
|
+
@click="handleOpen"
|
|
66
|
+
>
|
|
67
|
+
{{ userData.mobile ? "更换手机号" : "立即绑定" }}
|
|
68
|
+
</el-text>
|
|
69
|
+
</div>
|
|
70
|
+
<!-- 手机号绑定窗口 -->
|
|
71
|
+
<el-dialog
|
|
72
|
+
v-model="visible"
|
|
73
|
+
width="460"
|
|
74
|
+
title="手机号绑定"
|
|
75
|
+
append-to-body
|
|
76
|
+
destroy-on-close
|
|
77
|
+
>
|
|
78
|
+
<el-form
|
|
79
|
+
ref="ruleFormRef"
|
|
80
|
+
:rules="rules"
|
|
81
|
+
:model="ruleForm"
|
|
82
|
+
>
|
|
83
|
+
<el-form-item
|
|
84
|
+
label="新手机"
|
|
85
|
+
prop="mobile"
|
|
86
|
+
>
|
|
87
|
+
<el-input v-model="ruleForm.mobile" />
|
|
88
|
+
</el-form-item>
|
|
89
|
+
</el-form>
|
|
90
|
+
<template #footer>
|
|
91
|
+
<el-button @click="visible = false"> 取消 </el-button>
|
|
92
|
+
<el-button
|
|
93
|
+
type="primary"
|
|
94
|
+
@click="handleSubmit"
|
|
95
|
+
>
|
|
96
|
+
确认
|
|
97
|
+
</el-button>
|
|
98
|
+
</template>
|
|
99
|
+
</el-dialog>
|
|
100
|
+
</template>
|
|
101
|
+
|
|
102
|
+
<style lang="scss" scoped>
|
|
103
|
+
.mobile {
|
|
104
|
+
display: flex;
|
|
105
|
+
gap: 6px;
|
|
106
|
+
.btn {
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
</style>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<!-- 设置资料 -->
|
|
2
|
+
<script setup>
|
|
3
|
+
import { ref, reactive, inject } from "vue";
|
|
4
|
+
import { setUserData } from "st-func";
|
|
5
|
+
import Mobile from "./Mobile.vue";
|
|
6
|
+
|
|
7
|
+
const stConfig = inject("stConfig");
|
|
8
|
+
const userData = inject("userData");
|
|
9
|
+
|
|
10
|
+
const visible = ref(false);
|
|
11
|
+
const ruleFormRef = ref();
|
|
12
|
+
const ruleForm = reactive({
|
|
13
|
+
nickName: "",
|
|
14
|
+
email: "",
|
|
15
|
+
});
|
|
16
|
+
const rules = reactive({
|
|
17
|
+
nickName: [
|
|
18
|
+
{
|
|
19
|
+
validator: (rule, value, callback) => {
|
|
20
|
+
if (value) {
|
|
21
|
+
if (/[\s@<>&%]/.test(value)) {
|
|
22
|
+
callback("昵称不能包含空格、@、<、>、&、%等特殊字符");
|
|
23
|
+
} else if (value && value.length > 12) {
|
|
24
|
+
callback("昵称长度不能超过12个字符");
|
|
25
|
+
} else {
|
|
26
|
+
callback();
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
callback();
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
trigger: "blur",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
email: [
|
|
36
|
+
{
|
|
37
|
+
validator: (rule, value, callback) => {
|
|
38
|
+
if (value && !/^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(value)) {
|
|
39
|
+
callback("邮箱格式错误");
|
|
40
|
+
} else {
|
|
41
|
+
callback();
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
trigger: "blur",
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
// 提交
|
|
49
|
+
const handleSubmit = () => {
|
|
50
|
+
if (!ruleFormRef.value) return;
|
|
51
|
+
ruleFormRef.value.validate(async (valid) => {
|
|
52
|
+
if (!valid) return false;
|
|
53
|
+
// 仅传递修改过的字段
|
|
54
|
+
const params = {
|
|
55
|
+
...ruleForm,
|
|
56
|
+
userId: userData.id,
|
|
57
|
+
username: userData.username,
|
|
58
|
+
};
|
|
59
|
+
if (params.nickName === userData.nickName) delete params.nickName;
|
|
60
|
+
if (params.email === userData.email) delete params.email;
|
|
61
|
+
await stConfig.request.post("/invest/sys/user/updateUserInfo", params);
|
|
62
|
+
ElMessage.success(`资料修改成功!`);
|
|
63
|
+
visible.value = false;
|
|
64
|
+
// 更新userData+本地存储
|
|
65
|
+
Object.assign(userData, ruleForm);
|
|
66
|
+
setUserData(userData);
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
defineExpose({
|
|
71
|
+
open: () => {
|
|
72
|
+
Object.assign(ruleForm, {
|
|
73
|
+
nickName: userData.nickName,
|
|
74
|
+
email: userData.email,
|
|
75
|
+
});
|
|
76
|
+
visible.value = true;
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<template>
|
|
82
|
+
<el-dialog
|
|
83
|
+
modal-class="edit-info"
|
|
84
|
+
v-model="visible"
|
|
85
|
+
title="设置资料"
|
|
86
|
+
width="460"
|
|
87
|
+
destroy-on-close
|
|
88
|
+
:z-index="200"
|
|
89
|
+
>
|
|
90
|
+
<el-form
|
|
91
|
+
ref="ruleFormRef"
|
|
92
|
+
:rules="rules"
|
|
93
|
+
:model="ruleForm"
|
|
94
|
+
>
|
|
95
|
+
<!-- 用户名 -->
|
|
96
|
+
<el-form-item label="用户名">
|
|
97
|
+
<el-text type="info">{{ userData.username }}</el-text>
|
|
98
|
+
</el-form-item>
|
|
99
|
+
<!-- 手机号 -->
|
|
100
|
+
<el-form-item label="手机号">
|
|
101
|
+
<Mobile />
|
|
102
|
+
</el-form-item>
|
|
103
|
+
<!-- 昵称 -->
|
|
104
|
+
<el-form-item
|
|
105
|
+
label="昵称"
|
|
106
|
+
prop="nickName"
|
|
107
|
+
>
|
|
108
|
+
<el-input v-model="ruleForm.nickName" />
|
|
109
|
+
</el-form-item>
|
|
110
|
+
<!-- 邮箱 -->
|
|
111
|
+
<el-form-item
|
|
112
|
+
label="邮箱"
|
|
113
|
+
prop="email"
|
|
114
|
+
>
|
|
115
|
+
<el-input v-model="ruleForm.email" />
|
|
116
|
+
</el-form-item>
|
|
117
|
+
</el-form>
|
|
118
|
+
<template #footer>
|
|
119
|
+
<el-button @click="visible = false"> 取消 </el-button>
|
|
120
|
+
<el-button
|
|
121
|
+
type="primary"
|
|
122
|
+
@click="handleSubmit"
|
|
123
|
+
>
|
|
124
|
+
确认
|
|
125
|
+
</el-button>
|
|
126
|
+
</template>
|
|
127
|
+
</el-dialog>
|
|
128
|
+
</template>
|
|
129
|
+
|
|
130
|
+
<style lang="scss" scoped>
|
|
131
|
+
.edit-info {
|
|
132
|
+
.el-form {
|
|
133
|
+
padding: 0 20px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
</style>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<!-- 设置密码 -->
|
|
2
2
|
<script setup>
|
|
3
3
|
import { ref, reactive, inject, nextTick } from "vue";
|
|
4
|
+
import { setUserData } from "st-func";
|
|
4
5
|
import PasswordPrompt from "../../PasswordPrompt/index.vue";
|
|
5
6
|
|
|
6
|
-
const stConfig = inject("stConfig");
|
|
7
|
-
const emit = defineEmits(["callBack"]);
|
|
8
7
|
const PasswordPromptRef = ref(null);
|
|
8
|
+
const stConfig = inject("stConfig");
|
|
9
|
+
const userData = inject("userData");
|
|
9
10
|
|
|
10
11
|
const visible = ref(false);
|
|
11
12
|
const ruleFormRef = ref();
|
|
@@ -43,7 +44,9 @@ const handleSubmit = (formEl) => {
|
|
|
43
44
|
await stConfig.request.post("/invest/sys/user/setPassword", { newPassword: ruleForm.newPassword });
|
|
44
45
|
ElMessage.success(`密码设置成功!`);
|
|
45
46
|
visible.value = false;
|
|
46
|
-
|
|
47
|
+
// 更新userData+本地存储
|
|
48
|
+
userData.canSet = false;
|
|
49
|
+
setUserData(userData);
|
|
47
50
|
});
|
|
48
51
|
};
|
|
49
52
|
|
package/packages/User/index.vue
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { reactive, ref } from "vue";
|
|
2
|
+
import { provide, reactive, ref } from "vue";
|
|
3
3
|
import { UserFilled, ArrowDown, Right } from "@element-plus/icons-vue";
|
|
4
|
-
import { getUserData,
|
|
5
|
-
import EditInfoDialog from "./components/EditInfoDialog.vue";
|
|
4
|
+
import { getUserData, login, loginout } from "st-func";
|
|
5
|
+
import EditInfoDialog from "./components/EditInfoDialog/index.vue";
|
|
6
6
|
import SetPasswordDialog from "./components/SetPasswordDialog.vue";
|
|
7
7
|
import EditPasswordDialog from "./components/EditPasswordDialog.vue";
|
|
8
8
|
|
|
@@ -31,16 +31,7 @@ const handleLoginOut = () => {
|
|
|
31
31
|
emit("loginout");
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
const editInfoCallBack = (data) => {
|
|
36
|
-
Object.assign(userData, data);
|
|
37
|
-
setUserData(userData);
|
|
38
|
-
};
|
|
39
|
-
// 设置密码成功回调
|
|
40
|
-
const setPasswordCallBack = () => {
|
|
41
|
-
userData.canSet = false;
|
|
42
|
-
setUserData(userData);
|
|
43
|
-
};
|
|
34
|
+
provide("userData", userData);
|
|
44
35
|
</script>
|
|
45
36
|
|
|
46
37
|
<template>
|
|
@@ -50,7 +41,7 @@ const setPasswordCallBack = () => {
|
|
|
50
41
|
<el-dropdown placement="bottom">
|
|
51
42
|
<div class="user-msg">
|
|
52
43
|
<el-icon class="user-msg-icon"><UserFilled /></el-icon>
|
|
53
|
-
<span>{{ userData
|
|
44
|
+
<span>{{ userData.nickName || userData.username }}</span>
|
|
54
45
|
<el-icon class="user-msg-arrow"><ArrowDown /></el-icon>
|
|
55
46
|
</div>
|
|
56
47
|
<template #dropdown>
|
|
@@ -88,15 +79,9 @@ const setPasswordCallBack = () => {
|
|
|
88
79
|
</template>
|
|
89
80
|
|
|
90
81
|
<!-- 弹窗: 设置资料 -->
|
|
91
|
-
<EditInfoDialog
|
|
92
|
-
ref="EditInfoDialogRef"
|
|
93
|
-
@callBack="editInfoCallBack"
|
|
94
|
-
/>
|
|
82
|
+
<EditInfoDialog ref="EditInfoDialogRef" />
|
|
95
83
|
<!-- 弹窗: 设置密码 -->
|
|
96
|
-
<SetPasswordDialog
|
|
97
|
-
ref="SetPasswordDialogRef"
|
|
98
|
-
@callBack="setPasswordCallBack"
|
|
99
|
-
/>
|
|
84
|
+
<SetPasswordDialog ref="SetPasswordDialogRef" />
|
|
100
85
|
<!-- 弹窗: 修改密码 -->
|
|
101
86
|
<EditPasswordDialog ref="EditPasswordDialogRef" />
|
|
102
87
|
</div>
|
package/es/debounce-62f5b6e8.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("./index-9780a537.cjs");var C=/\s/;function L(e){for(var i=e.length;i--&&C.test(e.charAt(i)););return i}var M=/^\s+/;function $(e){return e&&e.slice(0,L(e)+1).replace(M,"")}var k=0/0,j=/^[-+]0x[0-9a-f]+$/i,B=/^0b[01]+$/i,R=/^0o[0-7]+$/i,F=parseInt;function v(e){if(typeof e=="number")return e;if(l.isSymbol(e))return k;if(l.isObject(e)){var i=typeof e.valueOf=="function"?e.valueOf():e;e=l.isObject(i)?i+"":i}if(typeof e!="string")return e===0?e:+e;e=$(e);var t=B.test(e);return t||R.test(e)?F(e.slice(2),t?2:8):j.test(e)?k:+e}var _=function(){return l.root.Date.now()};const h=_;var q="Expected a function",D=Math.max,H=Math.min;function P(e,i,t){var u,s,g,c,r,f,o=0,y=!1,d=!1,x=!0;if(typeof e!="function")throw new TypeError(q);i=v(i)||0,l.isObject(t)&&(y=!!t.leading,d="maxWait"in t,g=d?D(v(t.maxWait)||0,i):g,x="trailing"in t?!!t.trailing:x);function b(n){var a=u,m=s;return u=s=void 0,o=n,c=e.apply(m,a),c}function S(n){return o=n,r=setTimeout(T,i),y?b(n):c}function W(n){var a=n-f,m=n-o,O=i-a;return d?H(O,g-m):O}function E(n){var a=n-f,m=n-o;return f===void 0||a>=i||a<0||d&&m>=g}function T(){var n=h();if(E(n))return p(n);r=setTimeout(T,W(n))}function p(n){return r=void 0,x&&u?b(n):(u=s=void 0,c)}function N(){r!==void 0&&clearTimeout(r),o=0,u=f=s=r=void 0}function A(){return r===void 0?c:p(h())}function I(){var n=h(),a=E(n);if(u=arguments,s=this,f=n,a){if(r===void 0)return S(f);if(d)return clearTimeout(r),r=setTimeout(T,i),b(f)}return r===void 0&&(r=setTimeout(T,i)),c}return I.cancel=N,I.flush=A,I}exports.debounce=P;exports.toNumber=v;
|
package/es/debounce-8d53f4dd.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { l as L, i as v, r as M } from "./index-960806da.js";
|
|
2
|
-
var N = /\s/;
|
|
3
|
-
function $(n) {
|
|
4
|
-
for (var r = n.length; r-- && N.test(n.charAt(r)); )
|
|
5
|
-
;
|
|
6
|
-
return r;
|
|
7
|
-
}
|
|
8
|
-
var B = /^\s+/;
|
|
9
|
-
function R(n) {
|
|
10
|
-
return n && n.slice(0, $(n) + 1).replace(B, "");
|
|
11
|
-
}
|
|
12
|
-
var k = 0 / 0, F = /^[-+]0x[0-9a-f]+$/i, _ = /^0b[01]+$/i, j = /^0o[0-7]+$/i, D = parseInt;
|
|
13
|
-
function S(n) {
|
|
14
|
-
if (typeof n == "number")
|
|
15
|
-
return n;
|
|
16
|
-
if (L(n))
|
|
17
|
-
return k;
|
|
18
|
-
if (v(n)) {
|
|
19
|
-
var r = typeof n.valueOf == "function" ? n.valueOf() : n;
|
|
20
|
-
n = v(r) ? r + "" : r;
|
|
21
|
-
}
|
|
22
|
-
if (typeof n != "string")
|
|
23
|
-
return n === 0 ? n : +n;
|
|
24
|
-
n = R(n);
|
|
25
|
-
var t = _.test(n);
|
|
26
|
-
return t || j.test(n) ? D(n.slice(2), t ? 2 : 8) : F.test(n) ? k : +n;
|
|
27
|
-
}
|
|
28
|
-
var H = function() {
|
|
29
|
-
return M.Date.now();
|
|
30
|
-
};
|
|
31
|
-
const h = H;
|
|
32
|
-
var P = "Expected a function", U = Math.max, X = Math.min;
|
|
33
|
-
function z(n, r, t) {
|
|
34
|
-
var u, c, l, s, i, f, o = 0, p = !1, d = !1, T = !0;
|
|
35
|
-
if (typeof n != "function")
|
|
36
|
-
throw new TypeError(P);
|
|
37
|
-
r = S(r) || 0, v(t) && (p = !!t.leading, d = "maxWait" in t, l = d ? U(S(t.maxWait) || 0, r) : l, T = "trailing" in t ? !!t.trailing : T);
|
|
38
|
-
function x(e) {
|
|
39
|
-
var a = u, m = c;
|
|
40
|
-
return u = c = void 0, o = e, s = n.apply(m, a), s;
|
|
41
|
-
}
|
|
42
|
-
function W(e) {
|
|
43
|
-
return o = e, i = setTimeout(g, r), p ? x(e) : s;
|
|
44
|
-
}
|
|
45
|
-
function O(e) {
|
|
46
|
-
var a = e - f, m = e - o, E = r - a;
|
|
47
|
-
return d ? X(E, l - m) : E;
|
|
48
|
-
}
|
|
49
|
-
function y(e) {
|
|
50
|
-
var a = e - f, m = e - o;
|
|
51
|
-
return f === void 0 || a >= r || a < 0 || d && m >= l;
|
|
52
|
-
}
|
|
53
|
-
function g() {
|
|
54
|
-
var e = h();
|
|
55
|
-
if (y(e))
|
|
56
|
-
return b(e);
|
|
57
|
-
i = setTimeout(g, O(e));
|
|
58
|
-
}
|
|
59
|
-
function b(e) {
|
|
60
|
-
return i = void 0, T && u ? x(e) : (u = c = void 0, s);
|
|
61
|
-
}
|
|
62
|
-
function A() {
|
|
63
|
-
i !== void 0 && clearTimeout(i), o = 0, u = f = c = i = void 0;
|
|
64
|
-
}
|
|
65
|
-
function C() {
|
|
66
|
-
return i === void 0 ? s : b(h());
|
|
67
|
-
}
|
|
68
|
-
function I() {
|
|
69
|
-
var e = h(), a = y(e);
|
|
70
|
-
if (u = arguments, c = this, f = e, a) {
|
|
71
|
-
if (i === void 0)
|
|
72
|
-
return W(f);
|
|
73
|
-
if (d)
|
|
74
|
-
return clearTimeout(i), i = setTimeout(g, r), x(f);
|
|
75
|
-
}
|
|
76
|
-
return i === void 0 && (i = setTimeout(g, r)), s;
|
|
77
|
-
}
|
|
78
|
-
return I.cancel = A, I.flush = C, I;
|
|
79
|
-
}
|
|
80
|
-
export {
|
|
81
|
-
z as d,
|
|
82
|
-
S as t
|
|
83
|
-
};
|
package/es/dropdown-071c5d7e.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./el-popper-b6c99b28.cjs"),o=require("./base-ef747d02.cjs"),O=require("./use-form-common-props-fd9b61a0.cjs"),t=require("vue"),N=t.defineComponent({inheritAttrs:!1});function y(r,l,c,i,d,E){return t.renderSlot(r.$slots,"default")}var g=o._export_sfc(N,[["render",y],["__file","collection.vue"]]);const S=t.defineComponent({name:"ElCollectionItem",inheritAttrs:!1});function P(r,l,c,i,d,E){return t.renderSlot(r.$slots,"default")}var L=o._export_sfc(S,[["render",P],["__file","collection-item.vue"]]);const f="data-el-collection-item",T=r=>{const l=`El${r}Collection`,c=`${l}Item`,i=Symbol(l),d=Symbol(c),E={...g,name:l,setup(){const a=t.ref(),u=new Map,p=()=>{const s=t.unref(a);if(!s)return[];const n=Array.from(s.querySelectorAll(`[${f}]`));return[...u.values()].sort((m,I)=>n.indexOf(m.ref)-n.indexOf(I.ref))};t.provide(i,{itemMap:u,getItems:p,collectionRef:a})}},C={...L,name:c,setup(a,{attrs:u}){const p=t.ref(),s=t.inject(i,void 0);t.provide(d,{collectionItemRef:p}),t.onMounted(()=>{const n=t.unref(p);n&&s.itemMap.set(n,{ref:n,...u})}),t.onBeforeUnmount(()=>{const n=t.unref(p);s.itemMap.delete(n)})}};return{COLLECTION_INJECTION_KEY:i,COLLECTION_ITEM_INJECTION_KEY:d,ElCollection:E,ElCollectionItem:C}},b=o.buildProps({trigger:e.useTooltipTriggerProps.trigger,triggerKeys:{type:o.definePropType(Array),default:()=>[e.EVENT_CODE.enter,e.EVENT_CODE.numpadEnter,e.EVENT_CODE.space,e.EVENT_CODE.down]},virtualTriggering:e.useTooltipTriggerProps.virtualTriggering,virtualRef:e.useTooltipTriggerProps.virtualRef,effect:{...e.useTooltipContentProps.effect,default:"light"},type:{type:o.definePropType(String)},placement:{type:o.definePropType(String),default:"bottom"},popperOptions:{type:o.definePropType(Object),default:()=>({})},id:String,size:{type:String,default:""},splitButton:Boolean,hideOnClick:{type:Boolean,default:!0},loop:{type:Boolean,default:!0},showArrow:{type:Boolean,default:!0},showTimeout:{type:Number,default:150},hideTimeout:{type:Number,default:150},tabindex:{type:o.definePropType([Number,String]),default:0},maxHeight:{type:o.definePropType([Number,String]),default:""},popperClass:{type:String,default:""},disabled:Boolean,role:{type:String,values:e.roleTypes,default:"menu"},buttonProps:{type:o.definePropType(Object)},teleported:e.useTooltipContentProps.teleported,persistent:{type:Boolean,default:!0}}),v=o.buildProps({command:{type:[Object,String,Number],default:()=>({})},disabled:Boolean,divided:Boolean,textValue:String,icon:{type:O.iconPropType}}),w=o.buildProps({onKeydown:{type:o.definePropType(Function)}}),M=[e.EVENT_CODE.down,e.EVENT_CODE.pageDown,e.EVENT_CODE.home],_=[e.EVENT_CODE.up,e.EVENT_CODE.pageUp,e.EVENT_CODE.end],$=[...M,..._],{ElCollection:h,ElCollectionItem:K,COLLECTION_INJECTION_KEY:A,COLLECTION_ITEM_INJECTION_KEY:D}=T("Dropdown");exports.COLLECTION_INJECTION_KEY=A;exports.COLLECTION_ITEM_INJECTION_KEY=D;exports.COLLECTION_ITEM_SIGN=f;exports.ElCollection=h;exports.ElCollectionItem=K;exports.FIRST_LAST_KEYS=$;exports.LAST_KEYS=_;exports.createCollectionWithScope=T;exports.dropdownItemProps=v;exports.dropdownMenuProps=w;exports.dropdownProps=b;
|