This commit is contained in:
2026-07-16 09:33:13 +08:00
parent 085e85967a
commit 01c55721ca
5 changed files with 34 additions and 24 deletions
+26 -14
View File
@@ -345,7 +345,7 @@ const AdminSettings: React.FC = () => {
</Button>
)}
<Upload
accept="video/mp4,video/webm,video/mov"
accept="video/*,image/gif,image/webp"
showUploadList={false}
beforeUpload={handleLoginVideoUpload}
>
@@ -355,20 +355,32 @@ const AdminSettings: React.FC = () => {
</Upload>
</Space>
</div>
{form.getFieldValue('login_bg_video') ? (
<video
src={form.getFieldValue('login_bg_video')}
controls
muted
style={{ width: '100%', maxHeight: 200, borderRadius: 8, background: '#000' }}
/>
) : (
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
使 backimage.png
</Typography.Text>
)}
{(() => {
const url = form.getFieldValue('login_bg_video');
if (!url) {
return (
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
使 backimage.png
</Typography.Text>
);
}
const isGif = url.toLowerCase().endsWith('.gif');
return isGif ? (
<img src={url} alt="预览" style={{ width: '100%', maxHeight: 200, borderRadius: 8, background: '#f0f0f5', objectFit: 'contain' }} />
) : (
<video
src={url}
controls
muted
autoPlay
loop
playsInline
style={{ width: '100%', maxHeight: 200, borderRadius: 8, background: '#000' }}
/>
);
})()}
<Typography.Text type="secondary" style={{ fontSize: 12, display: 'block', marginTop: 6 }}>
MP4WebMMOV 50MB
MP4WebMMOVGIFWebP 50MB
</Typography.Text>
</div>
</div>