From 857abb2c0d3aaf58c5d70bdb438ea02aaaed047a Mon Sep 17 00:00:00 2001 From: "DESKTOP-6C3NK6N\\WXS" <815034831@qq.com> Date: Wed, 18 Sep 2024 13:51:03 +0800 Subject: [PATCH] =?UTF-8?q?aws=E4=B8=8A=E4=BC=A0=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/feedBack/index.vue | 1 - src/utils/multipartUpload/aws.js | 2 +- src/utils/oss.js | 9 ++++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/feedBack/index.vue b/src/components/feedBack/index.vue index dde8a8c1..d632b48b 100644 --- a/src/components/feedBack/index.vue +++ b/src/components/feedBack/index.vue @@ -363,7 +363,6 @@ export default { return (this.option = this.$d.FeedBackTypeToCRC); }, setTitle(code, name) { - console.log(code, name); if (this.hasPermi(["role:pm"]) && this.visitTaskId) { return `${this.$t("feedBack:form:title:pm2")}(${code}/${name})`; } diff --git a/src/utils/multipartUpload/aws.js b/src/utils/multipartUpload/aws.js index 0fdd1a90..62ab0401 100644 --- a/src/utils/multipartUpload/aws.js +++ b/src/utils/multipartUpload/aws.js @@ -46,7 +46,7 @@ export async function exist(s3, bucket, fileInformation, progressFn, changeStatu if (fileInformation.sharding.length === 0) { let existBucket = await existInBucket({ s3, bucket, fileInformation: fileInformation }); if (existBucket === 'true') { - progressFn(0, fileInformation.file, 1); + progressFn(1, fileInformation.file, 0); changeStatus(fileInformation.path, 'success');//直接告诉前端,状态 return; } else if (existBucket === 'same key') { diff --git a/src/utils/oss.js b/src/utils/oss.js index b8dc5cd6..af37bd6c 100644 --- a/src/utils/oss.js +++ b/src/utils/oss.js @@ -188,11 +188,14 @@ function uploadAWS(aws, data, progress) { objectItem[objectItem.length - 1] = new Date().getTime() + '_' + objectItem[objectItem.length - 1] data.path = objectItem.join('/') } - await exist(aws, Vue.prototype.OSSclientConfig.bucket, data, progress, (path, status) => { + let bucketName = data.path.split("/")[1] || Vue.prototype.OSSclientConfig.bucket + let curPath = data.path; + data.path = data.path.replace(`/${bucketName}/`, ''); + await exist(aws, bucketName, data, progress, (path, status) => { if (status === 'success') { resolve({ - name: Vue.prototype.OSSclientConfig.bucket + "/" + decodeUtf8(path), - url: Vue.prototype.OSSclientConfig.viewEndpoint + Vue.prototype.OSSclientConfig.bucket + "/" + decodeUtf8(path) + name: decodeUtf8(curPath), + url: Vue.prototype.OSSclientConfig.viewEndpoint + decodeUtf8(curPath) }) } else { reject()