feat: auto-adapt video modal

This commit is contained in:
feitianbubu 2026-01-28 12:54:57 +08:00
parent d4d395e178
commit eadae84d46

View File

@ -120,7 +120,7 @@ const ContentModal = ({
} }
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative', height: '100%' }}>
{isLoading && ( {isLoading && (
<div <div
style={{ style={{
@ -137,7 +137,13 @@ const ContentModal = ({
<video <video
src={modalContent} src={modalContent}
controls controls
style={{ width: '100%' }} style={{
width: '100%',
height: '100%',
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'contain',
}}
autoPlay autoPlay
crossOrigin='anonymous' crossOrigin='anonymous'
onError={handleVideoError} onError={handleVideoError}
@ -155,11 +161,13 @@ const ContentModal = ({
onCancel={() => setIsModalOpen(false)} onCancel={() => setIsModalOpen(false)}
closable={null} closable={null}
bodyStyle={{ bodyStyle={{
height: isVideo ? '450px' : '400px', height: isVideo ? '70vh' : '400px',
maxHeight: '80vh',
overflow: 'auto', overflow: 'auto',
padding: isVideo && videoError ? '0' : '24px', padding: isVideo && videoError ? '0' : '24px',
}} }}
width={800} width={isVideo ? '90vw' : 800}
style={isVideo ? { maxWidth: 960 } : undefined}
> >
{isVideo ? ( {isVideo ? (
renderVideoContent() renderVideoContent()