officialblock 1.0.8 → 1.1.0
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/dist/official-block.cjs.js +1 -1
- package/dist/official-block.es.js +55 -23
- package/dist/official-block.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/icon-email.svg +3 -0
- package/src/components/ArticleList/setting.vue +316 -142
- package/src/components/BannerImageWithLink/index.ts +11 -0
- package/src/components/BannerImageWithLink/index.vue +323 -0
- package/src/components/BannerImageWithLink/setting.vue +344 -0
- package/src/components/BannerImageWithLink/type.ts +17 -0
- package/src/components/ContactUsList/index.ts +11 -0
- package/src/components/ContactUsList/index.vue +369 -0
- package/src/components/ContactUsList/setting.vue +497 -0
- package/src/components/ContactUsList/type.ts +17 -0
- package/src/components/CountDown/index.ts +11 -0
- package/src/components/CountDown/index.vue +315 -0
- package/src/components/CountDown/setting.vue +302 -0
- package/src/components/CountDown/type.ts +17 -0
- package/src/components/CustomIframe/index.ts +11 -0
- package/src/components/CustomIframe/index.vue +118 -0
- package/src/components/CustomIframe/setting.vue +323 -0
- package/src/components/CustomIframe/type.ts +17 -0
- package/src/components/Operate/index.vue +1 -2
- package/src/components/QuoteText/index.vue +4 -4
- package/src/components/ScrollKeyInfo/index.ts +11 -0
- package/src/components/ScrollKeyInfo/index.vue +1345 -0
- package/src/components/ScrollKeyInfo/setting.vue +302 -0
- package/src/components/ScrollKeyInfo/type.ts +17 -0
- package/src/components/TabDefault/components/ComponentSelector/compsData.js +143 -0
- package/src/components/TabDefault/components/ComponentSelector/index.vue +188 -0
- package/src/components/TabDefault/components/PageContent.vue +207 -0
- package/src/components/TabDefault/index.vue +475 -0
- package/src/components/TabDefault/setting.vue +581 -0
- package/src/components/TabDefault/type.ts +17 -0
- package/src/components/TableTwo/index.ts +11 -0
- package/src/components/TableTwo/index.vue +232 -0
- package/src/components/TableTwo/setting.vue +558 -0
- package/src/components/TableTwo/type.ts +17 -0
- package/src/components/index.ts +17 -0
- package/src/styles/component-isolation.scss +2 -1
- package/src/views/components/ArticleListDemo.vue +50 -49
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-drawer
|
|
3
|
+
:width="500"
|
|
4
|
+
:visible="show"
|
|
5
|
+
:footer="false"
|
|
6
|
+
@cancel="handleCancel"
|
|
7
|
+
unmountOnClose
|
|
8
|
+
>
|
|
9
|
+
<template #title> {{ data?.type }}组件编辑 </template>
|
|
10
|
+
<div class="seting-box">
|
|
11
|
+
<p class="item-title">标题</p>
|
|
12
|
+
<a-input v-model="data.title" placeholder="请输入标题" allow-clear />
|
|
13
|
+
|
|
14
|
+
<p class="item-title mt-2">内容</p>
|
|
15
|
+
<RichTextEditor v-model="data.content"></RichTextEditor>
|
|
16
|
+
<p class="item-title">图片</p>
|
|
17
|
+
<img class="item-img" :src="paragraph.imgSrc" />
|
|
18
|
+
<div class="item-uplaod flex items-center">
|
|
19
|
+
<a-input
|
|
20
|
+
v-model="paragraph.imgSrc"
|
|
21
|
+
placeholder="请输入图片链接"
|
|
22
|
+
allow-clear
|
|
23
|
+
/>
|
|
24
|
+
<a-upload class="fit-content" :show-file-list="false" action="/" />
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</a-drawer>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script lang="ts" setup>
|
|
31
|
+
import { ref, computed } from "vue";
|
|
32
|
+
import RichTextEditor from "@/components/RichTextEditor";
|
|
33
|
+
import { randomString } from "@/utils/common";
|
|
34
|
+
|
|
35
|
+
const props = defineProps({
|
|
36
|
+
show: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false,
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
data: {
|
|
42
|
+
type: Object,
|
|
43
|
+
default: () => {},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const emit = defineEmits(["update:show"]);
|
|
48
|
+
|
|
49
|
+
const paragraph = ref({
|
|
50
|
+
title: "",
|
|
51
|
+
content: "",
|
|
52
|
+
imgSrc:
|
|
53
|
+
"https://osswebsite.ycyw.com/media-library/ywies-bj/images/home/ywies-tx.jpg",
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const handleCancel = () => {
|
|
57
|
+
emit("update:show", false);
|
|
58
|
+
};
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<style lang="scss" scoped>
|
|
62
|
+
.item-img {
|
|
63
|
+
height: 100px;
|
|
64
|
+
}
|
|
65
|
+
.seting-box {
|
|
66
|
+
padding: 20px;
|
|
67
|
+
background: #f0f2f5;
|
|
68
|
+
border-radius: 3px;
|
|
69
|
+
.arco-input-wrapper {
|
|
70
|
+
background: #ffffff;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
.setting-content {
|
|
74
|
+
.setting-header {
|
|
75
|
+
padding-bottom: 12px;
|
|
76
|
+
|
|
77
|
+
.header-title {
|
|
78
|
+
width: 120px;
|
|
79
|
+
padding-right: 12px;
|
|
80
|
+
text-align: right;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.setting-body {
|
|
85
|
+
margin-top: 12px;
|
|
86
|
+
|
|
87
|
+
.setting-item {
|
|
88
|
+
position: relative;
|
|
89
|
+
padding: 16px 12px;
|
|
90
|
+
background: #f0f2f5;
|
|
91
|
+
border-radius: 8px;
|
|
92
|
+
margin-bottom: 20px;
|
|
93
|
+
|
|
94
|
+
.btn-group {
|
|
95
|
+
position: absolute;
|
|
96
|
+
right: 0;
|
|
97
|
+
top: 0;
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
padding: 4px;
|
|
101
|
+
|
|
102
|
+
.btn-delete {
|
|
103
|
+
padding: 4px;
|
|
104
|
+
font-size: 24px;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.item-name {
|
|
110
|
+
font-size: 16px;
|
|
111
|
+
font-weight: 600;
|
|
112
|
+
padding-bottom: 10px;
|
|
113
|
+
border-bottom: 1px solid #fff;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.item-title {
|
|
117
|
+
padding: 12px 0 8px 0;
|
|
118
|
+
font-size: 14px;
|
|
119
|
+
font-weight: 600;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.arco-input-wrapper {
|
|
123
|
+
background: #fff;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.item-button {
|
|
127
|
+
position: relative;
|
|
128
|
+
padding: 12px 8px 4px;
|
|
129
|
+
background: #fff;
|
|
130
|
+
border-radius: 4px;
|
|
131
|
+
margin: 4px 0;
|
|
132
|
+
transition: all 0.3s ease;
|
|
133
|
+
|
|
134
|
+
&.draggable-item {
|
|
135
|
+
cursor: move;
|
|
136
|
+
|
|
137
|
+
&:hover {
|
|
138
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
139
|
+
transform: translateY(-1px);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 当禁用拖拽时,不显示拖拽效果
|
|
143
|
+
&.sortable-disabled {
|
|
144
|
+
cursor: default;
|
|
145
|
+
|
|
146
|
+
&:hover {
|
|
147
|
+
box-shadow: none;
|
|
148
|
+
transform: none;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.arco-input-wrapper {
|
|
154
|
+
background: #f2f3f5;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 拖拽相关样式
|
|
159
|
+
.flip-list-move {
|
|
160
|
+
transition: transform 0.5s;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.no-move {
|
|
164
|
+
transition: transform 0s;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.ghost {
|
|
168
|
+
opacity: 0.5;
|
|
169
|
+
background: #c8ebfb;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.list-group {
|
|
173
|
+
min-height: 20px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.list-group-item {
|
|
177
|
+
cursor: move;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.list-group-item i {
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.item-action {
|
|
185
|
+
padding: 10px 0;
|
|
186
|
+
|
|
187
|
+
.action-text {
|
|
188
|
+
width: 150px;
|
|
189
|
+
margin-right: 8px;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.item-add-btn {
|
|
194
|
+
display: inline-block;
|
|
195
|
+
padding: 2px 8px;
|
|
196
|
+
margin-top: 5px;
|
|
197
|
+
font-size: 11px;
|
|
198
|
+
color: #165dff;
|
|
199
|
+
border-radius: 4px;
|
|
200
|
+
font-weight: 600;
|
|
201
|
+
border: 1px solid #165dff;
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.item-img {
|
|
206
|
+
margin-top: 12px;
|
|
207
|
+
height: 160px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.fit-content {
|
|
211
|
+
width: fit-content;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.item-img-list {
|
|
215
|
+
.img-list-item {
|
|
216
|
+
margin: 4px 0;
|
|
217
|
+
position: relative;
|
|
218
|
+
padding: 8px;
|
|
219
|
+
border-radius: 4px;
|
|
220
|
+
transition: all 0.3s ease;
|
|
221
|
+
background: #fff;
|
|
222
|
+
border-radius: 4px;
|
|
223
|
+
|
|
224
|
+
&.draggable-item {
|
|
225
|
+
cursor: move;
|
|
226
|
+
|
|
227
|
+
&:hover {
|
|
228
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
229
|
+
transform: translateY(-1px);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// 当禁用拖拽时,不显示拖拽效果
|
|
233
|
+
&.sortable-disabled {
|
|
234
|
+
cursor: default;
|
|
235
|
+
|
|
236
|
+
&:hover {
|
|
237
|
+
box-shadow: none;
|
|
238
|
+
transform: none;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.arco-input-wrapper {
|
|
244
|
+
background: #f2f3f5;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.img-drag-handle {
|
|
248
|
+
top: 0 !important;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.item-img-box {
|
|
253
|
+
margin-right: 12px;
|
|
254
|
+
position: relative;
|
|
255
|
+
width: 133px;
|
|
256
|
+
height: 100px;
|
|
257
|
+
|
|
258
|
+
.item-img-dlete {
|
|
259
|
+
position: absolute;
|
|
260
|
+
padding: 8px;
|
|
261
|
+
font-size: 32px;
|
|
262
|
+
top: -16px;
|
|
263
|
+
right: -16px;
|
|
264
|
+
color: red;
|
|
265
|
+
cursor: pointer;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.small-img {
|
|
270
|
+
margin: 0;
|
|
271
|
+
height: 100px;
|
|
272
|
+
object-fit: cover;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.item-right {
|
|
276
|
+
padding-top: 24px;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.drag-handle {
|
|
283
|
+
padding: 4px;
|
|
284
|
+
cursor: grab;
|
|
285
|
+
padding: 4px;
|
|
286
|
+
border-radius: 4px;
|
|
287
|
+
|
|
288
|
+
&:hover {
|
|
289
|
+
background-color: #f0f2f5;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
&:active {
|
|
293
|
+
cursor: grabbing;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.drag-icon {
|
|
297
|
+
font-size: 16px;
|
|
298
|
+
color: #86909c;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ScrollKeyInfoProps {
|
|
2
|
+
/** 双向绑定的值 */
|
|
3
|
+
modelValue: any
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface ScrollKeyInfoEmits {
|
|
7
|
+
(e: 'update:modelValue', value: any): void
|
|
8
|
+
(e: 'handleDelete', value: string | number): void
|
|
9
|
+
(e: 'handleCopy', value: any): void
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// export type ComponentSlots = {
|
|
13
|
+
// /** 默认插槽内容 */
|
|
14
|
+
// default?: (props: { value: string | number }) => VNode[]
|
|
15
|
+
// /** 头部内容 */
|
|
16
|
+
// header?: (props: { title: string }) => VNode[]
|
|
17
|
+
// }
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export const compJsonData = [
|
|
2
|
+
{
|
|
3
|
+
label: "Common",
|
|
4
|
+
key: "common",
|
|
5
|
+
image: "",
|
|
6
|
+
children: [
|
|
7
|
+
{ label: "CustomSpace", key: "custom_space", image: "" },
|
|
8
|
+
{ label: "CustomText", key: "custom_text", image: "" },
|
|
9
|
+
{ label: "QuoteText", key: "quote_text", image: "" },
|
|
10
|
+
{ label: "ArticleList", key: "article_list", image: "" },
|
|
11
|
+
{ label: "ArticleListPureText", key: "article_list_pure_text", image: "" },
|
|
12
|
+
{ label: "Shared Component", key: "shared_component", image: "" },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "Media",
|
|
17
|
+
key: "media",
|
|
18
|
+
image: "",
|
|
19
|
+
children: [
|
|
20
|
+
{ label: "MedialmageFull", key: "media_image_full", image: "" },
|
|
21
|
+
{ label: "MedialmageStatic", key: "media_image_static", image: "" },
|
|
22
|
+
{ label: "MediaVideo", key: "media_video", image: "" },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "Links",
|
|
27
|
+
key: "links",
|
|
28
|
+
image: "",
|
|
29
|
+
children: [
|
|
30
|
+
{ label: "BtnList", key: "btn_list", image: "" },
|
|
31
|
+
{ label: "LinkList", key: "link_list", image: "" },
|
|
32
|
+
{ label: "DonorLinks", key: "donor_links", image: "" },
|
|
33
|
+
{ label: "GridLinks", key: "grid_links", image: "" },
|
|
34
|
+
{ label: "DetailLink", key: "detail_link", image: "" },
|
|
35
|
+
{ label: "InformationLink", key: "information_link", image: "" },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "Headers",
|
|
40
|
+
key: "headers",
|
|
41
|
+
image: "",
|
|
42
|
+
children: [
|
|
43
|
+
{ label: "BannerPage", key: "banner_page", image: "" },
|
|
44
|
+
{ label: "BannerImage", key: "banner_image", image: "" },
|
|
45
|
+
{ label: "MapStatic", key: "map_static", image: "" },
|
|
46
|
+
{ label: "VrTour", key: "vr_tour", image: "" },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: "Collections",
|
|
51
|
+
key: "collections",
|
|
52
|
+
image: "",
|
|
53
|
+
children: [
|
|
54
|
+
{ label: "HeroSlide", key: "hero_slide", image: "" },
|
|
55
|
+
{ label: "AccordionText", key: "accordion_text", image: "" },
|
|
56
|
+
{ label: "CardCarousel (Profiles)", key: "card_carousel_profiles", image: "" },
|
|
57
|
+
{ label: "CardCarouselMultiRow (Profiles)", key: "card_carousel_multi_row_profiles", image: "" },
|
|
58
|
+
{ label: "CardList (Circle)", key: "card_list_circle", image: "" },
|
|
59
|
+
{ label: "CardList (Programme)", key: "card_list_programme", image: "" },
|
|
60
|
+
{ label: "CardList (School)", key: "card_list_school", image: "" },
|
|
61
|
+
{ label: "CardShowcaseProfile", key: "card_showcase_profile", image: "" },
|
|
62
|
+
{ label: "CarouselLogo", key: "carousel_logo", image: "" },
|
|
63
|
+
{ label: "Resources", key: "resources", image: "" },
|
|
64
|
+
{ label: "ResourcesTwo", key: "resources_two", image: "" },
|
|
65
|
+
{ label: "Process", key: "process", image: "" },
|
|
66
|
+
{ label: "TableTwo", key: "table_two", image: "" },
|
|
67
|
+
{ label: "GalleryList (Default)", key: "gallery_list_default", image: "" },
|
|
68
|
+
{ label: "GalleryList (Caption)", key: "gallery_list_caption", image: "" },
|
|
69
|
+
{ label: "GalleryList (Caption - Round)", key: "gallery_list_caption_round", image: "" },
|
|
70
|
+
{ label: "GalleryList (Timeline - One Column)", key: "gallery_list_timeline_one_column", image: "" },
|
|
71
|
+
{ label: "GalleryList (Timeline - Two Columns)", key: "gallery_list_timeline_two_columns", image: "" },
|
|
72
|
+
{ label: "TabDefault", key: "tab_default", image: "" },
|
|
73
|
+
{ label: "TabTimeline", key: "tab_timeline", image: "" },
|
|
74
|
+
{ label: "Disc", key: "disc", image: "" },
|
|
75
|
+
{ label: "BasicCollapse", key: "basic_collapse", image: "" },
|
|
76
|
+
{ label: "TableCollapse", key: "table_collapse", image: "" },
|
|
77
|
+
{ label: "MediaLogo", key: "media_logo", image: "" },
|
|
78
|
+
{ label: "CollapseCustom", key: "collapse_custom", image: "" },
|
|
79
|
+
{ label: "ScrollKeyInfo", key: "scroll_key_info", image: "" },
|
|
80
|
+
{ label: "CardCarouselMultiRow (Articles)", key: "card_carousel_multi_row_articles", image: "" },
|
|
81
|
+
{ label: "Publications", key: "publications", image: "" },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: "Contact Information",
|
|
86
|
+
key: "contact_information",
|
|
87
|
+
image: "",
|
|
88
|
+
children: [
|
|
89
|
+
{ label: "ContactUsInfo", key: "contact_us_info", image: "" },
|
|
90
|
+
{ label: "ContactUsList", key: "contact_us_list", image: "" },
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: "Sections",
|
|
95
|
+
key: "sections",
|
|
96
|
+
image: "",
|
|
97
|
+
children: [
|
|
98
|
+
{ label: "Sections (Pages, updating URL)", key: "sections_pages_updating_url", image: "" },
|
|
99
|
+
{ label: "Sections (Logos, not updating URL)", key: "sections_logos_not_updating_url", image: "" },
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: "Others",
|
|
104
|
+
key: "others",
|
|
105
|
+
image: "",
|
|
106
|
+
children: [
|
|
107
|
+
{ label: "Articleitem", key: "article_item", image: "" },
|
|
108
|
+
{ label: "CountDown", key: "count_down", image: "" },
|
|
109
|
+
{ label: "Customlframe", key: "custom_iframe", image: "" },
|
|
110
|
+
{ label: "TheHistoryCarousel", key: "the_history_carousel", image: "" },
|
|
111
|
+
{ label: "TimelineStory", key: "timeline_story", image: "" },
|
|
112
|
+
{ label: "RegisterForm (Event)", key: "register_form_event", image: "" },
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: "YCYW 90th",
|
|
117
|
+
key: "ycyw_90th",
|
|
118
|
+
image: "",
|
|
119
|
+
children: [
|
|
120
|
+
{ label: "BackgroundWrapper", key: "background_wrapper", image: "" },
|
|
121
|
+
{ label: "BannerQuote", key: "banner_quote", image: "" },
|
|
122
|
+
{ label: "BannerlmageWithLink", key: "banner_image_with_link", image: "" },
|
|
123
|
+
{ label: "BlessingMessage", key: "blessing_message", image: "" },
|
|
124
|
+
{ label: "BlessingSlider", key: "blessing_slider", image: "" },
|
|
125
|
+
{ label: "GalleryBlock", key: "gallery_block", image: "" },
|
|
126
|
+
{ label: "RibbonBlock", key: "ribbon_block", image: "" },
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: "API-related Components",
|
|
131
|
+
key: "api_related_components",
|
|
132
|
+
image: "",
|
|
133
|
+
children: [
|
|
134
|
+
{ label: "NewsList", key: "news_list", image: "" },
|
|
135
|
+
{ label: "ExploreLinks", key: "explore_links", image: "" },
|
|
136
|
+
{ label: "CardShowcase", key: "card_showcase", image: "" },
|
|
137
|
+
{ label: "CardCarousel (Articles)", key: "card_carousel_articles", image: "" },
|
|
138
|
+
{ label: "CardCarouselMultiRow (Publications)", key: "card_carousel_multi_row_publications", image: "" },
|
|
139
|
+
{ label: "Alumni Community List", key: "alumni_community_list", image: "" },
|
|
140
|
+
{ label: "School Layout", key: "school_layout", image: "" },
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
];
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-modal v-model:visible="visible" title="添加组件" width="90%" :footer="false">
|
|
3
|
+
<a-layout class="component-library-container" style="display: flex">
|
|
4
|
+
<!-- 左侧导航栏 -->
|
|
5
|
+
<a-layout-sider :width="240" :style="{ background: '#fff', boxShadow: '0 2px 8px rgba(0, 0, 0, 0.08)' }">
|
|
6
|
+
<div class="search-box">
|
|
7
|
+
<a-input-search placeholder="Search components..." />
|
|
8
|
+
</div>
|
|
9
|
+
<a-menu v-model:selected-keys="selectedKeys" :style="{ height: '100%', borderRight: 0 }">
|
|
10
|
+
<a-menu-item v-for="item in menuData" :key="item.key">
|
|
11
|
+
{{ item.label }}
|
|
12
|
+
</a-menu-item>
|
|
13
|
+
</a-menu>
|
|
14
|
+
</a-layout-sider>
|
|
15
|
+
|
|
16
|
+
<!-- 右侧内容区 -->
|
|
17
|
+
<a-layout-content :style="{ padding: '24px 40px 24px 24px', background: '#f5f5f5' }">
|
|
18
|
+
<div class="component-section">
|
|
19
|
+
<h2 class="section-title">{{ currentSection.label }}</h2>
|
|
20
|
+
<p class="section-description">{{ currentSection.description }}</p>
|
|
21
|
+
|
|
22
|
+
<div class="component-grid">
|
|
23
|
+
<div
|
|
24
|
+
v-for="(component, index) in currentComponents"
|
|
25
|
+
:key="index"
|
|
26
|
+
class="component-card"
|
|
27
|
+
@click="selectComponent(component)"
|
|
28
|
+
>
|
|
29
|
+
<div class="thumbnail-placeholder">
|
|
30
|
+
<!-- 这里应该是实际缩略图,示例使用占位色块 -->
|
|
31
|
+
<div class="thumbnail-color" :style="{ backgroundColor: getRandomColor() }">
|
|
32
|
+
<!-- <component :is="getComponetnBytype(component.label)" v-model:model-value="componentValues[component.label]" /> -->
|
|
33
|
+
<!-- <ArticleList v-model:model-value="test" /> -->
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="component-name">{{ component.label }}</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</a-layout-content>
|
|
41
|
+
</a-layout>
|
|
42
|
+
<!-- <ArticleList v-model:model-value="test" /> -->
|
|
43
|
+
</a-modal>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup>
|
|
47
|
+
import { reactive, ref, computed, watch } from "vue"; // 添加 reactive 导入
|
|
48
|
+
|
|
49
|
+
// import * as allPageComponents from "officialblock";
|
|
50
|
+
import { compJsonData } from "./compsData";
|
|
51
|
+
import { randomString } from "@/utils/common";
|
|
52
|
+
|
|
53
|
+
// 接收 props
|
|
54
|
+
const props = defineProps({
|
|
55
|
+
visible: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// 定义事件
|
|
62
|
+
const emit = defineEmits(["update:visible", "ok", "cancel"]);
|
|
63
|
+
|
|
64
|
+
// 初始化组件映射
|
|
65
|
+
// const componentMap = allPageComponents;
|
|
66
|
+
|
|
67
|
+
// 响应式数据
|
|
68
|
+
const componentValues = reactive({});
|
|
69
|
+
const selectedKeys = ref(["common"]);
|
|
70
|
+
const menuData = ref(compJsonData);
|
|
71
|
+
const currentSection = ref({});
|
|
72
|
+
const currentComponents = computed(() => currentSection.value.children || []);
|
|
73
|
+
|
|
74
|
+
// 初始化 componentValues
|
|
75
|
+
watch(
|
|
76
|
+
currentComponents,
|
|
77
|
+
(newComponents) => {
|
|
78
|
+
newComponents.forEach((comp) => {
|
|
79
|
+
if (!componentValues[comp.label]) {
|
|
80
|
+
componentValues[comp.label] = null;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
{ immediate: true }
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// 监听菜单选择
|
|
88
|
+
watch(
|
|
89
|
+
selectedKeys,
|
|
90
|
+
(newValue) => {
|
|
91
|
+
currentSection.value = menuData.value.find((item) => item.key === newValue[0]) || {};
|
|
92
|
+
},
|
|
93
|
+
{ immediate: true }
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// 获取组件方法
|
|
97
|
+
|
|
98
|
+
// 选择组件
|
|
99
|
+
const selectComponent = (comp) => {
|
|
100
|
+
debugger;
|
|
101
|
+
// emit('ok', JSON.parse(JSON.stringify(componentValues[val])))
|
|
102
|
+
emit("ok", JSON.parse(JSON.stringify({ type: comp.label, id: randomString() })));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// 同步 visible 状态
|
|
106
|
+
const visible = computed({
|
|
107
|
+
get: () => props.visible,
|
|
108
|
+
set: (val) => emit("update:visible", val),
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// 生成随机颜色用于缩略图占位
|
|
112
|
+
const getRandomColor = () => {
|
|
113
|
+
const colors = ["#3498db", "#2ecc71", "#e74c3c", "#f1c40f", "#9b59b6", "#1abc9c"];
|
|
114
|
+
return colors[Math.floor(Math.random() * colors.length)];
|
|
115
|
+
};
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<style lang="scss" scoped>
|
|
119
|
+
.component-library-container {
|
|
120
|
+
height: 80vh;
|
|
121
|
+
background: #f5f5f5;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.search-box {
|
|
125
|
+
padding: 16px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.component-section {
|
|
129
|
+
max-width: 1200px;
|
|
130
|
+
margin: 0 auto;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.section-title {
|
|
134
|
+
font-size: 24px;
|
|
135
|
+
margin-bottom: 8px;
|
|
136
|
+
color: #1d2129;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.section-description {
|
|
140
|
+
color: #666;
|
|
141
|
+
margin-bottom: 24px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.component-grid {
|
|
145
|
+
display: grid;
|
|
146
|
+
grid-template-columns: repeat(3, 1fr);
|
|
147
|
+
gap: 24px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.component-card {
|
|
151
|
+
background: #fff;
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
border-radius: 8px;
|
|
154
|
+
overflow: hidden;
|
|
155
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
156
|
+
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
|
|
157
|
+
position: relative;
|
|
158
|
+
z-index: 1;
|
|
159
|
+
/* 直接集成悬停效果 */
|
|
160
|
+
&:hover {
|
|
161
|
+
transform: scale(1.2);
|
|
162
|
+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
|
|
163
|
+
z-index: 2;
|
|
164
|
+
.thumbnail-placeholder {
|
|
165
|
+
transform: translateZ(20px);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.thumbnail-placeholder {
|
|
171
|
+
height: 180px;
|
|
172
|
+
position: relative;
|
|
173
|
+
overflow: hidden;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.thumbnail-color {
|
|
177
|
+
width: 100%;
|
|
178
|
+
height: 100%;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.component-name {
|
|
182
|
+
padding: 16px;
|
|
183
|
+
text-align: center;
|
|
184
|
+
font-weight: 500;
|
|
185
|
+
color: #333;
|
|
186
|
+
border-top: 1px solid #eee;
|
|
187
|
+
}
|
|
188
|
+
</style>
|