st-comp 0.0.199 → 0.0.201
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/es/CustomFunction.cjs +1 -1
- package/es/CustomFunction.js +267 -199
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +27 -25
- package/es/KlinePlus.cjs +3 -3
- package/es/KlinePlus.js +252 -249
- package/es/User.cjs +1 -1
- package/es/User.js +714 -624
- package/es/VarietySearch.cjs +6 -6
- package/es/VarietySearch.js +19 -17
- package/es/VarietyTextCopy.cjs +3 -3
- package/es/VarietyTextCopy.js +4 -4
- package/es/el-checkbox-group-0ea8fbf8.cjs +1 -0
- package/es/el-checkbox-group-4ed993c7.js +1 -0
- package/es/{el-form-item-eeb64520.js → el-form-item-c53c374d.js} +2 -2
- package/es/el-message-box-a93d2f6a.js +489 -0
- package/es/el-message-box-c10adb52.cjs +1 -0
- package/es/el-text-ac60d0f2.js +67 -0
- package/es/el-text-c20a9f48.cjs +1 -0
- package/es/style.css +1 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +206 -206
- package/lib/{index-c9dddb13.js → index-c0ce50bc.js} +20375 -20219
- package/lib/{python-8de8f552.js → python-9dae326e.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/CustomFunction/index.vue +141 -30
- package/packages/KlinePlus/index.vue +17 -7
- 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/src/pages/KlinePlus/index.vue +6 -5
- package/es/el-message-box-48d71ee5.cjs +0 -1
- package/es/el-message-box-81ffd21e.js +0 -550
- package/packages/User/components/EditInfoDialog.vue +0 -144
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>
|
|
@@ -643,22 +643,27 @@ const draw = (params = { startValue: 0, endValue: 0 }) => {
|
|
|
643
643
|
// 图表: 绘制(当屏最高价)
|
|
644
644
|
const drawScreenMaxPrice = () => {
|
|
645
645
|
if (!props.userKlineConfig.enable_showScreenMaxPrice || !klineData.value.time.length) return;
|
|
646
|
+
|
|
646
647
|
const { data } = klineData.value;
|
|
647
|
-
const
|
|
648
|
+
const originOption = mainChartIns.getOption();
|
|
649
|
+
const { startValue, endValue } = originOption?.dataZoom[0] ?? {};
|
|
650
|
+
|
|
648
651
|
let maxPrice = 0;
|
|
649
652
|
let maxPriceIndex = startValue;
|
|
653
|
+
|
|
650
654
|
for (let i = startValue; i <= endValue; i++) {
|
|
651
655
|
if (Number(data[i][3]) >= maxPrice) {
|
|
652
656
|
maxPrice = Number(data[i][3]);
|
|
653
657
|
maxPriceIndex = i;
|
|
654
658
|
}
|
|
655
659
|
}
|
|
656
|
-
|
|
660
|
+
|
|
657
661
|
const filterSeries = originOption.series?.filter((item) => item.name !== "maxPrice") || [];
|
|
658
662
|
const dataLength = endValue - startValue;
|
|
659
663
|
const positionInView = (maxPriceIndex - startValue) / dataLength;
|
|
660
664
|
let position = "right";
|
|
661
665
|
let formatter = `←${maxPrice}`;
|
|
666
|
+
|
|
662
667
|
if (positionInView > 0.7) {
|
|
663
668
|
position = "left";
|
|
664
669
|
formatter = `${round(maxPrice)}→`;
|
|
@@ -666,24 +671,26 @@ const drawScreenMaxPrice = () => {
|
|
|
666
671
|
position = "right";
|
|
667
672
|
formatter = `←${round(maxPrice)}`;
|
|
668
673
|
}
|
|
674
|
+
|
|
675
|
+
// 关键:只更新 series,不更新其他配置
|
|
669
676
|
mainChartIns?.setOption(
|
|
670
677
|
{
|
|
671
|
-
...originOption,
|
|
672
678
|
series: [
|
|
673
679
|
...filterSeries,
|
|
674
680
|
{
|
|
675
681
|
type: "line",
|
|
676
682
|
name: "maxPrice",
|
|
683
|
+
data: [],
|
|
684
|
+
lineStyle: { opacity: 0 },
|
|
677
685
|
markPoint: {
|
|
678
|
-
// 点位原本样式通过透明去进行隐藏, 从而仅展示文案
|
|
679
686
|
symbol: "circle",
|
|
680
687
|
symbolSize: 1,
|
|
681
688
|
itemStyle: {
|
|
682
689
|
color: "transparent",
|
|
683
690
|
borderColor: "transparent",
|
|
684
691
|
},
|
|
685
|
-
z: 100,
|
|
686
|
-
zlevel: 10,
|
|
692
|
+
z: 100,
|
|
693
|
+
zlevel: 10,
|
|
687
694
|
label: {
|
|
688
695
|
show: true,
|
|
689
696
|
position,
|
|
@@ -702,7 +709,10 @@ const drawScreenMaxPrice = () => {
|
|
|
702
709
|
},
|
|
703
710
|
],
|
|
704
711
|
},
|
|
705
|
-
|
|
712
|
+
{
|
|
713
|
+
notMerge: false, // 合并模式
|
|
714
|
+
replaceMerge: [] // 不替换任何配置
|
|
715
|
+
}
|
|
706
716
|
);
|
|
707
717
|
};
|
|
708
718
|
|
|
@@ -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>
|
|
@@ -79,6 +79,7 @@ const varietyCode = ref("Z000012");
|
|
|
79
79
|
const varietyStock = ref(1); // 0: 期货, 1: 股票, 2: 期权
|
|
80
80
|
const tradeLog = ref(tradeLogMock);
|
|
81
81
|
const netPositionData = ref([]);
|
|
82
|
+
const pageType = ref(1);
|
|
82
83
|
const cycle = ref("5");
|
|
83
84
|
const sellBuy = ref(1);
|
|
84
85
|
const rightType = ref(1);
|
|
@@ -172,7 +173,7 @@ const handleUserKlineConfig = async (action, formJson) => {
|
|
|
172
173
|
// 更新配置数据
|
|
173
174
|
Object.assign(userKlineConfig, JSON.parse(formJson));
|
|
174
175
|
// 默认值 [自定义配置]
|
|
175
|
-
|
|
176
|
+
pageType.value = userKlineConfig.pageType;
|
|
176
177
|
cycle.value = userKlineConfig.singelCycle;
|
|
177
178
|
sellBuy.value = userKlineConfig.sellBuy;
|
|
178
179
|
mainIndicator.value = userKlineConfig.mainIndicator;
|
|
@@ -195,10 +196,10 @@ onMounted(async () => {
|
|
|
195
196
|
initTimeRange.value = getTimeRange(params);
|
|
196
197
|
|
|
197
198
|
// 默认值 [自定义配置]
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
pageType.value = userKlineConfig.pageType;
|
|
200
|
+
cycle.value = userKlineConfig.singelCycle;
|
|
201
|
+
sellBuy.value = userKlineConfig.sellBuy;
|
|
202
|
+
mainIndicator.value = userKlineConfig.mainIndicator;
|
|
202
203
|
|
|
203
204
|
setTimeout(() => {
|
|
204
205
|
loading.value = false;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("vue"),i=require("./base-ef747d02.cjs"),k=require("./use-form-common-props-fd9b61a0.cjs"),Q=require("./el-button-eec58cff.cjs"),Y=require("./el-input-7fd293af.cjs"),A=require("./el-overlay-9e34965f.cjs"),N=require("./index-098c2447.cjs"),z=require("./el-popper-b6c99b28.cjs"),x=require("./validator-1b8a6128.cjs"),_=require("./use-global-config-30d7d8ce.cjs"),F=require("./index-9780a537.cjs"),ee=require("./el-dialog-ae86edb8.cjs"),ne=i.buildProps({type:{type:String,values:["primary","success","info","warning","danger",""],default:""},size:{type:String,values:k.componentSizes,default:""},truncated:Boolean,lineClamp:{type:[String,Number]},tag:{type:String,default:"span"}}),oe=n.defineComponent({name:"ElText"}),te=n.defineComponent({...oe,props:ne,setup(e){const t=e,l=n.ref(),c=k.useFormSize(),a=i.useNamespace("text"),s=n.computed(()=>[a.b(),a.m(t.type),a.m(c.value),a.is("truncated",t.truncated),a.is("line-clamp",!i.isUndefined(t.lineClamp))]),d=()=>{var u,m,o,B,f,T,M;if(n.useAttrs().title)return;let C=!1;const I=((u=l.value)==null?void 0:u.textContent)||"";if(t.truncated){const p=(m=l.value)==null?void 0:m.offsetWidth,h=(o=l.value)==null?void 0:o.scrollWidth;p&&h&&h>p&&(C=!0)}else if(!i.isUndefined(t.lineClamp)){const p=(B=l.value)==null?void 0:B.offsetHeight,h=(f=l.value)==null?void 0:f.scrollHeight;p&&h&&h>p&&(C=!0)}C?(T=l.value)==null||T.setAttribute("title",I):(M=l.value)==null||M.removeAttribute("title")};return n.onMounted(d),n.onUpdated(d),(u,m)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(u.tag),{ref_key:"textRef",ref:l,class:n.normalizeClass(n.unref(s)),style:n.normalizeStyle({"-webkit-line-clamp":u.lineClamp})},{default:n.withCtx(()=>[n.renderSlot(u.$slots,"default")]),_:3},8,["class","style"]))}});var le=i._export_sfc(te,[["__file","text.vue"]]);const se=i.withInstall(le),D="_trap-focus-children",b=[],K=e=>{if(b.length===0)return;const t=b[b.length-1][D];if(t.length>0&&e.code===z.EVENT_CODE.tab){if(t.length===1){e.preventDefault(),document.activeElement!==t[0]&&t[0].focus();return}const l=e.shiftKey,c=e.target===t[0],a=e.target===t[t.length-1];c&&l&&(e.preventDefault(),t[t.length-1].focus()),a&&!l&&(e.preventDefault(),t[0].focus())}},ae={beforeMount(e){e[D]=z.obtainAllFocusableElements(e),b.push(e),b.length<=1&&document.addEventListener("keydown",K)},updated(e){n.nextTick(()=>{e[D]=z.obtainAllFocusableElements(e)})},unmounted(){b.shift(),b.length===0&&document.removeEventListener("keydown",K)}},re=n.defineComponent({name:"ElMessageBox",directives:{TrapFocus:ae},components:{ElButton:Q.ElButton,ElFocusTrap:z.ElFocusTrap,ElInput:Y.ElInput,ElOverlay:A.ElOverlay,ElIcon:N.ElIcon,...k.TypeComponents},inheritAttrs:!1,props:{buttonSize:{type:String,validator:x.isValidComponentSize},modal:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},closeOnHashChange:{type:Boolean,default:!0},center:Boolean,draggable:Boolean,overflow:Boolean,roundButton:Boolean,container:{type:String,default:"body"},boxType:{type:String,default:""}},emits:["vanish","action"],setup(e,{emit:t}){const{locale:l,zIndex:c,ns:a,size:s}=_.useGlobalComponentSettings("message-box",n.computed(()=>e.buttonSize)),{t:d}=l,{nextZIndex:u}=c,m=n.ref(!1),o=n.reactive({autofocus:!0,beforeClose:null,callback:null,cancelButtonText:"",cancelButtonClass:"",confirmButtonText:"",confirmButtonClass:"",customClass:"",customStyle:{},dangerouslyUseHTMLString:!1,distinguishCancelAndClose:!1,icon:"",closeIcon:"",inputPattern:null,inputPlaceholder:"",inputType:"text",inputValue:"",inputValidator:void 0,inputErrorMessage:"",message:"",modalFade:!0,modalClass:"",showCancelButton:!1,showConfirmButton:!0,type:"",title:void 0,showInput:!1,action:"",confirmButtonLoading:!1,cancelButtonLoading:!1,confirmButtonLoadingIcon:n.markRaw(N.loading_default),cancelButtonLoadingIcon:n.markRaw(N.loading_default),confirmButtonDisabled:!1,editorErrorMessage:"",validateError:!1,zIndex:u()}),B=n.computed(()=>{const r=o.type;return{[a.bm("icon",r)]:r&&k.TypeComponentsMap[r]}}),f=F.useId(),T=F.useId(),M=n.computed(()=>{const r=o.type;return o.icon||r&&k.TypeComponentsMap[r]||""}),R=n.computed(()=>!!o.message),C=n.ref(),I=n.ref(),p=n.ref(),h=n.ref(),O=n.ref(),U=n.computed(()=>o.confirmButtonClass);n.watch(()=>o.inputValue,async r=>{await n.nextTick(),e.boxType==="prompt"&&r&&L()},{immediate:!0}),n.watch(()=>m.value,r=>{var v,g;r&&(e.boxType!=="prompt"&&(o.autofocus?p.value=(g=(v=O.value)==null?void 0:v.$el)!=null?g:C.value:p.value=C.value),o.zIndex=u()),e.boxType==="prompt"&&(r?n.nextTick().then(()=>{var q;h.value&&h.value.$el&&(o.autofocus?p.value=(q=Z())!=null?q:C.value:p.value=C.value)}):(o.editorErrorMessage="",o.validateError=!1))});const H=n.computed(()=>e.draggable),j=n.computed(()=>e.overflow),{isDragging:G}=ee.useDraggable(C,I,H,j);n.onMounted(async()=>{await n.nextTick(),e.closeOnHashChange&&window.addEventListener("hashchange",w)}),n.onBeforeUnmount(()=>{e.closeOnHashChange&&window.removeEventListener("hashchange",w)});function w(){m.value&&(m.value=!1,n.nextTick(()=>{o.action&&t("action",o.action)}))}const $=()=>{e.closeOnClickModal&&V(o.distinguishCancelAndClose?"close":"cancel")},W=A.useSameTarget($),X=r=>{if(o.inputType!=="textarea")return r.preventDefault(),V("confirm")},V=r=>{var v;e.boxType==="prompt"&&r==="confirm"&&!L()||(o.action=r,o.beforeClose?(v=o.beforeClose)==null||v.call(o,r,o,w):w())},L=()=>{if(e.boxType==="prompt"){const r=o.inputPattern;if(r&&!r.test(o.inputValue||""))return o.editorErrorMessage=o.inputErrorMessage||d("el.messagebox.error"),o.validateError=!0,!1;const v=o.inputValidator;if(i.isFunction(v)){const g=v(o.inputValue);if(g===!1)return o.editorErrorMessage=o.inputErrorMessage||d("el.messagebox.error"),o.validateError=!0,!1;if(i.isString(g))return o.editorErrorMessage=g,o.validateError=!0,!1}}return o.editorErrorMessage="",o.validateError=!1,!0},Z=()=>{var r,v;const g=(r=h.value)==null?void 0:r.$refs;return(v=g==null?void 0:g.input)!=null?v:g==null?void 0:g.textarea},P=()=>{V("close")},J=()=>{e.closeOnPressEscape&&P()};return e.lockScroll&&A.useLockscreen(m),{...n.toRefs(o),ns:a,overlayEvent:W,visible:m,hasMessage:R,typeClass:B,contentId:f,inputId:T,btnSize:s,iconComponent:M,confirmButtonClasses:U,rootRef:C,focusStartRef:p,headerRef:I,inputRef:h,isDragging:G,confirmRef:O,doClose:w,handleClose:P,onCloseRequested:J,handleWrapperClick:$,handleInputEnter:X,handleAction:V,t:d}}});function ie(e,t,l,c,a,s){const d=n.resolveComponent("el-icon"),u=n.resolveComponent("el-input"),m=n.resolveComponent("el-button"),o=n.resolveComponent("el-focus-trap"),B=n.resolveComponent("el-overlay");return n.openBlock(),n.createBlock(n.Transition,{name:"fade-in-linear",onAfterLeave:f=>e.$emit("vanish"),persisted:""},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(B,{"z-index":e.zIndex,"overlay-class":[e.ns.is("message-box"),e.modalClass],mask:e.modal},{default:n.withCtx(()=>[n.createElementVNode("div",{role:"dialog","aria-label":e.title,"aria-modal":"true","aria-describedby":e.showInput?void 0:e.contentId,class:n.normalizeClass(`${e.ns.namespace.value}-overlay-message-box`),onClick:e.overlayEvent.onClick,onMousedown:e.overlayEvent.onMousedown,onMouseup:e.overlayEvent.onMouseup},[n.createVNode(o,{loop:"",trapped:e.visible,"focus-trap-el":e.rootRef,"focus-start-el":e.focusStartRef,onReleaseRequested:e.onCloseRequested},{default:n.withCtx(()=>[n.createElementVNode("div",{ref:"rootRef",class:n.normalizeClass([e.ns.b(),e.customClass,e.ns.is("draggable",e.draggable),e.ns.is("dragging",e.isDragging),{[e.ns.m("center")]:e.center}]),style:n.normalizeStyle(e.customStyle),tabindex:"-1",onClick:n.withModifiers(()=>{},["stop"])},[e.title!==null&&e.title!==void 0?(n.openBlock(),n.createElementBlock("div",{key:0,ref:"headerRef",class:n.normalizeClass([e.ns.e("header"),{"show-close":e.showClose}])},[n.createElementVNode("div",{class:n.normalizeClass(e.ns.e("title"))},[e.iconComponent&&e.center?(n.openBlock(),n.createBlock(d,{key:0,class:n.normalizeClass([e.ns.e("status"),e.typeClass])},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(e.iconComponent)))]),_:1},8,["class"])):n.createCommentVNode("v-if",!0),n.createElementVNode("span",null,n.toDisplayString(e.title),1)],2),e.showClose?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:n.normalizeClass(e.ns.e("headerbtn")),"aria-label":e.t("el.messagebox.close"),onClick:f=>e.handleAction(e.distinguishCancelAndClose?"close":"cancel"),onKeydown:n.withKeys(n.withModifiers(f=>e.handleAction(e.distinguishCancelAndClose?"close":"cancel"),["prevent"]),["enter"])},[n.createVNode(d,{class:n.normalizeClass(e.ns.e("close"))},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(e.closeIcon||"close")))]),_:1},8,["class"])],42,["aria-label","onClick","onKeydown"])):n.createCommentVNode("v-if",!0)],2)):n.createCommentVNode("v-if",!0),n.createElementVNode("div",{id:e.contentId,class:n.normalizeClass(e.ns.e("content"))},[n.createElementVNode("div",{class:n.normalizeClass(e.ns.e("container"))},[e.iconComponent&&!e.center&&e.hasMessage?(n.openBlock(),n.createBlock(d,{key:0,class:n.normalizeClass([e.ns.e("status"),e.typeClass])},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(e.iconComponent)))]),_:1},8,["class"])):n.createCommentVNode("v-if",!0),e.hasMessage?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(e.ns.e("message"))},[n.renderSlot(e.$slots,"default",{},()=>[e.dangerouslyUseHTMLString?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(e.showInput?"label":"p"),{key:1,for:e.showInput?e.inputId:void 0,innerHTML:e.message},null,8,["for","innerHTML"])):(n.openBlock(),n.createBlock(n.resolveDynamicComponent(e.showInput?"label":"p"),{key:0,for:e.showInput?e.inputId:void 0,textContent:n.toDisplayString(e.message)},null,8,["for","textContent"]))])],2)):n.createCommentVNode("v-if",!0)],2),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(e.ns.e("input"))},[n.createVNode(u,{id:e.inputId,ref:"inputRef",modelValue:e.inputValue,"onUpdate:modelValue":f=>e.inputValue=f,type:e.inputType,placeholder:e.inputPlaceholder,"aria-invalid":e.validateError,class:n.normalizeClass({invalid:e.validateError}),onKeydown:n.withKeys(e.handleInputEnter,["enter"])},null,8,["id","modelValue","onUpdate:modelValue","type","placeholder","aria-invalid","class","onKeydown"]),n.createElementVNode("div",{class:n.normalizeClass(e.ns.e("errormsg")),style:n.normalizeStyle({visibility:e.editorErrorMessage?"visible":"hidden"})},n.toDisplayString(e.editorErrorMessage),7)],2),[[n.vShow,e.showInput]])],10,["id"]),n.createElementVNode("div",{class:n.normalizeClass(e.ns.e("btns"))},[e.showCancelButton?(n.openBlock(),n.createBlock(m,{key:0,loading:e.cancelButtonLoading,"loading-icon":e.cancelButtonLoadingIcon,class:n.normalizeClass([e.cancelButtonClass]),round:e.roundButton,size:e.btnSize,onClick:f=>e.handleAction("cancel"),onKeydown:n.withKeys(n.withModifiers(f=>e.handleAction("cancel"),["prevent"]),["enter"])},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(e.cancelButtonText||e.t("el.messagebox.cancel")),1)]),_:1},8,["loading","loading-icon","class","round","size","onClick","onKeydown"])):n.createCommentVNode("v-if",!0),n.withDirectives(n.createVNode(m,{ref:"confirmRef",type:"primary",loading:e.confirmButtonLoading,"loading-icon":e.confirmButtonLoadingIcon,class:n.normalizeClass([e.confirmButtonClasses]),round:e.roundButton,disabled:e.confirmButtonDisabled,size:e.btnSize,onClick:f=>e.handleAction("confirm"),onKeydown:n.withKeys(n.withModifiers(f=>e.handleAction("confirm"),["prevent"]),["enter"])},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(e.confirmButtonText||e.t("el.messagebox.confirm")),1)]),_:1},8,["loading","loading-icon","class","round","disabled","size","onClick","onKeydown"]),[[n.vShow,e.showConfirmButton]])],2)],14,["onClick"])]),_:3},8,["trapped","focus-trap-el","focus-start-el","onReleaseRequested"])],42,["aria-label","aria-describedby","onClick","onMousedown","onMouseup"])]),_:3},8,["z-index","overlay-class","mask"]),[[n.vShow,e.visible]])]),_:3},8,["onAfterLeave"])}var ce=i._export_sfc(re,[["render",ie],["__file","index.vue"]]);const S=new Map,ue=e=>{let t=document.body;return e.appendTo&&(i.isString(e.appendTo)&&(t=document.querySelector(e.appendTo)),i.isElement(e.appendTo)&&(t=e.appendTo),i.isElement(t)||(t=document.body)),t},de=(e,t,l=null)=>{const c=n.createVNode(ce,e,i.isFunction(e.message)||n.isVNode(e.message)?{default:i.isFunction(e.message)?e.message:()=>e.message}:null);return c.appContext=l,n.render(c,t),ue(e).appendChild(t.firstElementChild),c.component},fe=()=>document.createElement("div"),me=(e,t)=>{const l=fe();e.onVanish=()=>{n.render(null,l),S.delete(a)},e.onAction=s=>{const d=S.get(a);let u;e.showInput?u={value:a.inputValue,action:s}:u=s,e.callback?e.callback(u,c.proxy):s==="cancel"||s==="close"?e.distinguishCancelAndClose&&s!=="cancel"?d.reject("close"):d.reject("cancel"):d.resolve(u)};const c=de(e,l,t),a=c.proxy;for(const s in e)i.hasOwn(e,s)&&!i.hasOwn(a.$props,s)&&(s==="closeIcon"&&i.isObject(e[s])?a[s]=n.markRaw(e[s]):a[s]=e[s]);return a.visible=!0,a};function E(e,t=null){if(!i.isClient)return Promise.reject();let l;return i.isString(e)||n.isVNode(e)?e={message:e}:l=e.callback,new Promise((c,a)=>{const s=me(e,t??E._context);S.set(s,{options:e,callback:l,resolve:c,reject:a})})}const pe=["alert","confirm","prompt"],ve={alert:{closeOnPressEscape:!1,closeOnClickModal:!1},confirm:{showCancelButton:!0},prompt:{showCancelButton:!0,showInput:!0}};pe.forEach(e=>{E[e]=ge(e)});function ge(e){return(t,l,c,a)=>{let s="";return i.isObject(l)?(c=l,s=""):i.isUndefined(l)?s="":s=l,E(Object.assign({title:s,message:t,type:"",...ve[e]},c,{boxType:e}),a)}}E.close=()=>{S.forEach((e,t)=>{t.doClose()}),S.clear()};E._context=null;const y=E;y.install=e=>{y._context=e._context,e.config.globalProperties.$msgbox=y,e.config.globalProperties.$messageBox=y,e.config.globalProperties.$alert=y.alert,e.config.globalProperties.$confirm=y.confirm,e.config.globalProperties.$prompt=y.prompt};const Ce=y;exports.ElMessageBox=Ce;exports.ElText=se;
|