fix: 修改变量名字

This commit is contained in:
YuanHongbo 2024-04-09 19:48:19 +08:00
parent 37794c50f3
commit 911ae99e27
13 changed files with 41 additions and 41 deletions

View File

@ -15,7 +15,7 @@ interface RealTimeMonitorProps {
/*
*/
handleDownloadImg?: (imgSrc?: string) => void;
handleDownloadImg?: (imageKey?: string) => void;
/*
*/

View File

@ -13,7 +13,7 @@ interface WarningRecordListProps {
/*
*/
handleDownloadImg?: (imgSrc?: string) => void;
handleDownloadImg?: (imageKey?: string) => void;
/*
*/

View File

@ -48,15 +48,15 @@ export default () => {
})
}
const handleDownloadImg = (imgSrc?: string) => {
console.log(imgSrc)
const handleDownloadImg = (imageKey?: string) => {
console.log(imageKey)
// 可以调用 下面 方法关闭弹窗
// viewLargerImageModalRef.current?.handleCancel()
}
const onRecordClick = (record?: IRecord) => {
// 点击的时候把数据 拿过来处理一下传给大图弹框
const { imgSrc, warningType, boxId, position, cabietId, warningTime, warningTimestamp, warningTimeFormat = 'YYYY-MM-DD HH:mm:ss' } = record || {}
const { imageKey, warningType, boxId, position, cabietId, warningTime, warningTimestamp, warningTimeFormat = 'YYYY-MM-DD HH:mm:ss' } = record || {}
const formattedDate = warningTimestamp ? dayjs(warningTimestamp).format(warningTimeFormat) : '';
const warningTimeShow = warningTime ? warningTime : formattedDate
//用于渲染右侧的 信息
@ -68,7 +68,7 @@ export default () => {
{ label: '柜子ID', value: cabietId },
]
// 调用这个方法打开弹框
viewLargerImageModalRef?.current?.show({ imgSrc: imgSrc, warningData: warningData })
viewLargerImageModalRef?.current?.show({ imageKey: imageKey, warningData: warningData })
setSelectedRecordId(record?.id)
}
@ -89,7 +89,7 @@ export default () => {
// 模拟 视频数据请求
setTimeout(() => {
// 对后端返回数据进行处理 组装一套符合属性的 数据
const newVideoData: VideoPlayerCardProps = { imgSrc: videoData.imgSrc, title: videoData.title, }
const newVideoData: VideoPlayerCardProps = { imageKey: videoData.imageKey, title: videoData.title, }
setVideoDataSource((pre) => {
const newVideoDataSource: VideoPlayerCardProps[] = pre.map((item) => {
// 传给 选中的视频窗口
@ -121,7 +121,7 @@ export default () => {
setTimeout(() => {
const newWarningDataSource: IRecord[] = warningData.map(o => {
return {
imgSrc: o.imgSrc,
imageKey: o.imageKey,
id: o.id,
warningType: o.warningType,
boxId: o.boxId,

View File

@ -1,12 +1,12 @@
export const videoData = {
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
// videoSrc: 'ws://10.0.0.7:9033/flv/File/test/test_h264_1.mp4.flv?ip=127.0.0.1',
title: `盒子1 点位1`
}
export const warningData = [
{
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
id: '156156ewr1',
warningType: '火焰识别',
boxId: '2',
@ -17,7 +17,7 @@ export const warningData = [
// warningTimeFormat:"YYYY-MM-DD"
},
{
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
id: '156156ewr155',
warningType: '火焰识别',
boxId: '1',
@ -28,7 +28,7 @@ export const warningData = [
// warningTimeFormat:"YYYY-MM-DD"
},
{
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
id: '156156rew155',
warningType: '火焰识别',
boxId: '3',
@ -39,7 +39,7 @@ export const warningData = [
// warningTimeFormat:"YYYY-MM-DD"
},
{
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
id: '15615615ew5',
warningType: '火焰识别',
boxId: '4',
@ -50,7 +50,7 @@ export const warningData = [
// warningTimeFormat:"YYYY-MM-DD"
},
{
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
id: '15615615sdf5',
warningType: '火焰识别',
boxId: '5',

View File

@ -8,7 +8,7 @@ export interface VideoPlayerCardProps {
windowKey?: string;
selectedWindowKey?: string;
showType?: 'video' | "image";
imgSrc?: string;
imageKey?: string;
videoSrc?: string;
cardProps?: CardProps;
errorReasonText?: string;
@ -22,7 +22,7 @@ export interface VideoPlayerCardProps {
export const VideoPlayerCard: React.FC<VideoPlayerCardProps> = (props) => {
const componentName = `zhst-biz-video-player-card`;
const { showType, imgSrc, videoSrc, cardProps, isWindowLoading, errorReasonText, size, title, handleCloseButtonClick, handleWindowClick, windowKey, selectedWindowKey = '' } = props;
const { showType, imageKey, videoSrc, cardProps, isWindowLoading, errorReasonText, size, title, handleCloseButtonClick, handleWindowClick, windowKey, selectedWindowKey = '' } = props;
const [cardContent, setCardContent] = useState<JSX.Element | null>(null);
const { useToken } = theme
const { token } = useToken()
@ -37,7 +37,7 @@ export const VideoPlayerCard: React.FC<VideoPlayerCardProps> = (props) => {
const videoPlayerCardStyle = size === 'small' ? { width: "calc(50% - 20px)" } : { flex: 1 }
useEffect(() => {
if (!isWindowLoading && (videoSrc || imgSrc)) {
if (!isWindowLoading && (videoSrc || imageKey)) {
let contentElement: JSX.Element | null = null;
if (videoSrc) {
contentElement = (
@ -45,11 +45,11 @@ export const VideoPlayerCard: React.FC<VideoPlayerCardProps> = (props) => {
);
videoRef.current?.setShowCrop(true)
} else if (imgSrc) {
} else if (imageKey) {
contentElement = (
<img
alt="首帧图"
src={imgSrc}
src={imageKey}
style={{ width: "100%", height: "100%", display: 'block' }}
/>
);
@ -58,7 +58,7 @@ export const VideoPlayerCard: React.FC<VideoPlayerCardProps> = (props) => {
} else {
setCardContent(null)
}
}, [showType, imgSrc, videoSrc, isWindowLoading]);
}, [showType, imageKey, videoSrc, isWindowLoading]);
return (
<div className={componentName} onClick={() => { handleWindowClick?.(windowKey) }} style={videoPlayerCardStyle}>

View File

@ -6,7 +6,7 @@ import { Space } from 'antd';
const mockVideoPlayerCardProps: VideoPlayerCardProps = {
showType: 'image',
// videoSrc: 'https://example.com/video.mp4',
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png', // 如果需要在没有视频时显示图片封面
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png', // 如果需要在没有视频时显示图片封面
size: 'small',
};

View File

@ -19,7 +19,7 @@ title: VideoPlayerCard 视频播放卡片
| --- | --- | --- | --- | --- |
| windowKey | 每个卡片的唯一标识 | string | - | - |
| selectedWindowKey | 选中的窗口key | string | - | - |
| imgSrc | 图片地址 | string | - | - |
| imageKey | 图片地址 | string | - | - |
| videoSrc | 视频地址 | string | - | - |
| errorReasonText | 加载失败的错误提示 | string | - | - |
| isWindowLoading | 判断是否显示loading | boolean | - | - |

View File

@ -5,7 +5,7 @@ import { DownloadOutlined } from '@ant-design/icons';
import './index.less'
type ViewLargerImageModalParams = {
imgSrc?: string;
imageKey?: string;
warningData?: {
label?: string;
value?: string;
@ -19,7 +19,7 @@ export interface ViewLargerImageModalRef {
export interface ViewLargerImageModalProps {
imgStyle?: React.CSSProperties;
downloadImg?: (imgSrc?: string) => void;
downloadImg?: (imageKey?: string) => void;
title?: string;
downloadText?: string;
modalProps?: ModalProps
@ -34,7 +34,7 @@ export const ViewLargerImageModal = forwardRef<ViewLargerImageModalRef, ViewLarg
const { useToken } = theme
const { token } = useToken()
const [open, setOpen] = useState<boolean>(false);
const [imgSrc, setImgSrc] = useState<string>();
const [imageKey, setimageKey] = useState<string>();
const [warningData, setWarningData] = useState<ViewLargerImageModalParams['warningData']>();
const handleCancel = () => {
@ -45,7 +45,7 @@ export const ViewLargerImageModal = forwardRef<ViewLargerImageModalRef, ViewLarg
return {
show: (_params) => {
setOpen(true);
setImgSrc(_params?.imgSrc)
setimageKey(_params?.imageKey)
setWarningData(_params?.warningData)
},
handleCancel
@ -65,7 +65,7 @@ export const ViewLargerImageModal = forwardRef<ViewLargerImageModalRef, ViewLarg
>
<Space size={0} {...spaceProps}>
<div className={`${componentName}-left-img`}>
<img alt={title} src={imgSrc} style={{ ...imgStyle }} />
<img alt={title} src={imageKey} style={{ ...imgStyle }} />
</div>
<div className='right-context'>
{warningData?.map(({ label, value }) => (
@ -74,7 +74,7 @@ export const ViewLargerImageModal = forwardRef<ViewLargerImageModalRef, ViewLarg
{value}
</div>
))}
{imgSrc && downloadImg && <div className='img-download' style={{ color: token.colorPrimary }} onClick={() => downloadImg?.(imgSrc)} ><DownloadOutlined /><span style={{ paddingLeft: 3 }}>{downloadText}</span></div>}
{imageKey && downloadImg && <div className='img-download' style={{ color: token.colorPrimary }} onClick={() => downloadImg?.(imageKey)} ><DownloadOutlined /><span style={{ paddingLeft: 3 }}>{downloadText}</span></div>}
</div>
</Space>
</Modal>

View File

@ -7,7 +7,7 @@ import dayjs from 'dayjs';
// 结合预警图列表 演示查看预警大图的使用 例如 后端返回这样的数据结构
const backEndData = [
{
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
id: '1561561',
warningType: '火焰识别',
boxId: '2',
@ -18,7 +18,7 @@ const backEndData = [
// warningTimeFormat:"YYYY-MM-DD"
},
{
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
id: '156156155',
warningType: '火焰识别',
boxId: '1',
@ -33,7 +33,7 @@ const backEndData = [
// 前端处理数据结构
const dataSource = backEndData.map(o => {
return {
imgSrc: o.imgSrc,
imageKey: o.imageKey,
id: o.id,
warningType: o.warningType,
boxId: o.boxId,
@ -63,7 +63,7 @@ export default () => {
const handleClick = (record?: IRecord) => {
// 点击的时候把数据 拿过来处理一下传给大图弹框
const { imgSrc, warningType, boxId, position, cabietId, warningTime, warningTimestamp, warningTimeFormat = 'YYYY-MM-DD HH:mm:ss' } = record || {}
const { imageKey, warningType, boxId, position, cabietId, warningTime, warningTimestamp, warningTimeFormat = 'YYYY-MM-DD HH:mm:ss' } = record || {}
const formattedDate = warningTimestamp ? dayjs(warningTimestamp).format(warningTimeFormat) : '';
const warningTimeShow = warningTime ? warningTime : formattedDate
//用于渲染右侧的 信息
@ -75,7 +75,7 @@ export default () => {
{ label: '柜子ID', value: cabietId },
]
// 调用这个方法打开弹框
viewLargerImageModalRef?.current?.show({ imgSrc: imgSrc, warningData: warningData })
viewLargerImageModalRef?.current?.show({ imageKey: imageKey, warningData: warningData })
setSelectedRecordId(record?.id)
}

View File

@ -19,7 +19,7 @@ title: ViewLargerImageModal 查看大图弹窗
| --- | --- | --- | --- | --- |
| show() |通过 ref 用于开启弹窗 可以将点击的 记录传给弹窗| | | |
| handleCancel() | 通过 ref 用于关闭弹窗 | | | |
| imgSrc | 图片地址 |string | | |
| imageKey | 图片地址 |string | | |
| contextData | 大图显示的数据 | | | |
| imgStyle | 用于修改图片样式 | | | |
| downloadImg | 传入下载图片的方法 | | | |

View File

@ -5,7 +5,7 @@ import dayjs from 'dayjs';
import './index.less'
export interface IRecord {
imgSrc?: string;
imageKey?: string;
id?: string;
/**
@ -66,7 +66,7 @@ export const WarningRecordCard: React.FC<WarningRecordCardProps> = (props) => {
const componentName = `zhst-biz-warning-record-card`;
const { record, onRecordClick, style, cardProps, selectedRecordId, cardStyle, imgStyle } = props;
const { imgSrc, id, warningType, warningInfo = [], cabietText, warningTime, warningTimestamp, warningTimeFormat = 'YYYY-MM-DD HH:mm:ss' } = record || {}
const { imageKey, id, warningType, warningInfo = [], cabietText, warningTime, warningTimestamp, warningTimeFormat = 'YYYY-MM-DD HH:mm:ss' } = record || {}
const formattedDate = warningTimestamp ? dayjs(warningTimestamp).format(warningTimeFormat) : '';
const warningTimeShow = warningTime ? warningTime : formattedDate
const { useToken } = theme
@ -85,7 +85,7 @@ export const WarningRecordCard: React.FC<WarningRecordCardProps> = (props) => {
return (
<div className={componentName} key={id} onClick={handleClick} style={style}>
<Card
cover={<div className={`${componentName}-cover-img`}><img alt="预警图" src={imgSrc} style={{ borderRadius: 0, ...imgStyle }} /></div>}
cover={<div className={`${componentName}-cover-img`}><img alt="预警图" src={imageKey} style={{ borderRadius: 0, ...imgStyle }} /></div>}
style={{ width: 356, height: 302, padding: 10, borderRadius: 4, ...selectedCardStyle, ...cardStyle }}
{...cardProps}
>

View File

@ -6,7 +6,7 @@ import { Space } from 'antd';
// 例如 后端返回这样的数据结构
const backEndData = [
{
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
id: '1561561',
warningType: '火焰识别',
boxId: '2',
@ -17,7 +17,7 @@ const backEndData = [
// warningTimeFormat:"YYYY-MM-DD"
},
{
imgSrc: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
id: '156156155',
warningType: '火焰识别',
boxId: '1',
@ -32,7 +32,7 @@ const backEndData = [
// 前端处理数据结构
const dataSource = backEndData.map(o => {
return {
imgSrc: o.imgSrc,
imageKey: o.imageKey,
id: o.id,
warningType: o.warningType,
boxId: o.boxId,

View File

@ -16,7 +16,7 @@ title: WarningRecordCard 预警记录卡片
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| imgSrc | 图片src | string | - | - |
| imageKey | 图片src | string | - | - |
| id | 数据的唯一id 用于key 传值| string | - | - |
| warningType | 预警类型 | string | - | - |
| warningInfo | 盒子 点位 柜子 等信息 | string[] | - | - |