diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java index 09175955..c4d102d1 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java @@ -3,14 +3,14 @@ package com.jero.modules.system.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.jero.common.api.vo.Result; +import com.jero.common.constant.CommonConstant; import com.jero.common.exception.JeroBootException; +import com.jero.common.system.api.ISysBaseAPI; import com.jero.common.util.*; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; import lombok.extern.slf4j.Slf4j; -import com.jero.common.api.vo.Result; -import com.jero.common.constant.CommonConstant; -import com.jero.common.system.api.ISysBaseAPI; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; @@ -18,7 +18,6 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.http.server.ServletServerHttpRequest; import org.springframework.util.AntPathMatcher; -import org.springframework.util.FileCopyUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; @@ -30,6 +29,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; + /** *

* 用户表 前端控制器 @@ -63,12 +64,14 @@ public class CommonController { @Value(value="${jero.fileSuffixLimits}") private String[] fileSuffixLimits; + private static String UTF8 ="UTF-8"; + /** * @Author 政辉 * @return */ @GetMapping("/403") - public Result noauth() { + public Result noauth() { return Result.error("没有权限,请联系管理员授权"); } @@ -92,6 +95,8 @@ public class CommonController { MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; // 获取上传文件对象 MultipartFile file = multipartRequest.getFile("file"); + if(file==null) + return result; // 文件类型是否处于黑名单 if(CommonUtils.limitFileSuffix(file.getOriginalFilename(),fileSuffixLimits)){ result.setMessage("该文件类型不允许上传"); @@ -171,11 +176,13 @@ public class CommonController { fileName = ossFile.getFileName(); inputStream = MinioUtil.getMinioFile(MinioUtil.getBucketName(), url); } - response.addHeader("Content-Disposition", "attachment;fileName=" + new String(fileName.getBytes("UTF-8"),"iso-8859-1")); + response.addHeader("Content-Disposition", "attachment;fileName=" + new String(fileName.getBytes(UTF8),StandardCharsets.ISO_8859_1)); response.setContentType("application/force-download");// 设置强制下载不打开 outputStream = response.getOutputStream(); byte[] buf = new byte[1024]; int len; + if(inputStream==null) + return; while ((len = inputStream.read(buf)) > 0) { outputStream.write(buf, 0, len); } @@ -252,7 +259,7 @@ public class CommonController { HttpHeaders headers = new HttpHeaders(); headers.set("X-Access-Token", token); // 发送请求 - String httpURL = URLDecoder.decode(url, "UTF-8"); + String httpURL = URLDecoder.decode(url, UTF8); ResponseEntity response = RestUtil.request(httpURL, method, headers , variables, params, String.class); // 封装返回结果 Result result = new Result<>(); @@ -286,7 +293,7 @@ public class CommonController { public void view(HttpServletRequest request, HttpServletResponse response) { // ISO-8859-1 ==> UTF-8 进行编码转换 String imgPath = extractPathFromPattern(request); - if(oConvertUtils.isEmpty(imgPath) || imgPath=="null"){ + if(oConvertUtils.isEmpty(imgPath) || "null".equals(imgPath)){ return; } // 其余处理略 @@ -304,7 +311,7 @@ public class CommonController { throw new RuntimeException("文件["+imgPath+"]不存在.."); } response.setContentType("application/force-download");// 设置强制下载不打开 - response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1")); + response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes(UTF8), StandardCharsets.ISO_8859_1)); inputStream = new BufferedInputStream(new FileInputStream(filePath)); outputStream = response.getOutputStream(); byte[] buf = new byte[1024]; diff --git a/jero-web/src/components/page/GlobalHeader.vue b/jero-web/src/components/page/GlobalHeader.vue index a7bffedc..26bee392 100644 --- a/jero-web/src/components/page/GlobalHeader.vue +++ b/jero-web/src/components/page/GlobalHeader.vue @@ -128,11 +128,7 @@ export default { handleScroll () { if (this.autoHideHeader) { const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop - if (scrollTop > 100) { - this.headerBarFixed = true - } else { - this.headerBarFixed = false - } + this.headerBarFixed = scrollTop > 100 } else { this.headerBarFixed = false } diff --git a/jero-web/src/components/page/GlobalLayout.vue b/jero-web/src/components/page/GlobalLayout.vue index 0c3707a8..051b6808 100644 --- a/jero-web/src/components/page/GlobalLayout.vue +++ b/jero-web/src/components/page/GlobalLayout.vue @@ -74,7 +74,7 @@ - + @@ -166,7 +166,7 @@ export default { }, findMenuBykey (menus, key) { for (const i of menus) { - if (i.path == key) { + if (i.path === key) { this.activeMenu = { ...i } } else if (i.children && i.children.length > 0) { this.findMenuBykey(i.children, key) @@ -529,7 +529,7 @@ export default { // 内容区 .layout-content { - margin: 24px 24px 0px; + margin: 24px 24px 0; height: 64px; padding: 0 12px 0 0; } @@ -635,7 +635,7 @@ export default { .ant-dropdown-menu-item > .anticon:first-child, .ant-dropdown-menu-item > a > .anticon:first-child, - .ant-dropdown-menu-submenu-title > .anticon:first-child + .ant-dropdown-menu-submenu-title > .anticon:first-child, .ant-dropdown-menu-submenu-title > a > .anticon:first-child { min-width: 12px; margin-right: 8px; diff --git a/jero-web/src/components/page/PageHeader.vue b/jero-web/src/components/page/PageHeader.vue index 4e4e00b0..6989399a 100644 --- a/jero-web/src/components/page/PageHeader.vue +++ b/jero-web/src/components/page/PageHeader.vue @@ -3,7 +3,7 @@
- + {{ item.meta.title }} {{ item.meta.title }} @@ -13,7 +13,7 @@
- +

{{ title }}

@@ -41,12 +41,12 @@