feat: 优化删除标签模态框和上传组件,新增文件预签名URL获取功能

- 简化 `delete-tag.vue` 模态框模板结构
- 更新 `add-raw-material-drawer/index.vue` 组件,增加文件预签名URL获取和上传状态显示
- 新增 `getFilePreSignedUrl` API 函数
- 更新 `tools.ts` 中的文件扩展名提取函数
- 优化按钮激活状态样式
- 添加 `icon-no-text.png` 图标文件
This commit is contained in:
rd
2025-09-17 11:59:31 +08:00
parent 7c85582564
commit c08b13673f
8 changed files with 214 additions and 80 deletions

View File

@ -112,11 +112,15 @@ export function genRandomId() {
return `id_${dayjs().unix()}_${Math.floor(Math.random() * 10000)}`;
}
export function getFileExtension(filename) {
const match = filename.match(/\.([^.]+)$/);
return match ? match[1].toLowerCase() : '';
}
export function formatFileSize(bytes: number): string {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const sizes = ['Bytes', 'kb', 'mB', 'gB', 'tB'];
const sizes = ['Bytes', 'kb', 'mb', 'gb', 'tb'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
@ -218,7 +222,7 @@ export function getVideoInfo(file: File): Promise<{ duration: number; firstFrame
};
// 设置视频源以触发加载
video.src = URL.createObjectURL(file);
video.src = window.URL.createObjectURL(file);
// 设置超时,防止长时间无响应
setTimeout(() => {