From b959445ac6bc182d0b5c5ddadb0254e0ba6fe2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Fri, 14 Jan 2022 16:29:44 +0800 Subject: [PATCH] =?UTF-8?q?fix=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=A7=8B=E7=BB=88=E4=B8=8A=E4=BC=A0=E5=88=B0?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Admin.WebApi/Controllers/CommonController.cs | 7 ++++--- ZR.Vue/src/components/FileUpload/index.vue | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) 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: { // 是否显示提示