officialblock 1.0.6 → 1.0.8
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/index-Ch_ldWmA.js +1 -0
- package/dist/index-DXm2cqxo.mjs +485 -0
- package/dist/official-block.cjs.js +74 -74
- package/dist/official-block.es.js +13577 -10832
- package/dist/official-block.umd.js +78 -78
- package/dist/style.css +1 -1
- package/dist/swiper-JiLDDxAF.js +1 -0
- package/dist/swiper-acbnDJoL.mjs +2035 -0
- package/dist/utils-DD-vVZej.mjs +316 -0
- package/dist/utils-DOLLD0-F.js +1 -0
- package/package.json +2 -1
- package/src/components/ArticleList/article.vue +3 -3
- package/src/components/ArticleList/contact.vue +9 -9
- package/src/components/ArticleList/index.ts +1 -1
- package/src/components/ArticleList/index.vue +24 -82
- package/src/components/ArticleList/setting.vue +61 -71
- package/src/components/ArticleList/type.ts +12 -18
- package/src/components/BannerImage/index.ts +11 -0
- package/src/components/BannerImage/index.vue +153 -0
- package/src/components/BannerImage/setting.vue +55 -0
- package/src/components/BannerImage/type.ts +10 -0
- package/src/components/BannerPage/index.ts +11 -0
- package/src/components/BannerPage/index.vue +283 -0
- package/src/components/BannerPage/setting.vue +55 -0
- package/src/components/BannerPage/type.ts +10 -0
- package/src/components/BtnList/index.ts +11 -0
- package/src/components/BtnList/index.vue +588 -0
- package/src/components/BtnList/setting.vue +255 -0
- package/src/components/BtnList/type.ts +10 -0
- package/src/components/Button/index.vue +45 -33
- package/src/components/CustomSpace/index.ts +11 -0
- package/src/components/CustomSpace/index.vue +82 -0
- package/src/components/CustomSpace/setting.vue +89 -0
- package/src/components/CustomSpace/type.ts +10 -0
- package/src/components/GalleryList/index.ts +12 -0
- package/src/components/GalleryList/index.vue +311 -0
- package/src/components/GalleryList/setting.vue +268 -0
- package/src/components/GalleryList/type.ts +10 -0
- package/src/components/HeroSlide/index.ts +1 -1
- package/src/components/HeroSlide/index.vue +85 -133
- package/src/components/HeroSlide/setting.vue +435 -0
- package/src/components/HeroSlide/type.ts +5 -14
- package/src/components/LinkLIst/index.ts +11 -0
- package/src/components/LinkLIst/index.vue +317 -0
- package/src/components/LinkLIst/setting.vue +264 -0
- package/src/components/LinkLIst/type.ts +10 -0
- package/src/components/Media/index.vue +18 -18
- package/src/components/Operate/index.vue +17 -7
- package/src/components/Profile/index.vue +999 -0
- package/src/components/Profile/modal.vue +56 -0
- package/src/components/Profile/setting.vue +330 -0
- package/src/components/QuickLinks/index.vue +166 -0
- package/src/components/QuoteText/index.ts +11 -0
- package/src/components/QuoteText/index.vue +133 -0
- package/src/components/QuoteText/setting.vue +81 -0
- package/src/components/QuoteText/type.ts +10 -0
- package/src/components/ScrollKeyInfo/index.vue +0 -0
- package/src/components/Swiper/index.vue +538 -0
- package/src/components/index.ts +23 -5
- package/src/index.ts +56 -12
- package/src/main.ts +6 -3
- package/src/router/index.ts +6 -0
- package/src/style.css +17 -0
- package/src/styles/component-isolation.scss +256 -0
- package/src/styles/editor.scss +1 -1
- package/src/styles/layers.scss +256 -0
- package/src/styles/main.scss +21687 -0
- package/src/styles/mixins/style-isolation.scss +262 -0
- package/src/styles/smart-reset.scss +287 -0
- package/src/styles/test.scss +1 -1
- package/src/types/button.ts +10 -0
- package/src/views/StyleIsolationTest.vue +292 -0
- package/src/views/components/ArticleListDemo.vue +49 -10
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="gallery-list" @mouseenter="isHover = true" @mouseleave="isHover = false">
|
|
3
|
+
<div class="gallery-container gallery-caption container-content" :style="{backgroundColor: modelValue?.bgColor}">
|
|
4
|
+
<a-row class="caption-row">
|
|
5
|
+
<a-col v-for="item in modelValue?.data" :key="item.id" :sm="{span: 24 / modelValue?.mobileCol}" :md="{span: 24 / modelValue?.desktopCol}">
|
|
6
|
+
<div class="gallery-caption" :class="[item.url && 'has-url', item.profile && 'has-profile']" @click="handleClick(item)">
|
|
7
|
+
<div class="gallery-caption__img">
|
|
8
|
+
<img :src="item.imgSrc" :alt="item.alt">
|
|
9
|
+
</div>
|
|
10
|
+
<div class="gallery-caption__title tx-subtitle text-blue text-center mt-3 mt-md-4 px-3">{{ item.title }}</div>
|
|
11
|
+
<div v-if="item.text" class="tx-body text-teal-darkest text-center mt-2 mt-md-3 mb-3">{{ item.text }}</div>
|
|
12
|
+
</div>
|
|
13
|
+
</a-col>
|
|
14
|
+
</a-row>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<Operate v-if="!modelValue?.readOnly" v-model:show="isHover" @handle-edit="showSetting = true" @handle-delete="handleDelete" @handle-copy="handleCopy"></Operate>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<Setting v-model:show="showSetting" :data="modelValue"></Setting>
|
|
21
|
+
<ProfileModel v-model:show="showProfile" :data="profileData"></ProfileModel>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import { ref } from 'vue'
|
|
26
|
+
import { randomString } from '@/utils/common'
|
|
27
|
+
import Setting from './setting.vue'
|
|
28
|
+
import Operate from '@/components/Operate/index.vue'
|
|
29
|
+
import ProfileModel from '@/components/Profile/modal.vue'
|
|
30
|
+
|
|
31
|
+
// 定义组件名称
|
|
32
|
+
defineOptions({
|
|
33
|
+
name: 'GalleryList'
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const props = defineProps({
|
|
37
|
+
modelValue: {
|
|
38
|
+
type: Object,
|
|
39
|
+
default: () => {}
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// 是否预览
|
|
43
|
+
isPreview: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const emit = defineEmits(['update:modelValue', 'handleDelete', 'handleCopy'])
|
|
50
|
+
|
|
51
|
+
const handleInit = () => {
|
|
52
|
+
if (props.modelValue && props.modelValue.data) return // 有数据不用初始化
|
|
53
|
+
const data = {
|
|
54
|
+
id: props.modelValue?.id || randomString(),
|
|
55
|
+
type: 'GalleryList',
|
|
56
|
+
readOnly: props.modelValue?.readOnly || false,
|
|
57
|
+
bgColor: '',
|
|
58
|
+
desktopCol: 4,
|
|
59
|
+
mobileCol: 2,
|
|
60
|
+
data: [
|
|
61
|
+
{
|
|
62
|
+
id: randomString(),
|
|
63
|
+
type: 'GalleryListItem',
|
|
64
|
+
title: '耀华国际教育学校浙江桐乡',
|
|
65
|
+
text: '123',
|
|
66
|
+
imgSrc: 'https://osswebsite-test.cedim.cn/media-library/ywies-tx/images/high-school-test/home/different_1_optim.png',
|
|
67
|
+
alt: '',
|
|
68
|
+
url: 'https://www.baidu.com',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: randomString(),
|
|
72
|
+
type: 'GalleryListProfile',
|
|
73
|
+
title: '耀华国际教育学校浙江桐乡',
|
|
74
|
+
text: '123',
|
|
75
|
+
imgSrc: 'https://osswebsite-test.cedim.cn/media-library/ywies-tx/images/high-school-test/home/different_1_optim.png',
|
|
76
|
+
alt: '',
|
|
77
|
+
url: '',
|
|
78
|
+
profile: {
|
|
79
|
+
title: '耀华国际教育学校浙江桐乡',
|
|
80
|
+
subTitle: '耀华国际教育学校浙江桐乡',
|
|
81
|
+
name: '耀华国际教育学校浙江桐乡',
|
|
82
|
+
label: '123',
|
|
83
|
+
imgSrc: 'https://osswebsite.ycyw.com/media-library/ywies-bj/images/home/ywies-tx.jpg',
|
|
84
|
+
alt: '',
|
|
85
|
+
buttonList: {
|
|
86
|
+
id: randomString(),
|
|
87
|
+
type: 'BtnList',
|
|
88
|
+
readOnly: true,
|
|
89
|
+
width: '',
|
|
90
|
+
bgColor: '',
|
|
91
|
+
data: [
|
|
92
|
+
{
|
|
93
|
+
id: randomString(),
|
|
94
|
+
type: 'white',
|
|
95
|
+
text: '了解更多',
|
|
96
|
+
url: 'https://www.baidu.com',
|
|
97
|
+
isExternal: false
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: randomString(),
|
|
101
|
+
type: 'light',
|
|
102
|
+
text: '了解更多',
|
|
103
|
+
url: 'https://www.baidu.com',
|
|
104
|
+
isExternal: false
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
paragraphs: [{
|
|
109
|
+
id: randomString(),
|
|
110
|
+
title: '123',
|
|
111
|
+
content: '123'
|
|
112
|
+
}]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
emit('update:modelValue', data)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const isHover = ref<boolean>(false);
|
|
121
|
+
const showSetting = ref<boolean>(false);
|
|
122
|
+
|
|
123
|
+
const handleDelete = () => {
|
|
124
|
+
emit('handleDelete', props.modelValue.id)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const handleCopy = () => {
|
|
128
|
+
emit('handleCopy', props.modelValue)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const showProfile = ref<boolean>(false)
|
|
132
|
+
const profileData = ref<any>({})
|
|
133
|
+
const handleClick = (item: any) => {
|
|
134
|
+
if (item.type !== 'GalleryListProfile') return
|
|
135
|
+
profileData.value = item.profile
|
|
136
|
+
showProfile.value = true
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
handleInit()
|
|
140
|
+
</script>
|
|
141
|
+
|
|
142
|
+
<style lang="scss" scoped>
|
|
143
|
+
.gallery-list {
|
|
144
|
+
position: relative;
|
|
145
|
+
width: 100%;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.gallery-list .default-row {
|
|
149
|
+
--bs-gutter-x: 12px;
|
|
150
|
+
--bs-gutter-y: 12.79px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@media (max-width: 767.98px) {
|
|
154
|
+
.gallery-list .default-row {
|
|
155
|
+
--bs-gutter-x: 8px;
|
|
156
|
+
--bs-gutter-y: 8.37px;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.gallery-list .wide-row {
|
|
161
|
+
--bs-gutter-y: 12.79px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@media (max-width: 767.98px) {
|
|
165
|
+
.gallery-list .wide-row {
|
|
166
|
+
--bs-gutter-y: 8.37px;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.gallery-list .caption-row {
|
|
171
|
+
--bs-gutter-x: 16px;
|
|
172
|
+
--bs-gutter-y: 24px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.gallery-list .gallery-container.gallery-four-box,
|
|
176
|
+
.gallery-list .gallery-container.gallery-gallery {
|
|
177
|
+
padding-left: 0;
|
|
178
|
+
padding-right: 0;
|
|
179
|
+
max-width: 1280px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.gallery-list .gallery-container.gallery-gallery .gallery-row {
|
|
183
|
+
--bs-gutter-x: 12px;
|
|
184
|
+
--bs-gutter-y: 12px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@media (max-width: 767.98px) {
|
|
188
|
+
.gallery-list .gallery-container.gallery-gallery .gallery-row {
|
|
189
|
+
--bs-gutter-x: 8px;
|
|
190
|
+
--bs-gutter-y: 8px;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@media (max-width: 767.98px) {
|
|
195
|
+
.gallery-list .gallery-container.gallery-caption {
|
|
196
|
+
padding-left: 0;
|
|
197
|
+
padding-right: 0;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@media (min-width: 1280px) {
|
|
202
|
+
.gallery-list .gallery-container.gallery-caption-round {
|
|
203
|
+
--max-width: clamp(952px, calc(76.27765vw - 24.35393px), 1440px);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.gallery-list .gallery-container.gallery-caption-round .caption-row {
|
|
208
|
+
--bs-gutter-x: 18px;
|
|
209
|
+
--bs-gutter-y: 24px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@media (max-width: 767.98px) {
|
|
213
|
+
.gallery-list .gallery-container.gallery-caption-round .caption-row {
|
|
214
|
+
--bs-gutter-x: 10px;
|
|
215
|
+
--bs-gutter-y: 13.14px;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@media (min-width: 1024px) {
|
|
220
|
+
.gallery-list .gallery-container.gallery-circle {
|
|
221
|
+
max-width: 1064px;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@media (max-width: 767.98px) {
|
|
226
|
+
.gallery-list .gallery-container.gallery-timeline,
|
|
227
|
+
.gallery-list .gallery-container.gallery-timeline-col {
|
|
228
|
+
padding-left: 0;
|
|
229
|
+
padding-right: 0;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.gallery-list .gallery-container.gallery-timeline-col .row {
|
|
234
|
+
--bs-gutter-x: 48px;
|
|
235
|
+
--bs-gutter-y: 24px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@media (max-width: 767.98px) {
|
|
239
|
+
.gallery-list .gallery-container.gallery-timeline-col .row {
|
|
240
|
+
--bs-gutter-x: 24px;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.gallery-list .gallery-container .gallery-row {
|
|
245
|
+
--bs-gutter-x: 8px;
|
|
246
|
+
--bs-gutter-y: 8px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@media (max-width: 767.98px) {
|
|
250
|
+
.gallery-list .gallery-container .gallery-row {
|
|
251
|
+
--bs-gutter-x: 4px;
|
|
252
|
+
--bs-gutter-y: 4px;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.gallery-list .row-center {
|
|
257
|
+
justify-content: center;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.gallery-caption {
|
|
261
|
+
width: 100%;
|
|
262
|
+
height: 100%;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.gallery-caption.has-profile {
|
|
266
|
+
cursor: pointer;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.gallery-caption__img img {
|
|
270
|
+
width: 100%;
|
|
271
|
+
height: auto;
|
|
272
|
+
-o-object-fit: contain;
|
|
273
|
+
object-fit: contain;
|
|
274
|
+
transition: transform .3s ease-in-out;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.gallery-caption__title {
|
|
278
|
+
text-decoration: none;
|
|
279
|
+
display: block;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.gallery-caption__img {
|
|
283
|
+
display: block;
|
|
284
|
+
overflow: hidden;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.gallery-caption .has-url .gallery-caption__img img {
|
|
288
|
+
&:hover {
|
|
289
|
+
transform: scale(1.05);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.arco-row {
|
|
294
|
+
--bs-gutter-x: 16px;
|
|
295
|
+
--bs-gutter-y: 0;
|
|
296
|
+
display: flex;
|
|
297
|
+
flex-wrap: wrap;
|
|
298
|
+
margin-top: calc(var(--bs-gutter-y)*-1);
|
|
299
|
+
margin-right: calc(var(--bs-gutter-x)*-0.5);
|
|
300
|
+
margin-left: calc(var(--bs-gutter-x)*-0.5);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.arco-row > * {
|
|
304
|
+
flex-shrink: 0;
|
|
305
|
+
width: 100%;
|
|
306
|
+
max-width: 100%;
|
|
307
|
+
padding-right: calc(var(--bs-gutter-x)*0.5);
|
|
308
|
+
padding-left: calc(var(--bs-gutter-x)*0.5);
|
|
309
|
+
margin-top: var(--bs-gutter-y);
|
|
310
|
+
}
|
|
311
|
+
</style>
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-drawer :width="500" :visible="show" :footer="false" @cancel="handleCancel" unmountOnClose>
|
|
3
|
+
<template #title>
|
|
4
|
+
{{data.type}}组件编辑
|
|
5
|
+
</template>
|
|
6
|
+
<div class="setting-content">
|
|
7
|
+
<!-- 组件自身属性 -->
|
|
8
|
+
<div class="setting-header flex items-center">
|
|
9
|
+
<span class="header-title">组件背景</span>
|
|
10
|
+
<a-select v-model="data.bgColor" placeholder="请选择" allow-clear>
|
|
11
|
+
<a-option value="#ffffff">白色</a-option>
|
|
12
|
+
<a-option value="#F7F7FA">灰色</a-option>
|
|
13
|
+
</a-select>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="setting-header flex items-center">
|
|
17
|
+
<span class="header-title">pc列数</span>
|
|
18
|
+
<a-input v-model="data.desktopCol" placeholder="请输入" allow-clear />
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div class="setting-header flex items-center">
|
|
22
|
+
<span class="header-title">移动端列数</span>
|
|
23
|
+
<a-input v-model="data.mobileCol" placeholder="请输入" allow-clear />
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<a-button-group type="primary">
|
|
27
|
+
<a-button size="mini" @click="handleAdd('GalleryListItem')"><template #icon><icon-plus /></template> 普通项目 </a-button>
|
|
28
|
+
<a-button size="mini" @click="handleAdd('GalleryListProfile')"><template #icon><icon-plus /></template> 文章项目 </a-button>
|
|
29
|
+
</a-button-group>
|
|
30
|
+
|
|
31
|
+
<!-- 子组件属性 -->
|
|
32
|
+
<div class="setting-body">
|
|
33
|
+
<div class="setting-item">
|
|
34
|
+
<draggable
|
|
35
|
+
v-model="data.data"
|
|
36
|
+
:component-data="{
|
|
37
|
+
tag: 'div',
|
|
38
|
+
type: 'transition-group',
|
|
39
|
+
name: !drag ? 'flip-list' : null
|
|
40
|
+
}"
|
|
41
|
+
v-bind="galleryDragOptions"
|
|
42
|
+
:disabled="!shouldShowDragHandle(data.data)"
|
|
43
|
+
@start="drag = true"
|
|
44
|
+
@end="drag = false"
|
|
45
|
+
item-key="id"
|
|
46
|
+
>
|
|
47
|
+
<template #item="{ element: gallery }">
|
|
48
|
+
<div
|
|
49
|
+
class="item-button draggable-item"
|
|
50
|
+
:class="{ 'sortable-disabled': !shouldShowDragHandle(data.data) }"
|
|
51
|
+
:key="gallery.id"
|
|
52
|
+
>
|
|
53
|
+
<div class="btn-group">
|
|
54
|
+
<div
|
|
55
|
+
v-if="shouldShowDragHandle(data.data)"
|
|
56
|
+
class="drag-handle"
|
|
57
|
+
>
|
|
58
|
+
<icon-drag-arrow class="drag-icon" />
|
|
59
|
+
</div>
|
|
60
|
+
<icon-delete class="btn-delete" @click="handleDelete(gallery.id)" />
|
|
61
|
+
</div>
|
|
62
|
+
<p class="item-title">标题</p>
|
|
63
|
+
<a-input v-model="gallery.title" placeholder="请输入标题" allow-clear />
|
|
64
|
+
<p class="item-title">文本</p>
|
|
65
|
+
<a-input v-model="gallery.text" placeholder="请输入文本" allow-clear />
|
|
66
|
+
<p class="item-title">图片</p>
|
|
67
|
+
<img class="item-img" :src="gallery.imgSrc" />
|
|
68
|
+
<div class="item-uplaod flex items-center">
|
|
69
|
+
<a-input v-model="gallery.imgSrc" placeholder="请输入图片链接" allow-clear />
|
|
70
|
+
<a-upload class="fit-content" :show-file-list="false" action="/" />
|
|
71
|
+
</div>
|
|
72
|
+
<a-input class="mt-2" v-model="gallery.alt" placeholder="图片alt" allow-clear />
|
|
73
|
+
<p class="item-title">网址</p>
|
|
74
|
+
<a-input v-model="gallery.url" placeholder="请输入网址" allow-clear />
|
|
75
|
+
<p class="item-title">Profile Information</p>
|
|
76
|
+
<ProfileSetting v-if="gallery.profile" :data="gallery.profile" :showLogo="false" :canAddParagraph="true"></ProfileSetting>
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
|
79
|
+
</draggable>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</a-drawer>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script lang="ts" setup>
|
|
87
|
+
import { ref, computed } from 'vue'
|
|
88
|
+
import draggable from 'vuedraggable'
|
|
89
|
+
import ProfileSetting from '@/components/Profile/setting.vue'
|
|
90
|
+
import { randomString } from '@/utils/common'
|
|
91
|
+
|
|
92
|
+
// 拖拽相关状态
|
|
93
|
+
const drag = ref(false)
|
|
94
|
+
|
|
95
|
+
// 不同类型的拖拽配置选项
|
|
96
|
+
const galleryDragOptions = computed(() => ({
|
|
97
|
+
animation: 200,
|
|
98
|
+
group: 'gallerys', // 链接专用分组
|
|
99
|
+
disabled: false,
|
|
100
|
+
ghostClass: 'ghost'
|
|
101
|
+
}))
|
|
102
|
+
|
|
103
|
+
// 检查是否应该显示拖拽图标
|
|
104
|
+
const shouldShowDragHandle = (list: any[]) => {
|
|
105
|
+
return list && list.length > 1
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const props = defineProps({
|
|
109
|
+
show: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: false
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
data: {
|
|
115
|
+
type: Object,
|
|
116
|
+
default: () => {}
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
const emit = defineEmits(['update:show']);
|
|
121
|
+
|
|
122
|
+
const handleCancel = () => {
|
|
123
|
+
emit('update:show', false);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const handleAdd = (type: string) => {
|
|
127
|
+
const detail = props.data;
|
|
128
|
+
detail.data.push({
|
|
129
|
+
id: randomString(),
|
|
130
|
+
type,
|
|
131
|
+
text: '查看更多',
|
|
132
|
+
url: undefined,
|
|
133
|
+
isExternal: false,
|
|
134
|
+
isLight: false
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const handleDelete = (id: string) => {
|
|
139
|
+
props.data.data = props.data.data.filter((item: any) => item.id !== id)
|
|
140
|
+
}
|
|
141
|
+
</script>
|
|
142
|
+
|
|
143
|
+
<style lang="scss" scoped>
|
|
144
|
+
.setting-content {
|
|
145
|
+
.setting-header {
|
|
146
|
+
padding-bottom: 12px;
|
|
147
|
+
|
|
148
|
+
.header-title {
|
|
149
|
+
width: 120px;
|
|
150
|
+
padding-right: 12px;
|
|
151
|
+
text-align: right;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.setting-body {
|
|
156
|
+
margin-top: 12px;
|
|
157
|
+
|
|
158
|
+
.setting-item {
|
|
159
|
+
position: relative;
|
|
160
|
+
padding: 16px 12px;
|
|
161
|
+
background: #f0f2f5;
|
|
162
|
+
border-radius: 8px;
|
|
163
|
+
margin-bottom: 20px;
|
|
164
|
+
|
|
165
|
+
.btn-group {
|
|
166
|
+
position: absolute;
|
|
167
|
+
right: 0;
|
|
168
|
+
top: 0;
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
padding: 4px;
|
|
172
|
+
|
|
173
|
+
.btn-delete {
|
|
174
|
+
padding: 4px;
|
|
175
|
+
font-size: 24px;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.item-name {
|
|
181
|
+
font-size: 16px;
|
|
182
|
+
font-weight: 600;
|
|
183
|
+
padding-bottom: 10px;
|
|
184
|
+
border-bottom: 1px solid #fff;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.item-button {
|
|
188
|
+
position: relative;
|
|
189
|
+
padding: 12px 8px 4px;
|
|
190
|
+
background: #fff;
|
|
191
|
+
border-radius: 4px;
|
|
192
|
+
margin: 4px 0;
|
|
193
|
+
transition: all 0.3s ease;
|
|
194
|
+
|
|
195
|
+
&.draggable-item {
|
|
196
|
+
cursor: move;
|
|
197
|
+
|
|
198
|
+
&:hover {
|
|
199
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
200
|
+
transform: translateY(-1px);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 当禁用拖拽时,不显示拖拽效果
|
|
204
|
+
&.sortable-disabled {
|
|
205
|
+
cursor: default;
|
|
206
|
+
|
|
207
|
+
&:hover {
|
|
208
|
+
box-shadow: none;
|
|
209
|
+
transform: none;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.arco-input-wrapper {
|
|
215
|
+
background: #f2f3f5;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// 拖拽相关样式
|
|
220
|
+
.flip-list-move {
|
|
221
|
+
transition: transform 0.5s;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.no-move {
|
|
225
|
+
transition: transform 0s;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.ghost {
|
|
229
|
+
opacity: 0.5;
|
|
230
|
+
background: #c8ebfb;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.item-action {
|
|
234
|
+
padding: 10px 0;
|
|
235
|
+
|
|
236
|
+
.action-text {
|
|
237
|
+
width: 150px;
|
|
238
|
+
margin-right: 8px;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.item-img {
|
|
243
|
+
height: 100px;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.drag-handle {
|
|
249
|
+
padding: 4px;
|
|
250
|
+
cursor: grab;
|
|
251
|
+
padding: 4px;
|
|
252
|
+
border-radius: 4px;
|
|
253
|
+
|
|
254
|
+
&:hover {
|
|
255
|
+
background-color: #f0f2f5;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&:active {
|
|
259
|
+
cursor: grabbing;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.drag-icon {
|
|
263
|
+
font-size: 16px;
|
|
264
|
+
color: #86909c;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
</style>
|