Skip to content

Commit d76dfa0

Browse files
author
Taois
committed
feat:优化使用帮助组件
1 parent 30febd4 commit d76dfa0

File tree

1 file changed

+197
-49
lines changed

1 file changed

+197
-49
lines changed

dashboard/src/components/actions/HelpAction.vue

Lines changed: 197 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,32 @@
3030
></div>
3131
</div>
3232

33+
<!-- 数据键值对 -->
34+
<div v-if="config.data && dataList.length > 0" class="help-data-modern">
35+
<div class="section-header">
36+
<div class="section-icon">
37+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
38+
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
39+
<polyline points="14,2 14,8 20,8"/>
40+
<line x1="16" y1="13" x2="8" y2="13"/>
41+
<line x1="16" y1="17" x2="8" y2="17"/>
42+
<polyline points="10,9 9,9 8,9"/>
43+
</svg>
44+
</div>
45+
<h3 class="section-title">帮助信息</h3>
46+
</div>
47+
<div class="data-content-modern">
48+
<div
49+
v-for="(item, index) in dataList"
50+
:key="index"
51+
class="data-item glass-effect"
52+
>
53+
<div class="data-title-modern">{{ item.key }}</div>
54+
<div class="data-text-modern" v-html="formatDataText(item.value)"></div>
55+
</div>
56+
</div>
57+
</div>
58+
3359
<!-- 图片 -->
3460
<div v-if="config.img" class="help-image-modern">
3561
<div class="image-container glass-effect">
@@ -467,7 +493,32 @@ export default {
467493
return []
468494
})
469495
496+
const dataList = computed(() => {
497+
if (!props.config.data || typeof props.config.data !== 'object') return []
498+
499+
return Object.entries(props.config.data).map(([key, value]) => ({
500+
key,
501+
value
502+
}))
503+
})
504+
470505
// 方法
506+
const formatDataText = (text) => {
507+
if (!text) return ''
508+
509+
// 如果文本已经包含HTML标签,直接返回
510+
if (/<[^>]+>/.test(text)) {
511+
return text
512+
}
513+
514+
// 否则支持简单的 Markdown 格式转换和换行
515+
return String(text)
516+
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
517+
.replace(/\*(.*?)\*/g, '<em>$1</em>')
518+
.replace(/`(.*?)`/g, '<code>$1</code>')
519+
.replace(/\n/g, '<br>')
520+
}
521+
471522
const onImageLoad = () => {
472523
imageError.value = false
473524
}
@@ -609,6 +660,8 @@ export default {
609660
stepsList,
610661
faqList,
611662
linksList,
663+
dataList,
664+
formatDataText,
612665
onImageLoad,
613666
onImageError,
614667
onQrLoad,
@@ -637,9 +690,9 @@ export default {
637690
.help-content-modern {
638691
display: flex;
639692
flex-direction: column;
640-
gap: 24px;
693+
gap: 12px;
641694
padding: 24px;
642-
max-height: calc(85vh - 80px);
695+
max-height: 60vh;
643696
overflow-y: auto;
644697
}
645698
@@ -653,32 +706,41 @@ export default {
653706
654707
/* 消息区域 */
655708
.help-message-modern {
656-
padding: 24px;
657-
border-radius: 16px;
709+
padding: 16px;
710+
border-radius: 12px;
658711
font-size: 16px;
659712
line-height: 1.7;
660713
color: #2d3748;
661714
white-space: pre-wrap;
662-
background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
715+
background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
716+
backdrop-filter: blur(10px);
717+
border: 1px solid rgba(255, 255, 255, 0.2);
718+
border-left: 4px solid #3182ce;
663719
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
664720
transition: all 0.3s ease;
721+
margin-bottom: 8px;
722+
display: flex;
723+
align-items: flex-start;
724+
gap: 8px;
665725
}
666726
667727
.help-message-modern:hover {
668-
transform: translateY(-2px);
669-
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
728+
transform: translateY(-1px);
729+
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
670730
}
671731
672732
.message-icon {
673-
width: 24px;
674-
height: 24px;
675-
color: #4299e1;
676-
margin-bottom: 12px;
733+
width: 20px;
734+
height: 20px;
735+
color: #3182ce;
736+
flex-shrink: 0;
677737
}
678738
679739
.message-text-modern {
680-
line-height: 1.6;
740+
flex: 1;
741+
line-height: 1.5;
681742
color: #2d3748;
743+
font-size: 14px;
682744
}
683745
684746
/* 图片区域 */
@@ -800,24 +862,33 @@ export default {
800862
}
801863
802864
/* 通用区域样式 */
865+
.help-image-modern,
866+
.help-qrcode-modern,
803867
.help-details-modern,
804868
.help-steps-modern,
805869
.help-faq-modern,
806870
.help-links-modern,
807-
.help-contact-modern {
808-
padding: 24px;
809-
border-radius: 16px;
871+
.help-contact-modern,
872+
.help-data-modern {
873+
padding: 16px;
874+
border-radius: 12px;
875+
background: rgba(255, 255, 255, 0.95);
876+
backdrop-filter: blur(10px);
877+
border: 1px solid rgba(255, 255, 255, 0.2);
810878
transition: all 0.3s ease;
811-
margin-bottom: 16px;
879+
margin-bottom: 8px;
812880
}
813881
882+
.help-image-modern:hover,
883+
.help-qrcode-modern:hover,
814884
.help-details-modern:hover,
815885
.help-steps-modern:hover,
816886
.help-faq-modern:hover,
817887
.help-links-modern:hover,
818-
.help-contact-modern:hover {
819-
transform: translateY(-2px);
820-
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
888+
.help-contact-modern:hover,
889+
.help-data-modern:hover {
890+
transform: translateY(-1px);
891+
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
821892
}
822893
823894
.help-details-modern {
@@ -840,30 +911,38 @@ export default {
840911
border-left: 4px solid #9f7aea;
841912
}
842913
914+
.help-data-modern {
915+
background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
916+
border-left: 4px solid #4299e1;
917+
}
918+
843919
/* 通用区域标题 */
844920
.section-header {
845921
display: flex;
846922
align-items: center;
847-
gap: 12px;
848-
margin-bottom: 20px;
923+
gap: 8px;
924+
margin-bottom: 12px;
925+
padding-bottom: 8px;
926+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
849927
}
850928
851929
.section-icon {
852-
width: 24px;
853-
height: 24px;
930+
width: 20px;
931+
height: 20px;
854932
color: #4299e1;
855933
flex-shrink: 0;
856934
}
857935
936+
.section-icon svg {
937+
width: 100%;
938+
height: 100%;
939+
}
940+
858941
.section-title {
859-
margin: 0;
860-
color: #2d3748;
861-
font-size: 18px;
942+
font-size: 16px;
862943
font-weight: 600;
863-
background: linear-gradient(135deg, #4299e1, #667eea);
864-
-webkit-background-clip: text;
865-
-webkit-text-fill-color: transparent;
866-
background-clip: text;
944+
color: #2d3748;
945+
margin: 0;
867946
}
868947
869948
/* 详细信息内容 */
@@ -897,6 +976,40 @@ export default {
897976
color: #4a5568;
898977
}
899978
979+
/* 数据键值对内容 */
980+
.data-content-modern {
981+
display: flex;
982+
flex-direction: column;
983+
gap: 8px;
984+
}
985+
986+
.data-item {
987+
padding: 12px 16px;
988+
border-radius: 8px;
989+
background: rgba(255, 255, 255, 0.8);
990+
transition: all 0.3s ease;
991+
border: 1px solid rgba(0, 0, 0, 0.05);
992+
}
993+
994+
.data-item:hover {
995+
transform: translateY(-1px);
996+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
997+
background: rgba(255, 255, 255, 0.95);
998+
}
999+
1000+
.data-title-modern {
1001+
font-weight: 500;
1002+
margin-bottom: 6px;
1003+
color: #2d3748;
1004+
font-size: 14px;
1005+
}
1006+
1007+
.data-text-modern {
1008+
line-height: 1.5;
1009+
color: #4a5568;
1010+
font-size: 14px;
1011+
}
1012+
9001013
/* 步骤内容 */
9011014
.steps-content-modern {
9021015
display: flex;
@@ -1162,20 +1275,21 @@ export default {
11621275
.help-timeout-modern {
11631276
display: flex;
11641277
align-items: center;
1165-
justify-content: center;
1166-
gap: 12px;
1167-
padding: 16px 24px;
1168-
border-radius: 12px;
1169-
background: linear-gradient(135deg, rgba(255, 193, 7, 0.9) 0%, rgba(255, 152, 0, 0.9) 100%);
1170-
color: #744210;
1171-
font-weight: 500;
1172-
margin-top: 24px;
1278+
gap: 8px;
1279+
padding: 12px 16px;
1280+
background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
1281+
border-radius: 8px;
1282+
margin-top: 12px;
1283+
border-left: 4px solid #e53e3e;
1284+
font-size: 14px;
1285+
color: #742a2a;
11731286
animation: pulse 2s infinite;
11741287
}
11751288
11761289
.timeout-icon {
1177-
width: 20px;
1178-
height: 20px;
1290+
width: 18px;
1291+
height: 18px;
1292+
color: #e53e3e;
11791293
flex-shrink: 0;
11801294
}
11811295
@@ -1326,17 +1440,29 @@ export default {
13261440
13271441
.help-content-modern {
13281442
padding: 16px;
1329-
gap: 16px;
1443+
gap: 8px;
13301444
max-height: calc(90vh - 70px);
13311445
}
13321446
13331447
.help-message-modern,
1448+
.help-image-modern,
1449+
.help-qrcode-modern,
13341450
.help-details-modern,
13351451
.help-steps-modern,
13361452
.help-faq-modern,
13371453
.help-links-modern,
1338-
.help-contact-modern {
1339-
padding: 16px;
1454+
.help-contact-modern,
1455+
.help-data-modern {
1456+
padding: 12px;
1457+
margin-bottom: 6px;
1458+
}
1459+
1460+
.section-header {
1461+
margin-bottom: 8px;
1462+
}
1463+
1464+
.section-title {
1465+
font-size: 14px;
13401466
}
13411467
13421468
.step-card {
@@ -1390,28 +1516,50 @@ export default {
13901516
border: 1px solid rgba(255, 255, 255, 0.1);
13911517
}
13921518
1393-
.help-message-modern,
1519+
.help-message-modern {
1520+
background: linear-gradient(135deg, rgba(45, 55, 72, 0.95) 0%, rgba(26, 32, 44, 0.95) 100%);
1521+
border-color: rgba(255, 255, 255, 0.1);
1522+
}
1523+
1524+
.help-image-modern,
1525+
.help-qrcode-modern,
13941526
.help-details-modern,
13951527
.help-steps-modern,
13961528
.help-faq-modern,
13971529
.help-links-modern,
13981530
.help-contact-modern {
1399-
background: linear-gradient(135deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 100%);
1400-
color: #e2e8f0;
1531+
background: rgba(45, 55, 72, 0.95);
1532+
border-color: rgba(255, 255, 255, 0.1);
1533+
}
1534+
1535+
.help-data-modern {
1536+
background: linear-gradient(135deg, rgba(45, 55, 72, 0.95) 0%, rgba(26, 32, 44, 0.95) 100%);
1537+
border-color: rgba(255, 255, 255, 0.1);
1538+
}
1539+
1540+
.data-item {
1541+
background: rgba(26, 32, 44, 0.8);
1542+
border-color: rgba(255, 255, 255, 0.05);
1543+
}
1544+
1545+
.data-item:hover {
1546+
background: rgba(26, 32, 44, 0.95);
14011547
}
14021548
14031549
.section-title,
14041550
.question-text-modern,
14051551
.link-text-modern,
1406-
.message-text-modern,
14071552
.detail-title-modern,
1408-
.step-title-modern {
1553+
.step-title-modern,
1554+
.data-title-modern {
14091555
color: #e2e8f0;
14101556
}
14111557
1558+
.message-text-modern,
14121559
.detail-text-modern,
14131560
.step-text-modern,
1414-
.answer-text-modern {
1561+
.answer-text-modern,
1562+
.data-text-modern {
14151563
color: #cbd5e0;
14161564
}
14171565
}

0 commit comments

Comments
 (0)