From c08b13673f6d850ece249820e089a2b16b9ed5ef Mon Sep 17 00:00:00 2001 From: rd <1344903914@qq.com> Date: Wed, 17 Sep 2025 11:59:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=A8=A1=E6=80=81=E6=A1=86=E5=92=8C=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E9=A2=84=E7=AD=BE=E5=90=8DURL=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 简化 `delete-tag.vue` 模态框模板结构 - 更新 `add-raw-material-drawer/index.vue` 组件,增加文件预签名URL获取和上传状态显示 - 新增 `getFilePreSignedUrl` API 函数 - 更新 `tools.ts` 中的文件扩展名提取函数 - 优化按钮激活状态样式 - 添加 `icon-no-text.png` 图标文件 --- src/api/all/common.ts | 7 +- src/styles/components/ant-button.scss | 2 +- src/utils/tools.ts | 8 +- .../add-raw-material-drawer/index.vue | 199 ++++++++++++------ .../add-raw-material-drawer/style.scss | 56 +++++ .../components/tags-manage-modal/add-tag.vue | 1 - .../tags-manage-modal/delete-tag.vue | 21 +- .../raw-material/img/icon-no-text.png | Bin 0 -> 1118 bytes 8 files changed, 214 insertions(+), 80 deletions(-) create mode 100644 src/views/material-center/components/raw-material/img/icon-no-text.png diff --git a/src/api/all/common.ts b/src/api/all/common.ts index fc1e92a..7deae61 100644 --- a/src/api/all/common.ts +++ b/src/api/all/common.ts @@ -73,7 +73,12 @@ export const getVideoPreSignedUrl = (params = {}) => { return Http.get('/v1/oss/video-pre-signed-url', params); }; +// 获取文件上传地址 +export const getFilePreSignedUrl = (params = {}) => { + return Http.get('/v1/oss/file-pre-signed-url', params); +}; + // 清除限流 export const postClearRateLimiter = (params = {}) => { return Http.post(`/v1/rate-limiter/clear`, params); -}; \ No newline at end of file +}; diff --git a/src/styles/components/ant-button.scss b/src/styles/components/ant-button.scss index 29bc47e..80b188b 100644 --- a/src/styles/components/ant-button.scss +++ b/src/styles/components/ant-button.scss @@ -71,7 +71,7 @@ } &:active { - background: $color-primary-7 !important; + background-color: $color-primary-7 !important; } } diff --git a/src/utils/tools.ts b/src/utils/tools.ts index 5df5a36..c0f2580 100644 --- a/src/utils/tools.ts +++ b/src/utils/tools.ts @@ -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(() => { diff --git a/src/views/material-center/components/raw-material/components/add-raw-material-drawer/index.vue b/src/views/material-center/components/raw-material/components/add-raw-material-drawer/index.vue index 57659a3..e8fbb40 100644 --- a/src/views/material-center/components/raw-material/components/add-raw-material-drawer/index.vue +++ b/src/views/material-center/components/raw-material/components/add-raw-material-drawer/index.vue @@ -1,5 +1,5 @@ diff --git a/src/views/material-center/components/raw-material/img/icon-no-text.png b/src/views/material-center/components/raw-material/img/icon-no-text.png new file mode 100644 index 0000000000000000000000000000000000000000..2cbb9e04363b94a989aaf08001eb9cdc3de92973 GIT binary patch literal 1118 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSoCO|{#S9E$svykh8Km+7D9BhG z5Po0a;hEN5y zoC|BYBX_O~S15PbA#`f$g75_~jHR!+#PecibXc5jo}`zAe&_{1k#amM-4;|(uu%s%tHe!A(m!5?q78wc9!w+ONA zW%BgA`#eJL{En#q$JYEm8F+d94jE~wKPqQ;^GKT=`z!tb4dWZ(g%h+?DivE^E#4IU z)@Iv&tKGHLPq}+PB-Q7(H=k2f;Q1%j(ly)RdBB5Ny!&6s+;e_$BTnJ8%smH&5f{u6h*iT(Pa7Jd4;8`ZY==%+a*%k$G37)Za7g=P%e&cRe`iI`y_1m_0 zIf^hIG5KNp`?kaG1?{WqTKOM*k@!*B_hQTKhrja{e&CXK&~B1{l-l)e_9=s1e8@h~ z+qJWy@W#{~C#Co4)tAXU|Jt!yMf^Z+Y}?lCKWbY!CRwxi+C#7X`ZTLk?ke~HV zPCnomZ}<0i&5g=K8(uyWUq8X-Eu&jUqS^ahleiybJP6%W-COyyd2ZwL+a7*J?F_T+ z{{7myd-i|9w8wt4e&mb!zur^5`ua`J@Bh7hCp~8<`+vaq?!?KDj?S;MVpmwsa6*%z zh^t`^6DG5S@rFuZX4Rj!D;MujT#|l;ck#Ae?)k0#SJWGR1-@lGwsWQNQE7YkginE0ked#^Dure`hYr|0mJxV0Gj|;Gn$|H>F|9xno=$^R%hj}JwsuY$ zmfQ?-`HEAD`b*RK`S}01aV%s?4AQqPJa47mxUV;qLv()fO}jEC4Pf@Tv4F$lM#SwI zx0A2`?|e3I{VpEu2`PW&{$#!1DgCEOz){s@gP7bo=SvR*Hapk8pZdT2vnnt*NZ9GL vNyN1YA7S;Vk$H7)@wDd^<`y4p_cN?*{9NdA?$cLbalqi|>gTe~DWM4ff=k_V literal 0 HcmV?d00001