<script lang="ts" setup>
|
import { computed, onMounted } from 'vue';
|
|
import { getDataInterfaceRes } from '#/api/systemData/dataInterface';
|
import { getAuthMediaUrl, getParamList } from '#/utils/jnpf';
|
|
import CardHeader from '../CardHeader/index.vue';
|
|
const props = defineProps(['activeData']);
|
|
const getValue = computed(() => {
|
const val = props.activeData.option.defaultValue;
|
if (props.activeData.option.styleType == 1 && val.url) return getAuthMediaUrl(val.url);
|
return val;
|
});
|
|
function initData() {
|
if (props.activeData.dataType === 'dynamic') {
|
props.activeData.option.defaultValue = '';
|
const propsApi = props.activeData.propsApi;
|
if (!propsApi) return;
|
const query = { paramList: getParamList(props.activeData.templateJson) };
|
getDataInterfaceRes(propsApi, query).then((res) => {
|
props.activeData.option.defaultValue = res.data;
|
});
|
}
|
}
|
|
onMounted(() => initData());
|
</script>
|
<template>
|
<a-card class="portal-card-box">
|
<template #title v-if="activeData.title">
|
<CardHeader :title="activeData.title" :card="activeData.card" />
|
</template>
|
<div class="portal-card-body h-full">
|
<template v-if="getValue">
|
<video
|
class="h-full w-full"
|
controls
|
:loop="activeData.option.playNumber === 2"
|
:autoplay="activeData.option.videoAutoplay"
|
:muted="activeData.option.mutePlay">
|
<source :src="getValue" type="video/mp4" />
|
</video>
|
</template>
|
<div class="portal-common-noData" v-else>
|
<img src="@/assets/images/portal/nodata.png" alt="" class="noData-img" />
|
<p class="noData-txt">暂无视频</p>
|
</div>
|
</div>
|
</a-card>
|
</template>
|