|
@@ -1,4 +1,4 @@
|
|
-import { PropType, defineComponent } from 'vue';
|
|
|
|
|
|
+import { PropType, defineComponent, ref } from 'vue';
|
|
import styles from './index.module.less';
|
|
import styles from './index.module.less';
|
|
import { NButton, NCard, NImage } from 'naive-ui';
|
|
import { NButton, NCard, NImage } from 'naive-ui';
|
|
import iconImage from '@common/images/icon-image.png';
|
|
import iconImage from '@common/images/icon-image.png';
|
|
@@ -6,11 +6,14 @@ import iconVideo from '@common/images/icon-video.png';
|
|
import iconAudio from '@common/images/icon-audio.png';
|
|
import iconAudio from '@common/images/icon-audio.png';
|
|
import iconMusic from '@common/images/icon-music.png';
|
|
import iconMusic from '@common/images/icon-music.png';
|
|
import TheNoticeBar from '../TheNoticeBar';
|
|
import TheNoticeBar from '../TheNoticeBar';
|
|
|
|
+import AudioPlayer from './audio-player';
|
|
|
|
+import VideoPlayer from './video-player ';
|
|
|
|
|
|
type itemType = {
|
|
type itemType = {
|
|
id: string | number;
|
|
id: string | number;
|
|
type: 'IMG' | 'VIDEO' | 'AUDIO' | 'SONG';
|
|
type: 'IMG' | 'VIDEO' | 'AUDIO' | 'SONG';
|
|
url: string;
|
|
url: string;
|
|
|
|
+ content?: string;
|
|
title: string;
|
|
title: string;
|
|
isCollect: boolean;
|
|
isCollect: boolean;
|
|
isSelected: boolean;
|
|
isSelected: boolean;
|
|
@@ -39,6 +42,11 @@ export default defineComponent({
|
|
type: Boolean,
|
|
type: Boolean,
|
|
default: false
|
|
default: false
|
|
},
|
|
},
|
|
|
|
+ // 鼠标移动上面的时候是否自动播放,或者可以点击
|
|
|
|
+ disabledMouseHover: {
|
|
|
|
+ type: Boolean,
|
|
|
|
+ default: true
|
|
|
|
+ },
|
|
item: {
|
|
item: {
|
|
type: Object as PropType<itemType>,
|
|
type: Object as PropType<itemType>,
|
|
default: () => ({})
|
|
default: () => ({})
|
|
@@ -80,16 +88,34 @@ export default defineComponent({
|
|
props.isActive ? styles.isActive : ''
|
|
props.isActive ? styles.isActive : ''
|
|
]}>
|
|
]}>
|
|
{{
|
|
{{
|
|
- cover: () =>
|
|
|
|
- ['IMG', 'VIDEO', 'SONG', 'AUDIO'].includes(props.item.type) && (
|
|
|
|
- <NImage
|
|
|
|
- class={[styles.cover, styles.image]}
|
|
|
|
- lazy
|
|
|
|
- previewDisabled
|
|
|
|
- objectFit="cover"
|
|
|
|
- src={props.item.url}
|
|
|
|
- />
|
|
|
|
- ),
|
|
|
|
|
|
+ cover: () => (
|
|
|
|
+ <>
|
|
|
|
+ {['IMG', 'SONG'].includes(props.item.type) && (
|
|
|
|
+ <NImage
|
|
|
|
+ class={[styles.cover, styles.image]}
|
|
|
|
+ lazy
|
|
|
|
+ previewDisabled={props.disabledMouseHover}
|
|
|
|
+ objectFit="cover"
|
|
|
|
+ src={props.item.url}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ {/* 音频 */}
|
|
|
|
+ {props.item.type === 'AUDIO' && (
|
|
|
|
+ <AudioPlayer
|
|
|
|
+ content={props.item.content}
|
|
|
|
+ previewDisabled={props.disabledMouseHover}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ {/* 视频 */}
|
|
|
|
+ {props.item.type === 'VIDEO' && (
|
|
|
|
+ <VideoPlayer
|
|
|
|
+ cover={props.item.url}
|
|
|
|
+ content={props.item.content}
|
|
|
|
+ previewDisabled={props.disabledMouseHover}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ </>
|
|
|
|
+ ),
|
|
footer: () => (
|
|
footer: () => (
|
|
<div class={styles.footer}>
|
|
<div class={styles.footer}>
|
|
<div class={styles.title}>
|
|
<div class={styles.title}>
|