Commit df23750203ab08cb763755448e24b2a506b14ef9
1 parent
e3589eae
文件上传
Showing
3 changed files
with
3 additions
and
3 deletions
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
| @@ -55,7 +55,7 @@ public class FileController { | @@ -55,7 +55,7 @@ public class FileController { | ||
| 55 | @ApiImplicitParam(name = "file", value = "文件附件", required = true, dataTypeClass = MultipartFile.class), | 55 | @ApiImplicitParam(name = "file", value = "文件附件", required = true, dataTypeClass = MultipartFile.class), |
| 56 | }) | 56 | }) |
| 57 | public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file) throws Exception { | 57 | public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file) throws Exception { |
| 58 | - String path = DateUtil.format(new Date(), "yyyy/MM/dd/") + file.getName(); | 58 | + String path = DateUtil.format(new Date(), "yyyy/MM/dd/") + file.getOriginalFilename(); |
| 59 | return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream()))); | 59 | return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream()))); |
| 60 | } | 60 | } |
| 61 | 61 |
yudao-ui-admin/src/components/ImageUpload/index.vue
| @@ -77,7 +77,7 @@ export default { | @@ -77,7 +77,7 @@ export default { | ||
| 77 | dialogVisible: false, | 77 | dialogVisible: false, |
| 78 | hideUpload: false, | 78 | hideUpload: false, |
| 79 | baseUrl: process.env.VUE_APP_BASE_API, | 79 | baseUrl: process.env.VUE_APP_BASE_API, |
| 80 | - uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址 | 80 | + uploadImgUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/simple-upload", // 上传的图片服务器地址 |
| 81 | headers: { | 81 | headers: { |
| 82 | Authorization: "Bearer " + getToken(), | 82 | Authorization: "Bearer " + getToken(), |
| 83 | }, | 83 | }, |
yudao-ui-admin/src/views/mall/product/category/index.vue
| @@ -95,7 +95,7 @@ | @@ -95,7 +95,7 @@ | ||
| 95 | </el-popover> | 95 | </el-popover> |
| 96 | </el-form-item> | 96 | </el-form-item> |
| 97 | <el-form-item label="分类图片" prop="bannerUrl"> | 97 | <el-form-item label="分类图片" prop="bannerUrl"> |
| 98 | - <el-input v-model="form.bannerUrl" placeholder="请输入分类图片"/> | 98 | + <ImageUpload v-model="form.bannerUrl" /> |
| 99 | </el-form-item> | 99 | </el-form-item> |
| 100 | <el-form-item label="分类排序" prop="sort"> | 100 | <el-form-item label="分类排序" prop="sort"> |
| 101 | <el-input-number v-model="form.sort" controls-position="right" :min="0" /> | 101 | <el-input-number v-model="form.sort" controls-position="right" :min="0" /> |