import React, { useEffect } from 'react';
import { Modal, Carousel } from 'antd';
import { VideoCameraOutlined, AudioOutlined, DownloadOutlined } from '@ant-design/icons';
import { combine, useStates } from 'common';
import { Img } from './common';
import style from './style.module.less';
/**
* 图片预览
*/
export const Preview = combine(({ stores }) => {
const { previewSrc, previewType, previewName, previewHide } = stores.layout;
const { states, setStates } = useStates({ visible: false, src: '' });
const { visible, src } = states;
useEffect(() => {
if (previewSrc) {
setStates({ src: previewSrc, visible: true });
} else {
setStates({ visible: false });
}
}, [previewSrc]);
return (
{(() => {
switch (previewType) {
case 'image':
return
;
case 'video':
return ;
case 'audio':
return ;
case 'imageGroup':
return (
{[...src].map(i => (
))}
);
}
})()}
);
});
export type TPreviewColumnProps = {
src: string;
type?: 'image' | 'video' | 'audio' | 'other' | 'imageGroup';
name?: string;
};
/**
* 预览列
*/
export const PreviewColumn: React.FC = combine(({ stores, src, type = 'image', name = '' }) => {
if (!src || !src[0]) return null;
const { preview } = stores.layout;
const props = { className: `pointer ${style.previewColumn}`, onClick: () => preview(src, type, name) };
if (type === 'image') return
;
else if (type === 'video') return ;
else if (type === 'audio') return ;
else if (type === 'imageGroup') return
;
return (
);
});