officialblock 1.0.8 → 1.0.9
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 +43 -11
- 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/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
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<a-drawer
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<a-drawer
|
|
3
|
+
:width="500"
|
|
4
|
+
:visible="show"
|
|
5
|
+
:footer="false"
|
|
6
|
+
@cancel="handleCancel"
|
|
7
|
+
unmountOnClose
|
|
8
|
+
>
|
|
9
|
+
<template #title> {{ data.type }}组件编辑 </template>
|
|
6
10
|
<div class="setting-content">
|
|
7
11
|
<!-- 组件自身属性 -->
|
|
8
12
|
<div class="setting-header flex items-center">
|
|
@@ -23,11 +27,21 @@
|
|
|
23
27
|
</div>
|
|
24
28
|
|
|
25
29
|
<a-button-group type="primary">
|
|
26
|
-
<a-button size="mini" @click="handleAdd('Article')"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<a-button size="mini" @click="handleAdd('
|
|
30
|
-
|
|
30
|
+
<a-button size="mini" @click="handleAdd('Article')"
|
|
31
|
+
><template #icon><icon-plus /></template> Article
|
|
32
|
+
</a-button>
|
|
33
|
+
<a-button size="mini" @click="handleAdd('Contact')"
|
|
34
|
+
><template #icon><icon-plus /></template> Contact
|
|
35
|
+
</a-button>
|
|
36
|
+
<a-button size="mini" @click="handleAdd('Image')"
|
|
37
|
+
><template #icon><icon-plus /></template> Image
|
|
38
|
+
</a-button>
|
|
39
|
+
<a-button size="mini" @click="handleAdd('ImageList')"
|
|
40
|
+
><template #icon><icon-plus /></template> ImageList
|
|
41
|
+
</a-button>
|
|
42
|
+
<a-button size="mini" @click="handleAdd('Video')"
|
|
43
|
+
><template #icon><icon-plus /></template> Video
|
|
44
|
+
</a-button>
|
|
31
45
|
</a-button-group>
|
|
32
46
|
|
|
33
47
|
<!-- 子组件属性 -->
|
|
@@ -37,7 +51,7 @@
|
|
|
37
51
|
:component-data="{
|
|
38
52
|
tag: 'div',
|
|
39
53
|
type: 'transition-group',
|
|
40
|
-
name: !drag ? 'flip-list' : null
|
|
54
|
+
name: !drag ? 'flip-list' : null,
|
|
41
55
|
}"
|
|
42
56
|
v-bind="dragOptions"
|
|
43
57
|
@start="drag = true"
|
|
@@ -51,12 +65,19 @@
|
|
|
51
65
|
<div class="drag-handle">
|
|
52
66
|
<icon-drag-arrow class="drag-icon" />
|
|
53
67
|
</div>
|
|
54
|
-
<icon-delete
|
|
68
|
+
<icon-delete
|
|
69
|
+
class="btn-delete"
|
|
70
|
+
@click="handleDelete(item.id)"
|
|
71
|
+
/>
|
|
55
72
|
</div>
|
|
56
73
|
|
|
57
74
|
<template v-if="item.type === 'Article'">
|
|
58
75
|
<p class="item-title">标题</p>
|
|
59
|
-
<a-input
|
|
76
|
+
<a-input
|
|
77
|
+
v-model="item.title"
|
|
78
|
+
placeholder="请输入标题"
|
|
79
|
+
allow-clear
|
|
80
|
+
/>
|
|
60
81
|
|
|
61
82
|
<p class="item-title">内容</p>
|
|
62
83
|
<RichTextEditor v-model="item.content"></RichTextEditor>
|
|
@@ -67,7 +88,7 @@
|
|
|
67
88
|
:component-data="{
|
|
68
89
|
tag: 'div',
|
|
69
90
|
type: 'transition-group',
|
|
70
|
-
name: !drag ? 'flip-list' : null
|
|
91
|
+
name: !drag ? 'flip-list' : null,
|
|
71
92
|
}"
|
|
72
93
|
v-bind="buttonDragOptions"
|
|
73
94
|
:disabled="!shouldShowDragHandle(item.buttonList)"
|
|
@@ -78,7 +99,11 @@
|
|
|
78
99
|
<template #item="{ element: button }">
|
|
79
100
|
<div
|
|
80
101
|
class="item-button draggable-item"
|
|
81
|
-
:class="{
|
|
102
|
+
:class="{
|
|
103
|
+
'sortable-disabled': !shouldShowDragHandle(
|
|
104
|
+
item.buttonList
|
|
105
|
+
),
|
|
106
|
+
}"
|
|
82
107
|
:key="button.id"
|
|
83
108
|
>
|
|
84
109
|
<div class="btn-group">
|
|
@@ -88,18 +113,37 @@
|
|
|
88
113
|
>
|
|
89
114
|
<icon-drag-arrow class="drag-icon" />
|
|
90
115
|
</div>
|
|
91
|
-
<icon-delete
|
|
116
|
+
<icon-delete
|
|
117
|
+
class="btn-delete"
|
|
118
|
+
@click="
|
|
119
|
+
handleDeleteButton(item.buttonList, button.id)
|
|
120
|
+
"
|
|
121
|
+
/>
|
|
92
122
|
</div>
|
|
93
123
|
<a-button type="primary">{{ button.text }}</a-button>
|
|
94
124
|
<div class="item-action flex items-center">
|
|
95
|
-
<a-input
|
|
96
|
-
|
|
125
|
+
<a-input
|
|
126
|
+
class="action-text"
|
|
127
|
+
v-model="button.text"
|
|
128
|
+
placeholder="按钮文本"
|
|
129
|
+
allow-clear
|
|
130
|
+
/>
|
|
131
|
+
<a-input
|
|
132
|
+
v-model="button.url"
|
|
133
|
+
placeholder="按钮链接"
|
|
134
|
+
allow-clear
|
|
135
|
+
/>
|
|
97
136
|
</div>
|
|
98
|
-
<a-checkbox :model-value="button.isExternal"
|
|
137
|
+
<a-checkbox :model-value="button.isExternal"
|
|
138
|
+
>是否外部链接</a-checkbox
|
|
139
|
+
>
|
|
99
140
|
</div>
|
|
100
141
|
</template>
|
|
101
142
|
</draggable>
|
|
102
|
-
<div
|
|
143
|
+
<div
|
|
144
|
+
class="item-add-btn flex items-center"
|
|
145
|
+
@click="handleAddButton(item.buttonList)"
|
|
146
|
+
>
|
|
103
147
|
<icon-plus />
|
|
104
148
|
<span class="btn-text">添加按钮</span>
|
|
105
149
|
</div>
|
|
@@ -110,7 +154,7 @@
|
|
|
110
154
|
:component-data="{
|
|
111
155
|
tag: 'div',
|
|
112
156
|
type: 'transition-group',
|
|
113
|
-
name: !drag ? 'flip-list' : null
|
|
157
|
+
name: !drag ? 'flip-list' : null,
|
|
114
158
|
}"
|
|
115
159
|
v-bind="linkDragOptions"
|
|
116
160
|
:disabled="!shouldShowDragHandle(item.linkList)"
|
|
@@ -121,7 +165,11 @@
|
|
|
121
165
|
<template #item="{ element: link }">
|
|
122
166
|
<div
|
|
123
167
|
class="item-button draggable-item"
|
|
124
|
-
:class="{
|
|
168
|
+
:class="{
|
|
169
|
+
'sortable-disabled': !shouldShowDragHandle(
|
|
170
|
+
item.linkList
|
|
171
|
+
),
|
|
172
|
+
}"
|
|
125
173
|
:key="link.id"
|
|
126
174
|
>
|
|
127
175
|
<div class="btn-group">
|
|
@@ -131,19 +179,36 @@
|
|
|
131
179
|
>
|
|
132
180
|
<icon-drag-arrow class="drag-icon" />
|
|
133
181
|
</div>
|
|
134
|
-
<icon-delete
|
|
182
|
+
<icon-delete
|
|
183
|
+
class="btn-delete"
|
|
184
|
+
@click="handleDeleteLink(item.linkList, link.id)"
|
|
185
|
+
/>
|
|
135
186
|
</div>
|
|
136
|
-
|
|
187
|
+
|
|
137
188
|
<a-link href="link">{{ link.text }}</a-link>
|
|
138
189
|
<div class="item-action flex items-center">
|
|
139
|
-
<a-input
|
|
140
|
-
|
|
190
|
+
<a-input
|
|
191
|
+
class="action-text"
|
|
192
|
+
v-model="link.text"
|
|
193
|
+
placeholder="按钮文本"
|
|
194
|
+
allow-clear
|
|
195
|
+
/>
|
|
196
|
+
<a-input
|
|
197
|
+
v-model="link.url"
|
|
198
|
+
placeholder="按钮链接"
|
|
199
|
+
allow-clear
|
|
200
|
+
/>
|
|
141
201
|
</div>
|
|
142
|
-
<a-checkbox :model-value="link.isExternal"
|
|
202
|
+
<a-checkbox :model-value="link.isExternal"
|
|
203
|
+
>是否外部链接</a-checkbox
|
|
204
|
+
>
|
|
143
205
|
</div>
|
|
144
206
|
</template>
|
|
145
207
|
</draggable>
|
|
146
|
-
<div
|
|
208
|
+
<div
|
|
209
|
+
class="item-add-btn flex items-center"
|
|
210
|
+
@click="handleAddLink(item.linkList)"
|
|
211
|
+
>
|
|
147
212
|
<icon-plus />
|
|
148
213
|
<span class="btn-text">添加链接</span>
|
|
149
214
|
</div>
|
|
@@ -151,7 +216,11 @@
|
|
|
151
216
|
|
|
152
217
|
<template v-if="item.type === 'Contact'">
|
|
153
218
|
<p class="item-title">标题</p>
|
|
154
|
-
<a-input
|
|
219
|
+
<a-input
|
|
220
|
+
v-model="item.title"
|
|
221
|
+
placeholder="请输入标题"
|
|
222
|
+
allow-clear
|
|
223
|
+
/>
|
|
155
224
|
|
|
156
225
|
<p class="item-title">内容</p>
|
|
157
226
|
<RichTextEditor v-model="item.content"></RichTextEditor>
|
|
@@ -162,7 +231,7 @@
|
|
|
162
231
|
:component-data="{
|
|
163
232
|
tag: 'div',
|
|
164
233
|
type: 'transition-group',
|
|
165
|
-
name: !drag ? 'flip-list' : null
|
|
234
|
+
name: !drag ? 'flip-list' : null,
|
|
166
235
|
}"
|
|
167
236
|
v-bind="categoryDragOptions"
|
|
168
237
|
:disabled="!shouldShowDragHandle(item.categories)"
|
|
@@ -173,7 +242,11 @@
|
|
|
173
242
|
<template #item="{ element: category }">
|
|
174
243
|
<div
|
|
175
244
|
class="item-button draggable-item"
|
|
176
|
-
:class="{
|
|
245
|
+
:class="{
|
|
246
|
+
'sortable-disabled': !shouldShowDragHandle(
|
|
247
|
+
item.categories
|
|
248
|
+
),
|
|
249
|
+
}"
|
|
177
250
|
:key="category.id"
|
|
178
251
|
>
|
|
179
252
|
<div class="btn-group">
|
|
@@ -183,17 +256,34 @@
|
|
|
183
256
|
>
|
|
184
257
|
<icon-drag-arrow class="drag-icon" />
|
|
185
258
|
</div>
|
|
186
|
-
<icon-delete
|
|
259
|
+
<icon-delete
|
|
260
|
+
class="btn-delete"
|
|
261
|
+
@click="
|
|
262
|
+
handleDeleteCategory(item.categories, category.id)
|
|
263
|
+
"
|
|
264
|
+
/>
|
|
187
265
|
</div>
|
|
188
|
-
<icon-delete
|
|
266
|
+
<icon-delete
|
|
267
|
+
class="btn-delete"
|
|
268
|
+
@click="
|
|
269
|
+
handleDeleteCategory(item.categories, category.id)
|
|
270
|
+
"
|
|
271
|
+
/>
|
|
189
272
|
<a-link href="link">{{ category.text }}</a-link>
|
|
190
273
|
<div class="item-action flex items-center">
|
|
191
|
-
<a-input
|
|
274
|
+
<a-input
|
|
275
|
+
v-model="category.text"
|
|
276
|
+
placeholder="分类名称"
|
|
277
|
+
allow-clear
|
|
278
|
+
/>
|
|
192
279
|
</div>
|
|
193
280
|
</div>
|
|
194
281
|
</template>
|
|
195
282
|
</draggable>
|
|
196
|
-
<div
|
|
283
|
+
<div
|
|
284
|
+
class="item-add-btn flex items-center"
|
|
285
|
+
@click="handleAddCategory(item.categories)"
|
|
286
|
+
>
|
|
197
287
|
<icon-plus />
|
|
198
288
|
<span class="btn-text">添加分类</span>
|
|
199
289
|
</div>
|
|
@@ -204,7 +294,7 @@
|
|
|
204
294
|
:component-data="{
|
|
205
295
|
tag: 'div',
|
|
206
296
|
type: 'transition-group',
|
|
207
|
-
name: !drag ? 'flip-list' : null
|
|
297
|
+
name: !drag ? 'flip-list' : null,
|
|
208
298
|
}"
|
|
209
299
|
v-bind="linkDragOptions"
|
|
210
300
|
:disabled="!shouldShowDragHandle(item.linkList)"
|
|
@@ -215,7 +305,11 @@
|
|
|
215
305
|
<template #item="{ element: link }">
|
|
216
306
|
<div
|
|
217
307
|
class="item-button draggable-item"
|
|
218
|
-
:class="{
|
|
308
|
+
:class="{
|
|
309
|
+
'sortable-disabled': !shouldShowDragHandle(
|
|
310
|
+
item.linkList
|
|
311
|
+
),
|
|
312
|
+
}"
|
|
219
313
|
:key="link.id"
|
|
220
314
|
>
|
|
221
315
|
<div class="btn-group">
|
|
@@ -225,18 +319,35 @@
|
|
|
225
319
|
>
|
|
226
320
|
<icon-drag-arrow class="drag-icon" />
|
|
227
321
|
</div>
|
|
228
|
-
<icon-delete
|
|
322
|
+
<icon-delete
|
|
323
|
+
class="btn-delete"
|
|
324
|
+
@click="handleDeleteLink(item.linkList, link.id)"
|
|
325
|
+
/>
|
|
229
326
|
</div>
|
|
230
327
|
<a-link href="link">{{ link.text }}</a-link>
|
|
231
328
|
<div class="item-action flex items-center">
|
|
232
|
-
<a-input
|
|
233
|
-
|
|
329
|
+
<a-input
|
|
330
|
+
class="action-text"
|
|
331
|
+
v-model="link.text"
|
|
332
|
+
placeholder="按钮文本"
|
|
333
|
+
allow-clear
|
|
334
|
+
/>
|
|
335
|
+
<a-input
|
|
336
|
+
v-model="link.url"
|
|
337
|
+
placeholder="按钮链接"
|
|
338
|
+
allow-clear
|
|
339
|
+
/>
|
|
234
340
|
</div>
|
|
235
|
-
<a-checkbox :model-value="link.isExternal"
|
|
341
|
+
<a-checkbox :model-value="link.isExternal"
|
|
342
|
+
>是否外部链接</a-checkbox
|
|
343
|
+
>
|
|
236
344
|
</div>
|
|
237
345
|
</template>
|
|
238
346
|
</draggable>
|
|
239
|
-
<div
|
|
347
|
+
<div
|
|
348
|
+
class="item-add-btn flex items-center"
|
|
349
|
+
@click="handleAddLink(item.linkList)"
|
|
350
|
+
>
|
|
240
351
|
<icon-plus />
|
|
241
352
|
<span class="btn-text">添加链接</span>
|
|
242
353
|
</div>
|
|
@@ -245,12 +356,32 @@
|
|
|
245
356
|
<template v-if="item.type === 'Image'">
|
|
246
357
|
<img class="item-img" :src="item.imgSrc" />
|
|
247
358
|
<div class="item-uplaod flex items-center">
|
|
248
|
-
<a-input
|
|
249
|
-
|
|
359
|
+
<a-input
|
|
360
|
+
v-model="item.imgSrc"
|
|
361
|
+
placeholder="请输入标题"
|
|
362
|
+
allow-clear
|
|
363
|
+
/>
|
|
364
|
+
<a-upload
|
|
365
|
+
class="fit-content"
|
|
366
|
+
:show-file-list="false"
|
|
367
|
+
action="/"
|
|
368
|
+
/>
|
|
250
369
|
</div>
|
|
251
|
-
<a-input
|
|
252
|
-
|
|
253
|
-
|
|
370
|
+
<a-input
|
|
371
|
+
class="mt-2"
|
|
372
|
+
v-model="item.caption"
|
|
373
|
+
placeholder="图片描述"
|
|
374
|
+
allow-clear
|
|
375
|
+
/>
|
|
376
|
+
<a-input
|
|
377
|
+
class="mt-2"
|
|
378
|
+
v-model="item.alt"
|
|
379
|
+
placeholder="图片alt"
|
|
380
|
+
allow-clear
|
|
381
|
+
/>
|
|
382
|
+
<a-checkbox class="pt-2" :model-value="item.isRound"
|
|
383
|
+
>圆角</a-checkbox
|
|
384
|
+
>
|
|
254
385
|
</template>
|
|
255
386
|
|
|
256
387
|
<template v-if="item.type === 'ImageList'">
|
|
@@ -261,7 +392,7 @@
|
|
|
261
392
|
:component-data="{
|
|
262
393
|
tag: 'div',
|
|
263
394
|
type: 'transition-group',
|
|
264
|
-
name: !drag ? 'flip-list' : null
|
|
395
|
+
name: !drag ? 'flip-list' : null,
|
|
265
396
|
}"
|
|
266
397
|
v-bind="imageDragOptions"
|
|
267
398
|
:disabled="!shouldShowDragHandle(item.imageList)"
|
|
@@ -272,9 +403,13 @@
|
|
|
272
403
|
<template #item="{ element: img }">
|
|
273
404
|
<div
|
|
274
405
|
class="img-list-item flex draggable-item"
|
|
275
|
-
:class="{
|
|
406
|
+
:class="{
|
|
407
|
+
'sortable-disabled': !shouldShowDragHandle(
|
|
408
|
+
item.imageList
|
|
409
|
+
),
|
|
410
|
+
}"
|
|
276
411
|
:key="img.id"
|
|
277
|
-
>
|
|
412
|
+
>
|
|
278
413
|
<div class="btn-group">
|
|
279
414
|
<div
|
|
280
415
|
v-if="shouldShowDragHandle(item.imageList)"
|
|
@@ -282,39 +417,66 @@
|
|
|
282
417
|
>
|
|
283
418
|
<icon-drag-arrow class="drag-icon" />
|
|
284
419
|
</div>
|
|
285
|
-
<icon-delete
|
|
420
|
+
<icon-delete
|
|
421
|
+
class="btn-delete"
|
|
422
|
+
@click="handleDeleteImage(item.imageList, img.id)"
|
|
423
|
+
/>
|
|
286
424
|
</div>
|
|
287
|
-
|
|
425
|
+
|
|
288
426
|
<div class="item-img-box" v-if="img.src">
|
|
289
427
|
<!-- <icon-close-circle-fill class="item-img-dlete" @click="handleDeleteImage(item.imageList, img.id)" /> -->
|
|
290
428
|
<img class="item-img small-img" :src="img.src" />
|
|
291
429
|
</div>
|
|
292
430
|
|
|
293
431
|
<div class="item-right flex-1">
|
|
294
|
-
<a-input
|
|
432
|
+
<a-input
|
|
433
|
+
style="margin-bottom: 12px"
|
|
434
|
+
v-model="img.src"
|
|
435
|
+
placeholder="请输入图片路径"
|
|
436
|
+
allow-clear
|
|
437
|
+
/>
|
|
295
438
|
<a-upload :show-file-list="false" action="/" />
|
|
296
439
|
</div>
|
|
297
440
|
</div>
|
|
298
441
|
</template>
|
|
299
442
|
</draggable>
|
|
300
443
|
</div>
|
|
301
|
-
<div
|
|
444
|
+
<div
|
|
445
|
+
class="item-add-btn flex items-center"
|
|
446
|
+
@click="handleAddImage(item.imageList)"
|
|
447
|
+
>
|
|
302
448
|
<icon-plus />
|
|
303
449
|
<span class="btn-text">添加图片</span>
|
|
304
|
-
</div>
|
|
450
|
+
</div>
|
|
305
451
|
</template>
|
|
306
452
|
|
|
307
453
|
<template v-if="item.type === 'Video'">
|
|
308
454
|
<p class="item-title">视频</p>
|
|
309
455
|
<video class="item-img" :src="item.videoSrc" controls></video>
|
|
310
456
|
<div class="item-uplaod flex items-center">
|
|
311
|
-
<a-input
|
|
312
|
-
|
|
457
|
+
<a-input
|
|
458
|
+
v-model="item.videoSrc"
|
|
459
|
+
placeholder="请输入视频链接"
|
|
460
|
+
allow-clear
|
|
461
|
+
/>
|
|
462
|
+
<a-upload
|
|
463
|
+
class="fit-content"
|
|
464
|
+
:show-file-list="false"
|
|
465
|
+
action="/"
|
|
466
|
+
/>
|
|
313
467
|
</div>
|
|
314
468
|
<img class="item-img" :src="item.imgSrc" />
|
|
315
469
|
<div class="item-uplaod flex items-center">
|
|
316
|
-
<a-input
|
|
317
|
-
|
|
470
|
+
<a-input
|
|
471
|
+
v-model="item.imgSrc"
|
|
472
|
+
placeholder="视频封面"
|
|
473
|
+
allow-clear
|
|
474
|
+
/>
|
|
475
|
+
<a-upload
|
|
476
|
+
class="fit-content"
|
|
477
|
+
:show-file-list="false"
|
|
478
|
+
action="/"
|
|
479
|
+
/>
|
|
318
480
|
</div>
|
|
319
481
|
</template>
|
|
320
482
|
</div>
|
|
@@ -326,168 +488,180 @@
|
|
|
326
488
|
</template>
|
|
327
489
|
|
|
328
490
|
<script lang="ts" setup>
|
|
329
|
-
import { ref, computed } from
|
|
330
|
-
import draggable from
|
|
331
|
-
import RichTextEditor from
|
|
332
|
-
import { randomString } from
|
|
491
|
+
import { ref, computed } from "vue";
|
|
492
|
+
import draggable from "vuedraggable";
|
|
493
|
+
import RichTextEditor from "@/components/RichTextEditor";
|
|
494
|
+
import { randomString } from "@/utils/common";
|
|
333
495
|
|
|
334
496
|
// 拖拽相关状态
|
|
335
|
-
const drag = ref(false)
|
|
497
|
+
const drag = ref(false);
|
|
336
498
|
|
|
337
499
|
// 不同类型的拖拽配置选项
|
|
338
500
|
const dragOptions = computed(() => ({
|
|
339
501
|
animation: 200,
|
|
340
|
-
group:
|
|
502
|
+
group: "item",
|
|
341
503
|
disabled: false,
|
|
342
|
-
ghostClass:
|
|
343
|
-
}))
|
|
504
|
+
ghostClass: "ghost",
|
|
505
|
+
}));
|
|
344
506
|
|
|
345
507
|
const buttonDragOptions = computed(() => ({
|
|
346
508
|
animation: 200,
|
|
347
|
-
group:
|
|
509
|
+
group: "buttons", // 按钮专用分组
|
|
348
510
|
disabled: false,
|
|
349
|
-
ghostClass:
|
|
350
|
-
}))
|
|
511
|
+
ghostClass: "ghost",
|
|
512
|
+
}));
|
|
351
513
|
|
|
352
514
|
const linkDragOptions = computed(() => ({
|
|
353
515
|
animation: 200,
|
|
354
|
-
group:
|
|
516
|
+
group: "links", // 链接专用分组
|
|
355
517
|
disabled: false,
|
|
356
|
-
ghostClass:
|
|
357
|
-
}))
|
|
518
|
+
ghostClass: "ghost",
|
|
519
|
+
}));
|
|
358
520
|
|
|
359
521
|
const categoryDragOptions = computed(() => ({
|
|
360
522
|
animation: 200,
|
|
361
|
-
group:
|
|
523
|
+
group: "categories", // 分类专用分组
|
|
362
524
|
disabled: false,
|
|
363
|
-
ghostClass:
|
|
364
|
-
}))
|
|
525
|
+
ghostClass: "ghost",
|
|
526
|
+
}));
|
|
365
527
|
|
|
366
528
|
const imageDragOptions = computed(() => ({
|
|
367
529
|
animation: 200,
|
|
368
|
-
group:
|
|
530
|
+
group: "images", // 图片专用分组
|
|
369
531
|
disabled: false,
|
|
370
|
-
ghostClass:
|
|
371
|
-
}))
|
|
532
|
+
ghostClass: "ghost",
|
|
533
|
+
}));
|
|
372
534
|
|
|
373
535
|
// 检查是否应该显示拖拽图标
|
|
374
536
|
const shouldShowDragHandle = (list: any[]) => {
|
|
375
|
-
return list && list.length > 1
|
|
376
|
-
}
|
|
537
|
+
return list && list.length > 1;
|
|
538
|
+
};
|
|
377
539
|
|
|
378
540
|
const props = defineProps({
|
|
379
541
|
show: {
|
|
380
542
|
type: Boolean,
|
|
381
|
-
default: false
|
|
543
|
+
default: false,
|
|
382
544
|
},
|
|
383
545
|
|
|
384
546
|
data: {
|
|
385
547
|
type: Object,
|
|
386
|
-
default: () => {}
|
|
387
|
-
}
|
|
388
|
-
})
|
|
548
|
+
default: () => {},
|
|
549
|
+
},
|
|
550
|
+
});
|
|
389
551
|
|
|
390
|
-
const emit = defineEmits([
|
|
552
|
+
const emit = defineEmits(["update:show"]);
|
|
391
553
|
|
|
392
554
|
const handleCancel = () => {
|
|
393
|
-
emit(
|
|
394
|
-
}
|
|
555
|
+
emit("update:show", false);
|
|
556
|
+
};
|
|
395
557
|
|
|
396
558
|
const handleAdd = (type: string) => {
|
|
397
559
|
const detail = props.data;
|
|
398
|
-
if (type ===
|
|
560
|
+
if (type === "Article") {
|
|
399
561
|
detail.data.push({
|
|
400
562
|
id: randomString(),
|
|
401
|
-
type:
|
|
402
|
-
title:
|
|
403
|
-
content:
|
|
563
|
+
type: "Article",
|
|
564
|
+
title: "",
|
|
565
|
+
content: "",
|
|
404
566
|
buttonList: [],
|
|
405
|
-
linkList: []
|
|
406
|
-
})
|
|
407
|
-
} else if (type ===
|
|
567
|
+
linkList: [],
|
|
568
|
+
});
|
|
569
|
+
} else if (type === "Contact") {
|
|
408
570
|
detail.data.push({
|
|
409
571
|
id: randomString(),
|
|
410
|
-
type:
|
|
411
|
-
title:
|
|
412
|
-
content:
|
|
572
|
+
type: "Contact",
|
|
573
|
+
title: "",
|
|
574
|
+
content: "",
|
|
413
575
|
categories: [],
|
|
414
|
-
linkList: []
|
|
415
|
-
})
|
|
416
|
-
} else if (type ===
|
|
576
|
+
linkList: [],
|
|
577
|
+
});
|
|
578
|
+
} else if (type === "Image") {
|
|
417
579
|
detail.data.push({
|
|
418
580
|
id: randomString(),
|
|
419
|
-
type:
|
|
420
|
-
imgSrc:
|
|
421
|
-
caption:
|
|
422
|
-
alt:
|
|
423
|
-
isRound: false
|
|
424
|
-
})
|
|
425
|
-
} else if (type ===
|
|
581
|
+
type: "Image",
|
|
582
|
+
imgSrc: "",
|
|
583
|
+
caption: "",
|
|
584
|
+
alt: "",
|
|
585
|
+
isRound: false,
|
|
586
|
+
});
|
|
587
|
+
} else if (type === "ImageList") {
|
|
426
588
|
detail.data.push({
|
|
427
589
|
id: randomString(),
|
|
428
|
-
type:
|
|
429
|
-
imageList: []
|
|
430
|
-
})
|
|
431
|
-
} else if (type ===
|
|
590
|
+
type: "ImageList",
|
|
591
|
+
imageList: [],
|
|
592
|
+
});
|
|
593
|
+
} else if (type === "Video") {
|
|
432
594
|
detail.data.push({
|
|
433
595
|
id: randomString(),
|
|
434
|
-
type:
|
|
435
|
-
videoSrc:
|
|
436
|
-
imgSrc:
|
|
437
|
-
})
|
|
596
|
+
type: "Video",
|
|
597
|
+
videoSrc: "",
|
|
598
|
+
imgSrc: "",
|
|
599
|
+
});
|
|
438
600
|
}
|
|
439
|
-
}
|
|
601
|
+
};
|
|
440
602
|
|
|
441
603
|
const handleDelete = (id: string) => {
|
|
442
|
-
props.data.data = props.data.data.filter((item: any) => item.id !== id)
|
|
443
|
-
}
|
|
604
|
+
props.data.data = props.data.data.filter((item: any) => item.id !== id);
|
|
605
|
+
};
|
|
444
606
|
|
|
445
607
|
const handleAddButton = (list: any[]) => {
|
|
446
608
|
list.push({
|
|
447
609
|
id: randomString(),
|
|
448
|
-
text:
|
|
610
|
+
text: "查看更多",
|
|
449
611
|
url: undefined,
|
|
450
|
-
isExternal: false
|
|
451
|
-
})
|
|
452
|
-
}
|
|
612
|
+
isExternal: false,
|
|
613
|
+
});
|
|
614
|
+
};
|
|
453
615
|
|
|
454
616
|
const handleDeleteButton = (list: any[], id: string) => {
|
|
455
|
-
list.splice(
|
|
456
|
-
|
|
617
|
+
list.splice(
|
|
618
|
+
list.findIndex((item) => item.id === id),
|
|
619
|
+
1
|
|
620
|
+
);
|
|
621
|
+
};
|
|
457
622
|
|
|
458
623
|
const handleAddLink = (list: any[]) => {
|
|
459
624
|
list.push({
|
|
460
625
|
id: randomString(),
|
|
461
|
-
text:
|
|
626
|
+
text: "查看更多",
|
|
462
627
|
url: undefined,
|
|
463
|
-
isExternal: false
|
|
464
|
-
})
|
|
465
|
-
}
|
|
628
|
+
isExternal: false,
|
|
629
|
+
});
|
|
630
|
+
};
|
|
466
631
|
|
|
467
632
|
const handleDeleteLink = (list: any[], id: string) => {
|
|
468
|
-
list.splice(
|
|
469
|
-
|
|
633
|
+
list.splice(
|
|
634
|
+
list.findIndex((item) => item.id === id),
|
|
635
|
+
1
|
|
636
|
+
);
|
|
637
|
+
};
|
|
470
638
|
|
|
471
639
|
const handleAddCategory = (list: any[]) => {
|
|
472
640
|
list.push({
|
|
473
641
|
id: randomString(),
|
|
474
|
-
text:
|
|
475
|
-
})
|
|
476
|
-
}
|
|
642
|
+
text: "分类",
|
|
643
|
+
});
|
|
644
|
+
};
|
|
477
645
|
|
|
478
646
|
const handleDeleteCategory = (list: any[], id: string) => {
|
|
479
|
-
list.splice(
|
|
480
|
-
|
|
647
|
+
list.splice(
|
|
648
|
+
list.findIndex((item) => item.id === id),
|
|
649
|
+
1
|
|
650
|
+
);
|
|
651
|
+
};
|
|
481
652
|
const handleAddImage = (list: any[]) => {
|
|
482
653
|
list.push({
|
|
483
654
|
id: randomString(),
|
|
484
|
-
src:
|
|
485
|
-
})
|
|
486
|
-
}
|
|
655
|
+
src: "",
|
|
656
|
+
});
|
|
657
|
+
};
|
|
487
658
|
|
|
488
659
|
const handleDeleteImage = (list: any[], img: string) => {
|
|
489
|
-
list.splice(
|
|
490
|
-
|
|
660
|
+
list.splice(
|
|
661
|
+
list.findIndex((item) => item === img),
|
|
662
|
+
1
|
|
663
|
+
);
|
|
664
|
+
};
|
|
491
665
|
</script>
|
|
492
666
|
|
|
493
667
|
<style lang="scss" scoped>
|
|
@@ -504,7 +678,7 @@ const handleDeleteImage = (list: any[], img: string) => {
|
|
|
504
678
|
|
|
505
679
|
.setting-body {
|
|
506
680
|
margin-top: 12px;
|
|
507
|
-
|
|
681
|
+
|
|
508
682
|
.setting-item {
|
|
509
683
|
position: relative;
|
|
510
684
|
padding: 16px 12px;
|
|
@@ -720,4 +894,4 @@ const handleDeleteImage = (list: any[], img: string) => {
|
|
|
720
894
|
}
|
|
721
895
|
}
|
|
722
896
|
}
|
|
723
|
-
</style>
|
|
897
|
+
</style>
|