From 56eb9e01a8990f4a32f1dffa1d1f9f0df4002c04 Mon Sep 17 00:00:00 2001 From: shaomh Date: Thu, 20 Mar 2025 17:00:41 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=91=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=94=9F=E6=88=90=E6=96=87=E4=BB=B6=E5=90=8D=E9=87=8D?= =?UTF-8?q?=E5=90=8D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UploadFile/src/useUpload.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/UploadFile/src/useUpload.ts b/src/components/UploadFile/src/useUpload.ts index 2981e12da..4a73b71be 100644 --- a/src/components/UploadFile/src/useUpload.ts +++ b/src/components/UploadFile/src/useUpload.ts @@ -2,6 +2,7 @@ import * as FileApi from '@/api/infra/file' import CryptoJS from 'crypto-js' import { UploadRawFile, UploadRequestOptions } from 'element-plus/es/components/upload/src/upload' import axios from 'axios' +import dayjs from 'dayjs' /** * 获得上传 URL @@ -92,7 +93,8 @@ async function generateFileName(file: UploadRawFile) { const sha256 = CryptoJS.SHA256(wordArray).toString() // 拼接后缀 const ext = file.name.substring(file.name.lastIndexOf('.')) - return `${sha256}${ext}` + const time = dayjs(new Date()).format('YYYYMMDDHHmmssSSS') + return `${time}_${sha256}${ext}` } /** -- Gitee