From 18db27a22c29edd78addd244fb60c43c67469f38 Mon Sep 17 00:00:00 2001 From: cfq Date: Wed, 28 Jan 2026 20:00:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(git):=20=E5=9C=A8=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E4=B8=AD=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8DGit=E5=88=86?= =?UTF-8?q?=E6=94=AF=E5=B9=B6=E6=94=B9=E8=BF=9B=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增获取当前分支的API接口和前端状态管理 - 在Git面板顶部显示当前分支名称和图标 - 重新组织操作按钮布局,将远程仓库和刷新按钮移至顶部工具栏 - 为状态列表添加文件数量统计 - 优化响应式布局,使拉取/推送按钮等宽显示 --- public/preload/services.js | 4 ++ src/components/GitPanel.vue | 87 +++++++++++++++++++++++++++++++------ src/composables/useGit.js | 14 ++++++ 3 files changed, 92 insertions(+), 13 deletions(-) diff --git a/public/preload/services.js b/public/preload/services.js index 0b12fd1..61177f2 100644 --- a/public/preload/services.js +++ b/public/preload/services.js @@ -176,6 +176,10 @@ window.services = { return this.execGit("-c core.quotePath=false status --short", dirPath); }, + async gitBranch(dirPath) { + return this.execGit("branch --show-current", dirPath); + }, + async gitAdd(dirPath, files = ".") { return this.execGit(`add ${files}`, dirPath); }, diff --git a/src/components/GitPanel.vue b/src/components/GitPanel.vue index aa49ec4..9117da1 100644 --- a/src/components/GitPanel.vue +++ b/src/components/GitPanel.vue @@ -5,28 +5,39 @@
+
+
+ + {{ state.branch }} +
+
+ + + + + + +
+
+
- - + + 拉取 - + 推送 - - - - - - -
-

状态

+
+

状态

+ {{ state.statusFiles.length }} +
{{ file.status }} @@ -60,7 +71,7 @@