From eea01ac8923d74c263d8b2df6451b0f2d37f35cd Mon Sep 17 00:00:00 2001 From: bwcx_jzy Date: Wed, 8 Mar 2023 10:32:44 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E9=A1=B9=E7=9B=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=94=AF=E6=8C=81=E5=89=8D=E7=AB=AF=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=EF=BC=88=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F=E3=80=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../src/main/java/io/jpom/util/FileUtils.java | 10 ++----- .../node/node-layout/project/project-file.vue | 27 ++++++++++--------- .../node/node-layout/project/project-list.vue | 2 +- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 828006e0e..d02dd3a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ 1. 【server】修复 新增 docker 无法使用在线构建功能 (感谢 [@失落的世界](https://gitee.com/marmotgo) [Gitee issues I6KTLQ](https://gitee.com/dromara/Jpom/issues/I6KTLQ) ) +2. 【server】优化 项目文件列表支持前端排序(文件大小、修改时间) ------ diff --git a/modules/common/src/main/java/io/jpom/util/FileUtils.java b/modules/common/src/main/java/io/jpom/util/FileUtils.java index 453bada3e..776503588 100644 --- a/modules/common/src/main/java/io/jpom/util/FileUtils.java +++ b/modules/common/src/main/java/io/jpom/util/FileUtils.java @@ -23,7 +23,6 @@ package io.jpom.util; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.LineHandler; @@ -54,17 +53,12 @@ public class FileUtils { private static JSONObject fileToJson(File file) { JSONObject jsonObject = new JSONObject(6); + jsonObject.put("isDirectory", file.isDirectory()); long sizeFile = FileUtil.size(file); - if (file.isDirectory()) { - jsonObject.put("isDirectory", true); - jsonObject.put("fileSize", FileUtil.readableFileSize(sizeFile)); - } else { - jsonObject.put("fileSize", FileUtil.readableFileSize(sizeFile)); - } + jsonObject.put("fileSizeLong", sizeFile); jsonObject.put("filename", file.getName()); long mTime = file.lastModified(); jsonObject.put("modifyTimeLong", mTime); - jsonObject.put("modifyTime", DateUtil.date(mTime).toString()); return jsonObject; } diff --git a/web-vue/src/pages/node/node-layout/project/project-file.vue b/web-vue/src/pages/node/node-layout/project/project-file.vue index c5543846d..3469558ac 100644 --- a/web-vue/src/pages/node/node-layout/project/project-file.vue +++ b/web-vue/src/pages/node/node-layout/project/project-file.vue @@ -78,8 +78,14 @@ - - {{ text }} + + + {{ item.fileSize }} + + + {{ parseTime(record.modifyTimeLong) }}