增加巡检内容

This commit is contained in:
xuli
2025-11-20 17:45:41 +08:00
parent a6cc5ff885
commit 003d2d0797
42 changed files with 5957 additions and 1405 deletions

View File

@@ -205,3 +205,26 @@ const jumpAuthPermission2 = () => {
}
}
// 判断文件是图片还是视频
export const getFileType = (filePathOrName) => {
// 从路径或文件名中提取扩展名
let suffix = '';
try {
suffix = filePathOrName.split('.').pop().toLowerCase();
} catch (err) {
return 'unknown';
}
// 定义常见的图片和视频扩展名
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
const videoExtensions = ['mp4', 'mov', 'avi', 'm4v', '3gp', 'mpeg', 'mkv', 'wmv'];
if (imageExtensions.includes(suffix)) {
return 'image';
} else if (videoExtensions.includes(suffix)) {
return 'video';
} else {
return 'other';
}
}