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">