文件上传
This commit is contained in:
parent
e3589eae11
commit
df23750203
@ -55,7 +55,7 @@ public class FileController {
|
|||||||
@ApiImplicitParam(name = "file", value = "文件附件", required = true, dataTypeClass = MultipartFile.class),
|
@ApiImplicitParam(name = "file", value = "文件附件", required = true, dataTypeClass = MultipartFile.class),
|
||||||
})
|
})
|
||||||
public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file) throws Exception {
|
public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file) throws Exception {
|
||||||
String path = DateUtil.format(new Date(), "yyyy/MM/dd/") + file.getName();
|
String path = DateUtil.format(new Date(), "yyyy/MM/dd/") + file.getOriginalFilename();
|
||||||
return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream())));
|
return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ export default {
|
|||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
hideUpload: false,
|
hideUpload: false,
|
||||||
baseUrl: process.env.VUE_APP_BASE_API,
|
baseUrl: process.env.VUE_APP_BASE_API,
|
||||||
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
uploadImgUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/simple-upload", // 上传的图片服务器地址
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Bearer " + getToken(),
|
Authorization: "Bearer " + getToken(),
|
||||||
},
|
},
|
||||||
|
@ -95,7 +95,7 @@
|
|||||||
</el-popover>
|
</el-popover>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分类图片" prop="bannerUrl">
|
<el-form-item label="分类图片" prop="bannerUrl">
|
||||||
<el-input v-model="form.bannerUrl" placeholder="请输入分类图片"/>
|
<ImageUpload v-model="form.bannerUrl" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分类排序" prop="sort">
|
<el-form-item label="分类排序" prop="sort">
|
||||||
<el-input-number v-model="form.sort" controls-position="right" :min="0" />
|
<el-input-number v-model="form.sort" controls-position="right" :min="0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user