From df365e97df2419e91def8da48608babd6dc9c174 Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Mon, 8 Sep 2025 14:18:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=B7=A5=E5=85=B7=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/oss.js | 14 ++++----- .../components/ToolsTemplate/TemplateForm.vue | 30 +++++++++++-------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/utils/oss.js b/src/utils/oss.js index e1340e1..fca2a8e 100644 --- a/src/utils/oss.js +++ b/src/utils/oss.js @@ -27,11 +27,11 @@ async function ossGenerateSTS() { Vue.prototype.OSSclientConfig.timeout = 10 * 60 * 1000 let OSSclient = new OSS(Vue.prototype.OSSclientConfig) Vue.prototype.OSSclient = { - put: function (objectName, object) { + put: function (objectName, object, timestamp = true) { return new Promise(async (resolve, reject) => { try { let _vm = router.default.app - if (_vm._route.path !== '/trials/trials-panel/visit/crc-upload') { + if (_vm._route.path !== '/trials/trials-panel/visit/crc-upload' && timestamp) { var objectItem = objectName.split('/') objectItem[objectItem.length - 1] = new Date().getTime() + '_' + objectItem[objectItem.length - 1] objectName = objectItem.join('/') @@ -40,7 +40,7 @@ async function ossGenerateSTS() { if (res && res.url) { resolve({ name: objectName, - url: res.url + url: res.url }) } else { reject() @@ -56,12 +56,12 @@ async function ossGenerateSTS() { case 'MinIO': let minioClient = new Minio.Client(Vue.prototype.OSSclientConfig); Vue.prototype.OSSclient = { - put: function (objectName, object) { + put: function (objectName, object, timestamp = true) { return new Promise(async (resolve, reject) => { try { var name = objectName.split('/')[objectName.split('/').length - 1] let _vm = router.default.app - if (_vm._route.path !== '/trials/trials-panel/visit/crc-upload') { + if (_vm._route.path !== '/trials/trials-panel/visit/crc-upload' && timestamp) { var objectItem = objectName.split('/') objectItem[objectItem.length - 1] = new Date().getTime() + '_' + objectItem[objectItem.length - 1] objectName = objectItem.join('/') @@ -69,9 +69,9 @@ async function ossGenerateSTS() { const reader = new FileReader(); reader.onload = (ex) => { const bufferStream = new stream.PassThrough() - bufferStream.end(Buffer.from(ex.target.result)) + bufferStream.end(Buffer.from(ex.target.result)) // minioClient.bucketExists('ecgdata' - minioClient.putObject(Vue.prototype.OSSclientConfig.bucketName, objectName, bufferStream, function(err,etag) { + minioClient.putObject(Vue.prototype.OSSclientConfig.bucketName, objectName, bufferStream, function (err, etag) { if (err) { console.log(err) reject() diff --git a/src/views/dictionary/attachment/components/ToolsTemplate/TemplateForm.vue b/src/views/dictionary/attachment/components/ToolsTemplate/TemplateForm.vue index 6bd75b2..e9c2cb0 100644 --- a/src/views/dictionary/attachment/components/ToolsTemplate/TemplateForm.vue +++ b/src/views/dictionary/attachment/components/ToolsTemplate/TemplateForm.vue @@ -3,7 +3,7 @@ class="upload-temporary-file">