@opendesign-plus-test/components 0.0.1-rc.2

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.
Files changed (52) hide show
  1. package/dist/components.cjs.js +1 -0
  2. package/dist/components.css +1 -0
  3. package/dist/components.es.js +1193 -0
  4. package/dist/components.umd.js +1 -0
  5. package/docs/design.md +27 -0
  6. package/docs/design_banner.md +41 -0
  7. package/docs/design_section.md +27 -0
  8. package/package.json +47 -0
  9. package/scripts/generate-components-index.js +81 -0
  10. package/src/assets/svg-icons/icon-chevron-right.svg +3 -0
  11. package/src/assets/svg-icons/icon-close.svg +3 -0
  12. package/src/assets/svg-icons/icon-delete.svg +3 -0
  13. package/src/assets/svg-icons/icon-header-back.svg +3 -0
  14. package/src/assets/svg-icons/icon-header-delete.svg +3 -0
  15. package/src/assets/svg-icons/icon-header-search.svg +4 -0
  16. package/src/assets/svg-icons/icon-moon.svg +3 -0
  17. package/src/assets/svg-icons/icon-sun.svg +3 -0
  18. package/src/components/OBanner.vue +390 -0
  19. package/src/components/OCookieNotice.vue +417 -0
  20. package/src/components/OCookieNoticeEl.vue +403 -0
  21. package/src/components/OHeaderSearch.vue +601 -0
  22. package/src/components/OPlusConfigProvider.vue +32 -0
  23. package/src/components/OSection.vue +178 -0
  24. package/src/components/OThemeSwitcher.vue +108 -0
  25. package/src/components/common/ClientOnlyWrapper.ts +21 -0
  26. package/src/components/common/ContentWrapper.vue +85 -0
  27. package/src/draft/Banner.vue +265 -0
  28. package/src/draft/ButtonCards.vue +106 -0
  29. package/src/draft/Feature.vue +134 -0
  30. package/src/draft/Footer.vue +512 -0
  31. package/src/draft/HorizontalAnchor.vue +165 -0
  32. package/src/draft/ItemSwiper.vue +133 -0
  33. package/src/draft/Logo.vue +141 -0
  34. package/src/draft/LogoCard.vue +75 -0
  35. package/src/draft/LogoV2.vue +19 -0
  36. package/src/draft/MainCard.vue +38 -0
  37. package/src/draft/MultiCard.vue +95 -0
  38. package/src/draft/MultiIconCard.vue +74 -0
  39. package/src/draft/OInfoCard.vue +176 -0
  40. package/src/draft/Process.vue +81 -0
  41. package/src/draft/Section.vue +167 -0
  42. package/src/draft/SingleTabCard.vue +85 -0
  43. package/src/draft/SliderCard.vue +110 -0
  44. package/src/env.d.ts +1 -0
  45. package/src/i18n/en.ts +20 -0
  46. package/src/i18n/index.ts +42 -0
  47. package/src/i18n/zh.ts +9 -0
  48. package/src/index.ts +34 -0
  49. package/src/shared/provide.ts +6 -0
  50. package/src/vue.d.ts +10 -0
  51. package/tsconfig.json +33 -0
  52. package/vite.config.ts +90 -0
