mirror of
https://gitee.com/dromara/go-view.git
synced 2025-06-30 08:39:15 +08:00
feat: 增加视频组件
This commit is contained in:
parent
96473e6139
commit
65927f4ff5
@ -0,0 +1,30 @@
|
|||||||
|
<template>
|
||||||
|
<div class="SelectItem">
|
||||||
|
<video :src="props.imageUrl" autoplay loop muted playsinline type="video/mp4" style="height: 100%;width: 100%"></video>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const props = defineProps(['imageUrl'])
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.SelectItem{
|
||||||
|
display: inline-block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 100px;
|
||||||
|
width: 100%;
|
||||||
|
margin: 5px;
|
||||||
|
background: #000;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
&:nth-last-child(1) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
&:nth-last-child(2) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.active{
|
||||||
|
border: 1px solid #51d6a9;
|
||||||
|
}
|
||||||
|
</style>
|
@ -7,6 +7,8 @@ import video from '@/assets/videos/earth.mp4'
|
|||||||
export const option = {
|
export const option = {
|
||||||
// 视频路径
|
// 视频路径
|
||||||
dataset: video,
|
dataset: video,
|
||||||
|
// 视频列表
|
||||||
|
datasetList: [],
|
||||||
// 循环播放
|
// 循环播放
|
||||||
loop: true,
|
loop: true,
|
||||||
// 静音
|
// 静音
|
||||||
@ -18,6 +20,11 @@ export const option = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.styles.filterShow = true
|
||||||
|
this.styles.blendMode = 'screen'
|
||||||
|
}
|
||||||
public key = VideoConfig.key
|
public key = VideoConfig.key
|
||||||
public chartConfig = cloneDeep(VideoConfig)
|
public chartConfig = cloneDeep(VideoConfig)
|
||||||
public option = cloneDeep(option)
|
public option = cloneDeep(option)
|
||||||
|
@ -3,11 +3,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<collapse-item name="视频" expanded>
|
<collapse-item name="视频" expanded>
|
||||||
<setting-item-box name="源" alone>
|
<setting-item-box name="源" alone>
|
||||||
<setting-item name="自定义源">
|
<setting-item name="">
|
||||||
<n-input v-model:value="optionData.dataset" size="small"></n-input>
|
<n-select v-model:value="optionData.dataset" :options="datasetList" :render-option="renderOption"></n-select>
|
||||||
|
</setting-item>
|
||||||
|
<!-- <setting-item name="自定义源">-->
|
||||||
|
<!-- <n-input v-model:value="optionData.dataset" size="small"></n-input>-->
|
||||||
|
<!-- </setting-item>-->
|
||||||
|
</setting-item-box>
|
||||||
|
<setting-item-box name="混合模式" alone>
|
||||||
|
<setting-item name="">
|
||||||
|
<n-select v-model:value="chartStyles.blendMode" :options="BlendModeEnumList"></n-select>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
|
|
||||||
<setting-item-box name="控制">
|
<setting-item-box name="控制">
|
||||||
<setting-item>
|
<setting-item>
|
||||||
<n-checkbox v-model:checked="optionData.loop" size="small">循环播放</n-checkbox>
|
<n-checkbox v-model:checked="optionData.loop" size="small">循环播放</n-checkbox>
|
||||||
@ -26,9 +33,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType } from 'vue'
|
import { PropType, ref, h, VNodeChild } from 'vue'
|
||||||
|
import { SelectOption, SelectGroupOption } from 'naive-ui'
|
||||||
import { option } from './config'
|
import { option } from './config'
|
||||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||||
|
import SelectItem from './SelectItem.vue'
|
||||||
|
import { PickCreateComponentType, BlendModeEnumList } from '@/packages/index.d'
|
||||||
|
|
||||||
|
|
||||||
// 适应类型
|
// 适应类型
|
||||||
const fitList = [
|
const fitList = [
|
||||||
@ -54,10 +65,42 @@ const fitList = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
defineProps({
|
const props = defineProps({
|
||||||
optionData: {
|
optionData: {
|
||||||
type: Object as PropType<typeof option>,
|
type: Object as PropType<typeof option>,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
chartStyles: {
|
||||||
|
type: Object as PropType<Omit<PickCreateComponentType<'styles'>, 'animations'>>,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const datasetList = ref([
|
||||||
|
'https://goviewpro.tos-cn-beijing.volces.com/charts-img-db/charts-img-db_id_17bwi76fzta800.mp4',
|
||||||
|
'https://goviewpro.tos-cn-beijing.volces.com/charts-img-db/charts-img-db_id_cqlw0qmjt4o00.mp4',
|
||||||
|
'https://easyv.assets.dtstack.com/data/video/105262/1634995/hieui98oid_1675409080094_4wtvy7l8fn.mp4'
|
||||||
|
].map(_ => ({ label: _, value: _ })))
|
||||||
|
|
||||||
|
const renderOption = (info: {option: SelectOption}): VNodeChild => {
|
||||||
|
return [
|
||||||
|
h(
|
||||||
|
SelectItem,
|
||||||
|
{
|
||||||
|
imageUrl: info.option.value,
|
||||||
|
onClick: () => handleClick(info.option.value as string),
|
||||||
|
class: {
|
||||||
|
active: info.option.value === props.optionData.dataset,
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
width: 'calc(50% - 10px)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleClick = (v: string) => {
|
||||||
|
props.optionData.dataset = v
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -4,4 +4,4 @@ import { IframeConfig } from './Iframe/index'
|
|||||||
import { VideoConfig } from './Video/index'
|
import { VideoConfig } from './Video/index'
|
||||||
import { WordCloudConfig } from './WordCloud/index'
|
import { WordCloudConfig } from './WordCloud/index'
|
||||||
|
|
||||||
export default [ImageConfig, ImageCarouselConfig, VideoConfig, IframeConfig, WordCloudConfig]
|
export default [VideoConfig]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Texts from './Texts'
|
import Texts from './Texts'
|
||||||
// import Inputs from './Inputs'
|
// import Inputs from './Inputs'
|
||||||
// import Mores from './Mores'
|
import Mores from './Mores'
|
||||||
|
|
||||||
// export const InformationList = [...Texts, ...Inputs, ...Mores]
|
// export const InformationList = [...Texts, ...Inputs, ...Mores]
|
||||||
export const InformationList = [...Texts]
|
export const InformationList = [...Texts, ...Mores]
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<!-- 滤镜 -->
|
<!-- 滤镜 -->
|
||||||
<styles-setting :isGroup="targetData.isGroup" :chartStyles="targetData.styles"></styles-setting>
|
<styles-setting :isGroup="targetData.isGroup" :chartStyles="targetData.styles"></styles-setting>
|
||||||
<!-- 自定义配置项 -->
|
<!-- 自定义配置项 -->
|
||||||
<component :is="targetData.chartConfig.conKey" :optionData="targetData.option"></component>
|
<component :is="targetData.chartConfig.conKey" :optionData="targetData.option" :chartStyles="targetData.styles"></component>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user