Showing
7 changed files
with
34 additions
and
12 deletions
src/packages/components/external/Composes/Mores/Camera/components/CameraItem.vue
renamed from
src/packages/components/external/Composes/Mores/Camera/cameraItem.vue
... | ... | @@ -7,12 +7,13 @@ export const option = { |
7 | 7 | dataset: [ |
8 | 8 | { |
9 | 9 | url: '' |
10 | - }, | |
10 | + } | |
11 | 11 | ] as any, |
12 | 12 | // 自动播放的间隔(ms) |
13 | 13 | interval: 5000, |
14 | 14 | autoplay: true, |
15 | - effect: 'slide' | |
15 | + effect: 'slide', | |
16 | + displayMode: 'singleGrid' | |
16 | 17 | } |
17 | 18 | |
18 | 19 | export default class Config extends PublicConfigClass implements CreateComponentType { | ... | ... |
... | ... | @@ -13,6 +13,11 @@ |
13 | 13 | </n-button> |
14 | 14 | </setting-item> |
15 | 15 | </setting-item-box> |
16 | + <setting-item-box name="排布"> | |
17 | + <setting-item> | |
18 | + <n-select v-model:value="optionData.displayMode" size="small" :options="displayModeOptions"></n-select> | |
19 | + </setting-item> | |
20 | + </setting-item-box> | |
16 | 21 | </CollapseItem> |
17 | 22 | </template> |
18 | 23 | |
... | ... | @@ -27,4 +32,20 @@ defineProps({ |
27 | 32 | required: true |
28 | 33 | } |
29 | 34 | }) |
35 | + | |
36 | +// 旋转方式 | |
37 | +const displayModeOptions = [ | |
38 | + { | |
39 | + value: 'singleGrid', | |
40 | + label: '默认' | |
41 | + }, | |
42 | + { | |
43 | + value: 'fourGrid', | |
44 | + label: '四宫格' | |
45 | + }, | |
46 | + { | |
47 | + value: 'nineGrid', | |
48 | + label: '九宫格' | |
49 | + } | |
50 | +] | |
30 | 51 | </script> | ... | ... |
1 | 1 | <template> |
2 | 2 | <div class="banner-box" ref="root"> |
3 | - <div class="wrapper"> | |
3 | + <div class="wrapper"> | |
4 | 4 | <div v-for="(item, index) in option.dataset" :key="index + item" :class="item.className" :style="item.sty"> |
5 | 5 | <CameraItem |
6 | 6 | ref="cameraRef" |
... | ... | @@ -24,7 +24,7 @@ import { PropType, watch, toRefs, shallowReactive, onMounted, ref } from 'vue' |
24 | 24 | import { CreateComponentType } from '@/packages/index.d' |
25 | 25 | import 'video.js/dist/video-js.min.css' |
26 | 26 | import { option as configOption } from './config' |
27 | -import CameraItem from './cameraItem.vue' | |
27 | +import { CameraItem } from './components' | |
28 | 28 | |
29 | 29 | const props = defineProps({ |
30 | 30 | chartConfig: { |
... | ... | @@ -83,7 +83,7 @@ const computedFunc = (initial: number, source: any) => { |
83 | 83 | } |
84 | 84 | item.sty = { |
85 | 85 | transform, |
86 | - zIndex, | |
86 | + zIndex | |
87 | 87 | } |
88 | 88 | item.className = className |
89 | 89 | return item |
... | ... | @@ -101,6 +101,7 @@ watch( |
101 | 101 | deep: true |
102 | 102 | } |
103 | 103 | ) |
104 | + | |
104 | 105 | option.dataset = computedFunc(initial.value, option.dataset) |
105 | 106 | |
106 | 107 | watch( |
... | ... | @@ -109,6 +110,7 @@ watch( |
109 | 110 | option.dataset = computedFunc(newV, option.dataset) |
110 | 111 | } |
111 | 112 | ) |
113 | + | |
112 | 114 | // 处理自动轮播 |
113 | 115 | let timer: any = null |
114 | 116 | |
... | ... | @@ -135,13 +137,11 @@ onMounted(() => { |
135 | 137 | // 点击左右按钮切换图片 |
136 | 138 | function changeVideo(dir: string) { |
137 | 139 | if (dir === 'left') { |
138 | - // cameraRef.value?.handleVideoPlay() | |
139 | 140 | clearInterval(timer) |
140 | 141 | initial.value++ |
141 | 142 | initial.value >= option.dataset.length ? (initial.value = 0) : false |
142 | 143 | return |
143 | 144 | } |
144 | - // cameraRef.value?.handleVideoDispose() | |
145 | 145 | initial.value-- |
146 | 146 | initial.value < 0 ? (initial.value = option.dataset.length - 1) : false |
147 | 147 | } |
... | ... | @@ -155,16 +155,13 @@ function changeSlide(dir: string) { |
155 | 155 | <style lang="scss" scoped> |
156 | 156 | .banner-box { |
157 | 157 | .wrapper { |
158 | - // width: 100%; | |
159 | 158 | height: 100%; |
160 | - // position: relative; | |
161 | 159 | display: flex; |
162 | 160 | overflow: hidden; |
163 | 161 | .slide { |
164 | 162 | width: 20%; |
165 | 163 | height: 100%; |
166 | 164 | position: absolute; |
167 | - // top: 50%; | |
168 | 165 | left: 10%; |
169 | 166 | transform: translateX(-50%); |
170 | 167 | transition: 0.5s; |
... | ... | @@ -193,12 +190,12 @@ function changeSlide(dir: string) { |
193 | 190 | } |
194 | 191 | a.left { |
195 | 192 | @extend .arrow; |
196 | - background-image: url(./left.svg); | |
193 | + background-image: url(./static/left.svg); | |
197 | 194 | left: 0px; |
198 | 195 | } |
199 | 196 | a.right { |
200 | 197 | @extend .arrow; |
201 | - background-image: url(./right.svg); | |
198 | + background-image: url(./static/right.svg); | |
202 | 199 | right: 0px; |
203 | 200 | } |
204 | 201 | } | ... | ... |
src/packages/components/external/Composes/Mores/Camera/static/left.svg
renamed from
src/packages/components/external/Composes/Mores/Camera/left.svg
src/packages/components/external/Composes/Mores/Camera/static/right.svg
renamed from
src/packages/components/external/Composes/Mores/Camera/right.svg