Commit 145238ea967afa381086fd354982fec7defb035e

Authored by JeromeSoar
1 parent df237502

文件上传

yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
... ... @@ -56,7 +56,8 @@ public class FileController {
56 56 })
57 57 public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file) throws Exception {
58 58 String path = DateUtil.format(new Date(), "yyyy/MM/dd/") + file.getOriginalFilename();
59   - return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream())));
  59 + String file1 = fileService.createFile(path, IoUtil.readBytes(file.getInputStream()));
  60 + return success(file1);
60 61 }
61 62  
62 63 @DeleteMapping("/delete")
... ...
yudao-ui-admin/src/components/ImageUpload/index.vue
... ... @@ -127,7 +127,7 @@ export default {
127 127 },
128 128 // 上传成功回调
129 129 handleUploadSuccess(res) {
130   - this.uploadList.push({ name: res.fileName, url: res.fileName });
  130 + this.uploadList.push({ name: res.data, url: res.data });
131 131 if (this.uploadList.length === this.number) {
132 132 this.fileList = this.fileList.concat(this.uploadList);
133 133 this.uploadList = [];
... ...