@@ -0,0 +1,390 @@
1
+ <script setup lang="ts">
2
+ import { OButton, OCarousel, OCarouselItem, OFigure } from '@opensig/opendesign';
3
+ import { computed, ref } from 'vue';
4
+
5
+ import { useScreen, useTheme } from '@opendesign-plus/composables';
6
+ import ContentWrapper from './common/ContentWrapper.vue';
7
+
8
+ const props = defineProps({
9
+ options: undefined,
10
+ size: 'large',
11
+ contentJustifyCenter: false,
12
+ });
13
+
14
+ const { isLight } = useTheme('opendesignplus', document.domain || 'localhost');
15
+ const { isPhone } = useScreen();
16
+
17
+ const bannerInfo = computed(() => props.options);
18
+
19
+ // 主题切换
20
+ const theme = ref('');
21
+ const onBeforeChange = (idx: number) => {
22
+ setTimeout(() => {
23
+ theme.value = bannerInfo.value[idx].bg_theme ?? 'light';
24
+ }, 100);
25
+ };
26
+
27
+ // banner跳转
28
+ const onClick = (href: string, hasBtn: boolean | undefined) => {
29
+ if (href && !hasBtn) {
30
+ window.open(href);
31
+ }
32
+ };
33
+ </script>
34
+
35
+ <template>
36
+ <div :class="['home-banner', size]">
37
+ <div v-if="size === 'tiny'">
38
+ {{ bannerInfo[1].title }}
39
+ </div>
40
+
41
+ <OCarousel
42
+ v-else-if="!isPhone"
43
+ class="banner-carousel"
44
+ effect="toggle"
45
+ active-class="current-slide"
46
+ indicator-click
47
+ :auto-play="true"
48
+ :data-o-theme="theme"
49
+ @before-change="onBeforeChange"
50
+ >
51
+ <OCarouselItem v-for="(info, index) in bannerInfo" :key="index" class="banner-item" :class="`banner-item${index}`">
52
+ <OFigure
53
+ class="banner-bg"
54
+ :src="info.bg"
55
+ :class="{
56
+ 'with-sticky-bg': info.withStickyBg,
57
+ 'in-dark': !isLight,
58
+ 'cursor-pointer': info.href && !info.btn,
59
+ }"
60
+ :style="{
61
+ '--pad-offset': info.pad_offset,
62
+ }"
63
+ @click="onClick(info.href, info.btn)"
64
+ >
65
+ <ContentWrapper class="banner-wrapper" :class="['banner-wrapper', contentJustifyCenter ? 'content-center' : '']">
66
+ <div class="banner-content">
67
+ <img v-if="!isPhone && info.attach" :src="info.attach" class="banner-attach" />
68
+
69
+ <!-- 标题 -->
70
+ <div class="banner-title" v-if="info.title">{{ info.title }}</div>
71
+ <!-- 副标题 -->
72
+ <div class="banner-subtitle" v-if="info.subtitle">{{ info.subtitle }}</div>
73
+ <div
74
+ class="banner-text"
75
+ v-if="info.bg_text"
76
+ :style="{
77
+ backgroundImage: `url(${info.bg_text})`,
78
+ '--pc-width': info.pc_text_width,
79
+ '--pc-height': info.pc_text_height,
80
+ '--pad-width': info.pad_text_width,
81
+ '--pad-height': info.pad_text_height,
82
+ }"
83
+ ></div>
84
+ <!-- 操作按钮 -->
85
+ <div v-if="info.btn" class="banner-opts">
86
+ <OButton :href="info.href" target="_blank" variant="solid" color="primary" :size="size">
87
+ {{ info.btn }}
88
+ </OButton>
89
+ </div>
90
+ </div>
91
+ </ContentWrapper>
92
+ </OFigure>
93
+ </OCarouselItem>
94
+ </OCarousel>
95
+
96
+ <OCarousel
97
+ v-else="isPhone"
98
+ class="banner-carousel"
99
+ effect="gallery"
100
+ indicator-click
101
+ :data-o-theme="theme"
102
+ arrow="never"
103
+ :auto-play="true"
104
+ @before-change="onBeforeChange"
105
+ >
106
+ <OCarouselItem v-for="(info, index) in bannerInfo" class="banner-item" :class="`banner-item${index}`">
107
+ <ContentWrapper class="banner-wrapper">
108
+ <OFigure class="banner-bg" :src="info.bg" @click="onClick(info.href)" />
109
+ </ContentWrapper>
110
+ </OCarouselItem>
111
+ </OCarousel>
112
+ </div>
113
+ </template>
114
+
115
+ <style lang="scss" scoped>
116
+ .home-banner {
117
+ overflow: hidden;
118
+ position: relative;
119
+
120
+ &.tiny {
121
+ @include display2;
122
+ font-weight: 500;
123
+ margin: var(--o-gap-8) 0;
124
+ color: var(--o-color-info1);
125
+ }
126
+
127
+ .banner-title {
128
+ color: var(--o-color-info1);
129
+ font-weight: 500;
130
+ font-size: 48px; // 基础字体大小
131
+ margin-bottom: 8px;
132
+ }
133
+
134
+ .banner-subtitle {
135
+ color: var(--o-color-info1);
136
+ margin-top: 8px;
137
+ font-size: 16px;
138
+ }
139
+
140
+ .banner-text {
141
+ height: var(--pc-height);
142
+ width: var(--pc-width);
143
+ background-size: contain;
144
+ background-repeat: no-repeat;
145
+
146
+ @include respond-to('pad') {
147
+ height: var(--pad-height);
148
+ width: var(--pad-width);
149
+ }
150
+ }
151
+
152
+ &.large {
153
+ --banner-height: 460px;
154
+ height: var(--banner-height);
155
+
156
+ .banner-title {
157
+ @include display1;
158
+ }
159
+
160
+ .banner-subtitle {
161
+ @include h4;
162
+ }
163
+
164
+ @include respond-to('laptop-pc_s') {
165
+ --banner-height: 400px;
166
+ }
167
+
168
+ @include respond-to('pad_h') {
169
+ --banner-height: 360px;
170
+ }
171
+
172
+ @include respond-to('<=pad_v') {
173
+ --banner-height: 184px;
174
+ }
175
+ }
176
+
177
+ &.medium {
178
+ --banner-height: 360px;
179
+ height: var(--banner-height);
180
+
181
+ .banner-title {
182
+ @include display2;
183
+ }
184
+
185
+ .banner-subtitle {
186
+ @include text2;
187
+ }
188
+
189
+ @include respond-to('laptop-pc_s') {
190
+ --banner-height: 280px;
191
+ }
192
+
193
+ @include respond-to('pad_h') {
194
+ --banner-height: 220px;
195
+ }
196
+
197
+ @include respond-to('<=pad_v') {
198
+ --banner-height: 120px;
199
+ }
200
+
201
+ .banner-text {
202
+ --pc-height: 100px !important;
203
+ --pc-width: 500px !important;
204
+
205
+ @include respond-to('pad') {
206
+ --pc-height: 60px !important;
207
+ --pc-width: 300px !important;
208
+ }
209
+ }
210
+ }
211
+
212
+ &.small {
213
+ --banner-height: 280px;
214
+ height: var(--banner-height);
215
+
216
+ .banner-title {
217
+ @include display2;
218
+ }
219
+
220
+ .banner-subtitle {
221
+ @include text2;
222
+ }
223
+
224
+ @include respond-to('laptop-pc_s') {
225
+ --banner-height: 220px;
226
+ }
227
+
228
+ @include respond-to('pad_h') {
229
+ --banner-height: 180px;
230
+ }
231
+
232
+ @include respond-to('<=pad_v') {
233
+ display: none;
234
+ }
235
+
236
+ .banner-text {
237
+ --pc-height: 80px !important;
238
+ --pc-width: 400px !important;
239
+
240
+ @include respond-to('pad') {
241
+ --pc-height: 50px !important;
242
+ --pc-width: 250px !important;
243
+ }
244
+ }
245
+ }
246
+
247
+ :deep(.o-btn) {
248
+ border-radius: var(--btn-height);
249
+ }
250
+ }
251
+
252
+ .banner-carousel {
253
+ width: 100%;
254
+ height: 100%;
255
+ @include respond-to('>pad_v') {
256
+ --carousel-indicator-offset: 53px;
257
+ }
258
+
259
+ @include respond-to('<=pad_v') {
260
+ --carousel-indicator-offset: 1px;
261
+ }
262
+
263
+ :deep(.o-carousel-indicator-bar) {
264
+ height: 24px;
265
+ }
266
+ }
267
+
268
+ .banner-item {
269
+ width: 100%;
270
+ height: 100%;
271
+ }
272
+
273
+ .banner-bg {
274
+ width: 100%;
275
+ height: 100%;
276
+
277
+ :deep(.o-figure-img) {
278
+ width: 100%;
279
+ height: 100%;
280
+ }
281
+
282
+ @include respond-to('pad') {
283
+ :deep(.o-figure-img) {
284
+ transition: object-position 0.3s ease;
285
+ object-position: var(--pad-offset);
286
+ }
287
+ }
288
+
289
+ @include respond-to('phone') {
290
+ --figure-radius: 4px;
291
+ }
292
+ }
293
+
294
+ .banner-wrapper {
295
+ height: 100%;
296
+
297
+ &.content-center {
298
+ display: flex;
299
+ justify-content: center;
300
+
301
+ & .banner-content {
302
+ align-items: center;
303
+ }
304
+ }
305
+ }
306
+
307
+ .banner-content {
308
+ height: 100%;
309
+ display: inline-flex;
310
+ flex-direction: column;
311
+ justify-content: center;
312
+ position: relative;
313
+ }
314
+
315
+ .banner-opts {
316
+ margin-top: 24px;
317
+ --d: 20px;
318
+ }
319
+
320
+ @keyframes fade-up {
321
+ from {
322
+ transform: translateY(var(--d));
323
+ opacity: 0;
324
+ }
325
+ to {
326
+ transform: translateY(0);
327
+ opacity: 1;
328
+ }
329
+ }
330
+
331
+ .current-slide {
332
+ .banner-title {
333
+ animation: fade-up 400ms ease-in;
334
+ }
335
+ .banner-subtitle {
336
+ animation: fade-up 400ms ease-in;
337
+ }
338
+ .banner-text {
339
+ animation: fade-up 400ms ease-in;
340
+ }
341
+ .banner-opts {
342
+ animation: fade-up 400ms ease-in;
343
+ }
344
+ }
345
+
346
+ .in-dark.with-sticky-bg {
347
+ :deep(.o-figure-img) {
348
+ @include img-in-dark;
349
+ }
350
+ }
351
+ .cursor-pointer {
352
+ cursor: pointer;
353
+ }
354
+ </style>
355
+
356
+ <style lang="scss" scoped>
357
+ // 定制修改item1
358
+ .banner-item0 {
359
+ .banner-attach {
360
+ height: 120px;
361
+
362
+ @include respond-to('pad') {
363
+ height: 80px;
364
+ }
365
+ }
366
+ }
367
+
368
+ .banner-item1 {
369
+ .banner-attach {
370
+ height: 156px;
371
+
372
+ @include respond-to('pad') {
373
+ height: 120px;
374
+ }
375
+ }
376
+ }
377
+
378
+ // 定制修改item2
379
+ .banner-item2 {
380
+ .banner-content {
381
+ width: 100%;
382
+ justify-content: center;
383
+ }
384
+ .banner-attach {
385
+ height: 38%;
386
+ margin-top: -60px;
387
+ object-fit: contain;
388
+ }
389
+ }
390
+ </style>