From d29c85c600eaa3a19b8bde9ed284bbf66f20ca5c Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Wed, 19 Feb 2025 10:52:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?=E5=89=8D=E7=BC=80=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/FileUpload/index.vue | 35 +++++++------ .../src/views/device/version/index.vue | 17 ++++--- .../com/ruoyi/device/app/AppController.java | 10 ++++ .../com/ruoyi/device/domain/AsDevice.java | 4 ++ .../ruoyi/device/domain/AsDeviceVersion.java | 10 +++- .../device/mapper/AsDeviceVersionMapper.java | 20 +++++--- .../service/IAsDeviceVersionService.java | 25 +++++++--- .../service/impl/AsDeviceServiceImpl.java | 1 + .../impl/AsDeviceVersionServiceImpl.java | 25 +++++++--- .../mapper/device/AsDeviceVersionMapper.xml | 49 ++++++++++++++----- 10 files changed, 140 insertions(+), 56 deletions(-) diff --git a/AutoSprout-ui/src/components/FileUpload/index.vue b/AutoSprout-ui/src/components/FileUpload/index.vue index 05f26cc..fb31669 100644 --- a/AutoSprout-ui/src/components/FileUpload/index.vue +++ b/AutoSprout-ui/src/components/FileUpload/index.vue @@ -28,7 +28,7 @@
  • - + {{ getFileName(file.name) }}
    @@ -61,7 +61,8 @@ export default { // 文件类型, 例如['png', 'jpg', 'jpeg'] fileType: { type: Array, - default: () => ["doc", "xls", "ppt", "txt", "pdf"], + // default: () => ["doc", "docx", "xls", "ppt", "txt", "pdf","bin"], + default: () => ["bin"], }, // 是否显示提示 isShowTip: { @@ -74,7 +75,8 @@ export default { number: 0, uploadList: [], baseUrl: process.env.VUE_APP_BASE_API, - uploadData: {key:'',token:''}, + uploadData: {token:''}, + domain:"", uploadFileUrl: "https://up-z2.qiniup.com", // 上传文件服务器地址 // headers: { // Authorization: "Bearer " + getToken(), @@ -87,6 +89,7 @@ export default { console.log("七牛云获取token"+JSON.stringify(res)); if (res.code === 200) { this.uploadData.token = res.token + this.domain = res.domain; } }) }, @@ -158,16 +161,18 @@ export default { handleUploadSuccess(res, file) { console.log("七牛云获取res"+JSON.stringify(res)); console.log("七牛云获取file"+JSON.stringify(file)); - if (res.code === 200) { - this.uploadList.push({ name: res.fileName, url: res.fileName }); - this.uploadedSuccessfully(); - } else { - this.number--; - this.$modal.closeLoading(); - this.$modal.msgError(res.msg); - this.$refs.fileUpload.handleRemove(file); - this.uploadedSuccessfully(); - } + this.uploadList.push({ name: res.hash, url: this.domain+"/"+res.hash }); + this.uploadedSuccessfully(); + // if (res.code === 200) { + // this.uploadList.push({ name: res.fileName, url: res.fileName }); + // this.uploadedSuccessfully(); + // } else { + // this.number--; + // this.$modal.closeLoading(); + // this.$modal.msgError(res.msg); + // this.$refs.fileUpload.handleRemove(file); + // this.uploadedSuccessfully(); + // } }, // 删除文件 handleDelete(index) { @@ -176,7 +181,9 @@ export default { }, // 上传结束处理 uploadedSuccessfully() { - if (this.number > 0 && this.uploadList.length === this.number) { + console.log("this.number:"+this.number); + console.log("this.uploadList.length:"+this.uploadList.length); + if (this.number > 0) { this.fileList = this.fileList.concat(this.uploadList); this.uploadList = []; this.number = 0; diff --git a/AutoSprout-ui/src/views/device/version/index.vue b/AutoSprout-ui/src/views/device/version/index.vue index 277cd0f..cab7bcf 100644 --- a/AutoSprout-ui/src/views/device/version/index.vue +++ b/AutoSprout-ui/src/views/device/version/index.vue @@ -84,7 +84,7 @@ - + @@ -126,7 +126,7 @@ @@ -134,6 +134,9 @@ + + + @@ -155,7 +158,6 @@