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