diff --git a/ZR.Admin.WebApi/Controllers/CommonController.cs b/ZR.Admin.WebApi/Controllers/CommonController.cs index 1acd8d2..379f7ff 100644 --- a/ZR.Admin.WebApi/Controllers/CommonController.cs +++ b/ZR.Admin.WebApi/Controllers/CommonController.cs @@ -97,7 +97,7 @@ namespace ZR.Admin.WebApi.Controllers /// /// /// 存储目录 - /// 文件名 + /// 自定义文件名 /// 上传类型 1、发送邮件 /// [HttpPost()] @@ -152,16 +152,17 @@ namespace ZR.Admin.WebApi.Controllers /// 存储文件到阿里云 /// /// + /// 自定义文件名 /// 上传文件夹路径 /// [HttpPost] [Verify] [ActionPermissionFilter(Permission = "common")] - public IActionResult UploadFileAliyun([FromForm(Name = "file")] IFormFile formFile, string fileDir = "") + public IActionResult UploadFileAliyun([FromForm(Name = "file")] IFormFile formFile, string fileName = "", string fileDir = "") { if (formFile == null) throw new CustomException(ResultCode.PARAM_ERROR, "上传文件不能为空"); string fileExt = Path.GetExtension(formFile.FileName); - string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".jpeg", ".webp", ".svga", ".xls", ".doc", ".zip", ".json", ".txt" }; + string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".jpeg", ".webp", ".svga", ".xls", ".doc", ".zip", ".json", ".txt", ".bundle" }; int MaxContentLength = 1024 * 1024 * 15; double fileSize = formFile.Length / 1024; if (!AllowedFileExtensions.Contains(fileExt)) diff --git a/ZR.Vue/src/components/FileUpload/index.vue b/ZR.Vue/src/components/FileUpload/index.vue index 0bba384..d22cea3 100644 --- a/ZR.Vue/src/components/FileUpload/index.vue +++ b/ZR.Vue/src/components/FileUpload/index.vue @@ -58,7 +58,7 @@ export default { // 上传地址 uploadUrl: { type: String, - default: process.env.VUE_APP_UPLOAD_URL ?? "/Common/UploadFile", + default: process.env.VUE_APP_UPLOAD_URL, }, // form 列名 column: [String], @@ -100,6 +100,12 @@ export default { deep: true, immediate: true, }, + uploadUrl: { + handler(val){ + this.uploadFileUrl = process.env.VUE_APP_BASE_API + val; + }, + immediate: true + } }, computed: { // 是否显示提示