zen-gitsync 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,6 +56,9 @@ async function loadStatus() {
56
56
  // 使用gitLogStore获取Git状态
57
57
  await gitLogStore.fetchStatus()
58
58
 
59
+ // 同时刷新分支状态信息,确保显示最新的领先/落后提交数
60
+ await gitStore.getBranchStatus()
61
+
59
62
  ElMessage({
60
63
  message: 'Git 状态已刷新',
61
64
  type: 'success',
@@ -115,10 +118,41 @@ async function getFileDiff(filePath: string) {
115
118
  selectedFile.value = filePath
116
119
  // 设置当前文件索引
117
120
  currentFileIndex.value = gitLogStore.fileList.findIndex(file => file.path === filePath)
118
- const response = await fetch(`/api/diff?file=${encodeURIComponent(filePath)}`)
119
- const data = await response.json()
120
- diffContent.value = data.diff || '没有变更'
121
- diffDialogVisible.value = true
121
+
122
+ // 获取当前文件的状态类型
123
+ const currentFile = gitLogStore.fileList[currentFileIndex.value]
124
+
125
+ // 对未跟踪文件特殊处理
126
+ if (currentFile && currentFile.type === 'untracked') {
127
+ try {
128
+ // 获取未跟踪文件的内容
129
+ const response = await fetch(`/api/file-content?file=${encodeURIComponent(filePath)}`)
130
+ const data = await response.json()
131
+
132
+ if (data.success && data.content) {
133
+ // 构建一个类似diff的格式来显示新文件内容
134
+ diffContent.value = `diff --git a/${filePath} b/${filePath}\n` +
135
+ `新文件: ${filePath}\n` +
136
+ `--- /dev/null\n` +
137
+ `+++ b/${filePath}\n` +
138
+ `@@ -0,0 +1,${data.content.split('\n').length} @@\n` +
139
+ data.content.split('\n').map((line: string) => `+${line}`).join('\n')
140
+ } else {
141
+ diffContent.value = '这是一个新文件,尚未被Git跟踪。\n添加到暂存区后可以提交该文件。'
142
+ }
143
+ } catch (error) {
144
+ console.error('获取未跟踪文件内容失败:', error)
145
+ diffContent.value = '这是一个新文件,尚未被Git跟踪。\n添加到暂存区后可以提交该文件。'
146
+ }
147
+
148
+ diffDialogVisible.value = true
149
+ } else {
150
+ // 对于已跟踪的文件,获取常规差异
151
+ const response = await fetch(`/api/diff?file=${encodeURIComponent(filePath)}`)
152
+ const data = await response.json()
153
+ diffContent.value = data.diff || '没有变更'
154
+ diffDialogVisible.value = true
155
+ }
122
156
  } catch (error) {
123
157
  ElMessage({
124
158
  message: '获取文件差异失败: ' + (error as Error).message,
@@ -387,6 +421,11 @@ onMounted(() => {
387
421
  // App.vue已经加载了Git相关数据,此时只需加载状态
388
422
  // 如果已有初始目录,则只需加载状态
389
423
  loadStatus()
424
+
425
+ // 如果是Git仓库,确保分支状态也被加载
426
+ if (gitStore.isGitRepo) {
427
+ gitStore.getBranchStatus()
428
+ }
390
429
  })
391
430
 
392
431
  // 监听autoUpdateEnabled的变化,手动调用toggleAutoUpdate
@@ -447,125 +486,180 @@ defineExpose({
447
486
  </div>
448
487
 
449
488
  <div v-if="!gitStore.isGitRepo" class="status-box">
450
- 当前目录不是一个Git仓库
489
+ <div class="empty-status">
490
+ <p>当前目录不是Git仓库</p>
491
+ <el-button type="primary" size="small" @click="openDirectoryDialog">
492
+ 切换目录
493
+ </el-button>
494
+ </div>
451
495
  </div>
452
496
 
453
- <!-- 现代化、简洁的文件列表 -->
454
- <div v-if="gitLogStore.fileList.length" class="file-list-container">
455
- <!-- 分组显示文件 -->
456
- <div v-if="gitLogStore.fileList.some(f => f.type === 'added')" class="file-group">
457
- <div class="file-group-header">已暂存的更改</div>
458
- <div class="file-list">
459
- <div
460
- v-for="file in gitLogStore.fileList.filter(f => f.type === 'added')"
461
- :key="file.path"
462
- class="file-item"
463
- @click="handleFileClick(file)"
464
- >
465
- <div class="file-info">
466
- <div class="file-path-container">
467
- <span class="file-name">{{ getFileName(file.path) }}</span>
468
- <span class="file-directory">{{ getFileDirectory(file.path) }}</span>
469
- </div>
497
+ <div v-else>
498
+ <!-- 分支同步状态信息 -->
499
+ <div v-if="gitStore.hasUpstream && (gitStore.branchAhead > 0 || gitStore.branchBehind > 0)" class="branch-sync-status">
500
+ <div class="sync-status-content">
501
+ <el-tooltip content="本地分支与远程分支的状态对比" placement="top">
502
+ <div class="status-badges">
503
+ <el-tag v-if="gitStore.branchAhead > 0" size="small" type="warning" class="status-badge">
504
+ <template #default>
505
+ <span class="badge-content">
506
+ <el-icon><ArrowUp /></el-icon> 你的分支领先 'origin/{{ gitStore.currentBranch }}' {{ gitStore.branchAhead }} 个提交
507
+ </span>
508
+ </template>
509
+ </el-tag>
510
+ <el-tag v-if="gitStore.branchBehind > 0" size="small" type="info" class="status-badge">
511
+ <template #default>
512
+ <span class="badge-content">
513
+ <el-icon><ArrowDown /></el-icon> 你的分支落后 'origin/{{ gitStore.currentBranch }}' {{ gitStore.branchBehind }} 个提交
514
+ </span>
515
+ </template>
516
+ </el-tag>
470
517
  </div>
471
- <div class="file-actions">
472
- <el-tooltip content="取消暂存" placement="top" :hide-after="1000">
473
- <el-button
474
- type="warning"
475
- size="small"
476
- circle
477
- @click.stop="unstageFile(file.path)"
478
- >-</el-button>
479
- </el-tooltip>
480
- </div>
481
- </div>
518
+ </el-tooltip>
482
519
  </div>
483
520
  </div>
484
521
 
485
- <div v-if="gitLogStore.fileList.some(f => f.type === 'modified' || f.type === 'deleted')" class="file-group">
486
- <div class="file-group-header">未暂存的更改</div>
487
- <div class="file-list">
488
- <div
489
- v-for="file in gitLogStore.fileList.filter(f => f.type === 'modified' || f.type === 'deleted')"
490
- :key="file.path"
491
- class="file-item"
492
- @click="handleFileClick(file)"
493
- >
494
- <div class="file-info">
495
- <div class="file-status-indicator" :class="file.type"></div>
496
- <div class="file-path-container">
497
- <span class="file-name">{{ getFileName(file.path) }}</span>
498
- <span class="file-directory">{{ getFileDirectory(file.path) }}</span>
522
+ <!-- 默认状态信息 -->
523
+ <div v-if="!gitStore.hasUpstream || (gitStore.branchAhead === 0 && gitStore.branchBehind === 0)" class="git-status-message">
524
+ <p>当前工作在 <el-tag size="small" type="success">{{ gitStore.currentBranch }}</el-tag> 分支</p>
525
+ </div>
526
+
527
+ <!-- 现代化、简洁的文件列表 -->
528
+ <div v-if="gitLogStore.fileList.length" class="file-list-container">
529
+ <!-- 分组显示文件 -->
530
+ <div v-if="gitLogStore.fileList.some(f => f.type === 'added')" class="file-group">
531
+ <div class="file-group-header">已暂存的更改</div>
532
+ <div class="file-list">
533
+ <div
534
+ v-for="file in gitLogStore.fileList.filter(f => f.type === 'added')"
535
+ :key="file.path"
536
+ class="file-item"
537
+ @click="handleFileClick(file)"
538
+ >
539
+ <div class="file-info">
540
+ <div class="file-path-container">
541
+ <span class="file-name">{{ getFileName(file.path) }}</span>
542
+ <span class="file-directory">{{ getFileDirectory(file.path) }}</span>
543
+ </div>
544
+ </div>
545
+ <div class="file-actions">
546
+ <el-tooltip content="取消暂存" placement="top" :hide-after="1000">
547
+ <el-button
548
+ type="warning"
549
+ size="small"
550
+ circle
551
+ @click.stop="unstageFile(file.path)"
552
+ >-</el-button>
553
+ </el-tooltip>
499
554
  </div>
500
- </div>
501
- <div class="file-actions">
502
- <el-tooltip content="添加到暂存区" placement="top" :hide-after="1000">
503
- <el-button
504
- type="success"
505
- size="small"
506
- circle
507
- @click.stop="stageFile(file.path)"
508
- >+</el-button>
509
- </el-tooltip>
510
- <el-tooltip content="撤回修改" placement="top" :hide-after="1000">
511
- <el-button
512
- type="danger"
513
- size="small"
514
- :icon="RefreshRight"
515
- circle
516
- @click.stop="revertFileChanges(file.path)"
517
- />
518
- </el-tooltip>
519
555
  </div>
520
556
  </div>
521
557
  </div>
522
- </div>
523
-
524
- <div v-if="gitLogStore.fileList.some(f => f.type === 'untracked')" class="file-group">
525
- <div class="file-group-header">未跟踪的文件</div>
526
- <div class="file-list">
527
- <div
528
- v-for="file in gitLogStore.fileList.filter(f => f.type === 'untracked')"
529
- :key="file.path"
530
- class="file-item"
531
- @click="handleFileClick(file)"
532
- >
533
- <div class="file-info">
534
- <div class="file-status-indicator untracked"></div>
535
- <div class="file-path-container">
536
- <span class="file-name">{{ getFileName(file.path) }}</span>
537
- <span class="file-directory">{{ getFileDirectory(file.path) }}</span>
558
+
559
+ <div v-if="gitLogStore.fileList.some(f => f.type === 'modified' || f.type === 'deleted')" class="file-group">
560
+ <div class="file-group-header">未暂存的更改</div>
561
+ <div class="file-list">
562
+ <div
563
+ v-for="file in gitLogStore.fileList.filter(f => f.type === 'modified' || f.type === 'deleted')"
564
+ :key="file.path"
565
+ class="file-item"
566
+ @click="handleFileClick(file)"
567
+ >
568
+ <div class="file-info">
569
+ <div class="file-status-indicator" :class="file.type"></div>
570
+ <div class="file-path-container">
571
+ <span class="file-name">{{ getFileName(file.path) }}</span>
572
+ <span class="file-directory">{{ getFileDirectory(file.path) }}</span>
573
+ </div>
574
+ </div>
575
+ <div class="file-actions">
576
+ <el-tooltip content="添加到暂存区" placement="top" :hide-after="1000">
577
+ <el-button
578
+ type="success"
579
+ size="small"
580
+ circle
581
+ @click.stop="stageFile(file.path)"
582
+ >+</el-button>
583
+ </el-tooltip>
584
+ <el-tooltip content="撤回修改" placement="top" :hide-after="1000">
585
+ <el-button
586
+ type="danger"
587
+ size="small"
588
+ :icon="RefreshRight"
589
+ circle
590
+ @click.stop="revertFileChanges(file.path)"
591
+ />
592
+ </el-tooltip>
538
593
  </div>
539
594
  </div>
540
- <div class="file-actions">
541
- <el-tooltip content="添加到暂存区" placement="top" :hide-after="1000">
542
- <el-button
543
- type="success"
544
- size="small"
545
- circle
546
- @click.stop="stageFile(file.path)"
547
- >+</el-button>
548
- </el-tooltip>
549
- <el-tooltip content="删除文件" placement="top" :hide-after="1000">
550
- <el-button
551
- type="danger"
552
- size="small"
553
- :icon="Close"
554
- circle
555
- @click.stop="revertFileChanges(file.path)"
556
- />
557
- </el-tooltip>
595
+ </div>
596
+ </div>
597
+
598
+ <div v-if="gitLogStore.fileList.some(f => f.type === 'untracked')" class="file-group">
599
+ <div class="file-group-header">未跟踪的文件</div>
600
+ <div class="file-list">
601
+ <div
602
+ v-for="file in gitLogStore.fileList.filter(f => f.type === 'untracked')"
603
+ :key="file.path"
604
+ class="file-item"
605
+ @click="handleFileClick(file)"
606
+ >
607
+ <div class="file-info">
608
+ <div class="file-status-indicator untracked"></div>
609
+ <div class="file-path-container">
610
+ <span class="file-name">{{ getFileName(file.path) }}</span>
611
+ <span class="file-directory">{{ getFileDirectory(file.path) }}</span>
612
+ </div>
613
+ </div>
614
+ <div class="file-actions">
615
+ <el-tooltip content="添加到暂存区" placement="top" :hide-after="1000">
616
+ <el-button
617
+ type="success"
618
+ size="small"
619
+ circle
620
+ @click.stop="stageFile(file.path)"
621
+ >+</el-button>
622
+ </el-tooltip>
623
+ <el-tooltip content="删除文件" placement="top" :hide-after="1000">
624
+ <el-button
625
+ type="danger"
626
+ size="small"
627
+ :icon="Close"
628
+ circle
629
+ @click.stop="revertFileChanges(file.path)"
630
+ />
631
+ </el-tooltip>
632
+ </div>
558
633
  </div>
559
634
  </div>
560
635
  </div>
561
636
  </div>
562
- </div>
563
-
564
- <div v-else-if="gitStore.isGitRepo" class="empty-status">
565
- <div class="empty-icon">
566
- <el-icon><Document /></el-icon>
637
+
638
+ <div v-else-if="gitStore.isGitRepo" class="empty-status">
639
+ <div class="empty-icon">
640
+ <el-icon><Document /></el-icon>
641
+ </div>
642
+ <div class="empty-text">没有检测到任何更改</div>
643
+ <div class="empty-subtext">工作区是干净的</div>
644
+
645
+ <!-- 添加分支信息 -->
646
+ <div class="branch-info">
647
+ <p>当前工作在 <el-tag size="small" type="success">{{ gitStore.currentBranch }}</el-tag> 分支</p>
648
+
649
+ <!-- 显示分支同步状态 -->
650
+ <div v-if="gitStore.hasUpstream">
651
+ <span v-if="gitStore.branchAhead > 0" class="branch-sync-info warning">
652
+ <el-icon><ArrowUp /></el-icon> 你的分支领先 'origin/{{ gitStore.currentBranch }}' {{ gitStore.branchAhead }} 个提交
653
+ </span>
654
+ <span v-else-if="gitStore.branchBehind > 0" class="branch-sync-info info">
655
+ <el-icon><ArrowDown /></el-icon> 你的分支落后 'origin/{{ gitStore.currentBranch }}' {{ gitStore.branchBehind }} 个提交
656
+ </span>
657
+ <span v-else class="branch-sync-info success">
658
+ <el-icon><Check /></el-icon> 你的分支与 'origin/{{ gitStore.currentBranch }}' 同步
659
+ </span>
660
+ </div>
661
+ </div>
567
662
  </div>
568
- <div class="empty-text">没有检测到任何更改</div>
569
663
  </div>
570
664
  </div>
571
665
 
@@ -648,32 +742,72 @@ defineExpose({
648
742
  <!-- 文件差异对话框 -->
649
743
  <el-dialog
650
744
  v-model="diffDialogVisible"
651
- :title="`文件差异: ${selectedFile}`"
652
- width="80%"
745
+ width="85%"
746
+ top="5vh"
653
747
  destroy-on-close
654
748
  class="diff-dialog"
749
+ :show-close="false"
750
+ style="height: calc(100vh - 150px);"
751
+ :modal-append-to-body="false"
752
+ :close-on-click-modal="false"
655
753
  >
754
+ <template #header>
755
+ <div class="diff-dialog-header">
756
+ <div class="file-title">
757
+ <el-icon class="file-icon"><Document /></el-icon>
758
+ <span class="file-path">{{ selectedFile }}</span>
759
+ </div>
760
+ <div class="header-actions">
761
+ <el-button
762
+ @click="diffDialogVisible = false"
763
+ circle
764
+ size="small"
765
+ :icon="Close"
766
+ class="close-button"
767
+ />
768
+ </div>
769
+ </div>
770
+ </template>
771
+
656
772
  <div v-loading="isLoadingDiff" class="diff-content">
657
773
  <div v-if="diffContent" v-html="formatDiff(diffContent)" class="diff-formatted"></div>
658
774
  <div v-else class="no-diff">该文件没有差异或是新文件</div>
659
775
  </div>
660
776
 
661
- <!-- 添加文件导航按钮 -->
662
- <div class="file-navigation">
663
- <el-button
664
- :icon="ArrowLeft"
665
- @click="goToPreviousFile"
666
- :disabled="currentFileIndex <= 0 || gitLogStore.fileList.length === 0"
667
- circle
668
- />
669
- <span class="file-counter">{{ currentFileIndex + 1 }} / {{ gitLogStore.fileList.length }}</span>
670
- <el-button
671
- :icon="ArrowRight"
672
- @click="goToNextFile"
673
- :disabled="currentFileIndex >= gitLogStore.fileList.length - 1 || gitLogStore.fileList.length === 0"
674
- circle
675
- />
676
- </div>
777
+ <template #footer>
778
+ <div class="file-navigation">
779
+ <el-button
780
+ type="primary"
781
+ :icon="ArrowLeft"
782
+ @click="goToPreviousFile"
783
+ :disabled="currentFileIndex <= 0 || gitLogStore.fileList.length === 0"
784
+ plain
785
+ class="nav-button"
786
+ >
787
+ 上一个文件
788
+ </el-button>
789
+
790
+ <div class="file-counter">
791
+ <el-tag type="info" effect="plain" class="counter-tag">
792
+ {{ currentFileIndex + 1 }} / {{ gitLogStore.fileList.length }}
793
+ </el-tag>
794
+ </div>
795
+
796
+ <el-button
797
+ type="primary"
798
+ :icon="ArrowRight"
799
+ @click="goToNextFile"
800
+ :disabled="currentFileIndex >= gitLogStore.fileList.length - 1 || gitLogStore.fileList.length === 0"
801
+ plain
802
+ class="nav-button"
803
+ >
804
+ 下一个文件
805
+ <template #icon>
806
+ <el-icon class="el-icon--right"><ArrowRight /></el-icon>
807
+ </template>
808
+ </el-button>
809
+ </div>
810
+ </template>
677
811
  </el-dialog>
678
812
  </div>
679
813
  </template>
@@ -718,6 +852,7 @@ defineExpose({
718
852
  flex: 1;
719
853
  display: flex;
720
854
  flex-direction: column;
855
+ min-height: 300px; /* 确保内容区有最小高度 */
721
856
  }
722
857
 
723
858
  .current-directory {
@@ -764,7 +899,8 @@ defineExpose({
764
899
  flex-direction: column;
765
900
  margin-bottom: 0;
766
901
  gap: 12px;
767
- height: calc(100% - 70px); /* 给底部留出些空间 */
902
+ height: auto; /* 改为自适应高度,不固定高度 */
903
+ min-height: 100px; /* 设置最小高度 */
768
904
  }
769
905
 
770
906
  .file-group {
@@ -801,6 +937,7 @@ defineExpose({
801
937
  .file-list {
802
938
  overflow-y: auto;
803
939
  min-height: 40px; /* 最小高度 */
940
+ max-height: 200px; /* 最大高度限制,避免过长列表 */
804
941
  flex-grow: 1; /* 允许文件列表在文件组内扩展 */
805
942
  padding: 0;
806
943
  margin: 0;
@@ -946,9 +1083,10 @@ defineExpose({
946
1083
  .file-directory {
947
1084
  font-size: 12px;
948
1085
  color: #909399;
1086
+ max-width: 200px;
949
1087
  overflow: hidden;
1088
+ white-space: nowrap;
950
1089
  text-overflow: ellipsis;
951
- line-height: 1.2;
952
1090
  }
953
1091
 
954
1092
  .file-actions {
@@ -967,22 +1105,87 @@ defineExpose({
967
1105
  flex-direction: column;
968
1106
  align-items: center;
969
1107
  justify-content: center;
970
- height: calc(100% - 70px);
971
- background-color: #f8f9fa;
972
- border-radius: 6px;
973
- border: 1px solid #ebeef5;
974
- margin-top: 15px;
1108
+ padding: 40px 20px;
1109
+ text-align: center;
1110
+ background-color: #f9f9f9;
1111
+ border-radius: 8px;
1112
+ margin-top: 10px;
975
1113
  }
976
1114
 
977
1115
  .empty-icon {
978
- font-size: 32px;
979
- color: #c0c4cc;
980
- margin-bottom: 10px;
1116
+ width: 60px;
1117
+ height: 60px;
1118
+ display: flex;
1119
+ align-items: center;
1120
+ justify-content: center;
1121
+ background-color: #ebeef5;
1122
+ border-radius: 50%;
1123
+ margin-bottom: 15px;
1124
+ font-size: 24px;
1125
+ color: #909399;
1126
+ animation: pulse 2s infinite ease-in-out;
1127
+ }
1128
+
1129
+ @keyframes pulse {
1130
+ 0% { transform: scale(1); opacity: 0.7; }
1131
+ 50% { transform: scale(1.05); opacity: 1; }
1132
+ 100% { transform: scale(1); opacity: 0.7; }
981
1133
  }
982
1134
 
983
1135
  .empty-text {
1136
+ font-size: 16px;
1137
+ font-weight: 500;
1138
+ color: #606266;
1139
+ margin-bottom: 5px;
1140
+ }
1141
+
1142
+ .empty-subtext {
1143
+ font-size: 14px;
984
1144
  color: #909399;
1145
+ margin-bottom: 20px;
1146
+ }
1147
+
1148
+ /* 分支信息样式 */
1149
+ .branch-info {
1150
+ margin-top: 15px;
1151
+ padding: 10px 15px;
1152
+ background-color: #ebeef5;
1153
+ border-radius: 6px;
1154
+ text-align: left;
1155
+ width: 100%;
1156
+ max-width: 400px;
1157
+ }
1158
+
1159
+ .branch-info p {
1160
+ margin: 5px 0;
985
1161
  font-size: 14px;
1162
+ color: #606266;
1163
+ }
1164
+
1165
+ .branch-sync-info {
1166
+ display: flex;
1167
+ align-items: center;
1168
+ gap: 5px;
1169
+ font-size: 13px;
1170
+ margin-top: 5px;
1171
+ padding: 5px 8px;
1172
+ border-radius: 4px;
1173
+ background-color: #f5f7fa;
1174
+ }
1175
+
1176
+ .branch-sync-info.warning {
1177
+ color: #e6a23c;
1178
+ background-color: #fdf6ec;
1179
+ }
1180
+
1181
+ .branch-sync-info.info {
1182
+ color: #909399;
1183
+ background-color: #f4f4f5;
1184
+ }
1185
+
1186
+ .branch-sync-info.success {
1187
+ color: #67c23a;
1188
+ background-color: #f0f9eb;
986
1189
  }
987
1190
 
988
1191
  /* 添加针对空内容区域的样式 */
@@ -1101,6 +1304,186 @@ defineExpose({
1101
1304
  gap: 10px;
1102
1305
  margin-top: 10px;
1103
1306
  }
1307
+
1308
+ /* 添加分支状态样式 */
1309
+ .branch-sync-status {
1310
+ display: flex;
1311
+ align-items: center;
1312
+ padding: 12px 15px;
1313
+ background-color: #f8f9fa;
1314
+ border-radius: 4px;
1315
+ margin-bottom: 15px;
1316
+ border-left: 3px solid #e6a23c;
1317
+ }
1318
+
1319
+ /* 添加默认分支状态信息样式 */
1320
+ .git-status-message {
1321
+ padding: 12px 15px;
1322
+ background-color: #f8f9fa;
1323
+ border-radius: 4px;
1324
+ margin-bottom: 15px;
1325
+ border-left: 3px solid #67c23a;
1326
+ }
1327
+
1328
+ .git-status-message p {
1329
+ margin: 0;
1330
+ display: flex;
1331
+ align-items: center;
1332
+ gap: 8px;
1333
+ font-size: 14px;
1334
+ color: #606266;
1335
+ }
1336
+
1337
+ .sync-status-content {
1338
+ display: flex;
1339
+ align-items: center;
1340
+ flex-wrap: wrap;
1341
+ gap: 10px;
1342
+ }
1343
+
1344
+ .status-badges {
1345
+ display: flex;
1346
+ flex-direction: column;
1347
+ gap: 8px;
1348
+ width: 100%;
1349
+ }
1350
+
1351
+ .status-badge {
1352
+ display: flex;
1353
+ align-items: center;
1354
+ width: 100%;
1355
+ }
1356
+
1357
+ .status-badge.el-tag--warning {
1358
+ background-color: #fdf6ec;
1359
+ border-color: #faecd8;
1360
+ }
1361
+
1362
+ .status-badge.el-tag--info {
1363
+ background-color: #f4f4f5;
1364
+ border-color: #e9e9eb;
1365
+ }
1366
+
1367
+ .badge-content {
1368
+ display: flex;
1369
+ align-items: center;
1370
+ gap: 6px;
1371
+ font-size: 13px;
1372
+ }
1373
+ .diff-dialog {
1374
+ height: calc(100vh - 150px);
1375
+ }
1376
+
1377
+ .diff-dialog-header {
1378
+ display: flex;
1379
+ justify-content: space-between;
1380
+ align-items: center;
1381
+ padding: 16px 20px;
1382
+ border-bottom: 1px solid #ebeef5;
1383
+ background-color: #f9f9fb;
1384
+ }
1385
+
1386
+ .file-title {
1387
+ display: flex;
1388
+ align-items: center;
1389
+ font-size: 16px;
1390
+ font-weight: 500;
1391
+ color: #303133;
1392
+ gap: 10px;
1393
+ overflow: hidden;
1394
+ }
1395
+
1396
+ .file-icon {
1397
+ color: #409eff;
1398
+ font-size: 20px;
1399
+ }
1400
+
1401
+ .file-path {
1402
+ white-space: nowrap;
1403
+ overflow: hidden;
1404
+ text-overflow: ellipsis;
1405
+ font-family: monospace;
1406
+ }
1407
+
1408
+ .diff-content {
1409
+ flex: 1;
1410
+ overflow-y: auto;
1411
+ padding: 10px 20px;
1412
+ background-color: #fafafa;
1413
+ /* height: 100%;
1414
+ overflow: auto; */
1415
+ }
1416
+ :deep(.el-dialog__body) {
1417
+ height: calc(100vh - 320px);
1418
+ overflow: auto;
1419
+ }
1420
+ .diff-formatted {
1421
+ font-family: 'Consolas', 'Courier New', monospace;
1422
+ font-size: 14px;
1423
+ line-height: 1.5;
1424
+ white-space: pre-wrap;
1425
+ padding-bottom: 20px;
1426
+ }
1427
+
1428
+ .no-diff {
1429
+ display: flex;
1430
+ align-items: center;
1431
+ justify-content: center;
1432
+ height: 100%;
1433
+ color: #909399;
1434
+ font-size: 14px;
1435
+ }
1436
+
1437
+ .file-navigation {
1438
+ display: flex;
1439
+ justify-content: space-between;
1440
+ align-items: center;
1441
+ padding: 10px 20px;
1442
+ border-top: 1px solid #ebeef5;
1443
+ background-color: #f9f9fb;
1444
+ }
1445
+
1446
+ .counter-tag {
1447
+ font-family: monospace;
1448
+ font-size: 14px;
1449
+ padding: 6px 12px;
1450
+ min-width: 80px;
1451
+ text-align: center;
1452
+ }
1453
+
1454
+ .nav-button {
1455
+ min-width: 120px;
1456
+ }
1457
+
1458
+ /* 确保文件差异对话框里的内容滚动条样式一致 */
1459
+ .diff-formatted::-webkit-scrollbar,
1460
+ .diff-content::-webkit-scrollbar {
1461
+ width: 6px;
1462
+ height: 6px;
1463
+ }
1464
+
1465
+ .diff-formatted::-webkit-scrollbar-thumb,
1466
+ .diff-content::-webkit-scrollbar-thumb {
1467
+ background-color: rgba(144, 147, 153, 0.3);
1468
+ border-radius: 4px;
1469
+ }
1470
+
1471
+ .diff-formatted::-webkit-scrollbar-thumb:hover,
1472
+ .diff-content::-webkit-scrollbar-thumb:hover {
1473
+ background-color: rgba(144, 147, 153, 0.5);
1474
+ }
1475
+
1476
+ .diff-formatted::-webkit-scrollbar-track,
1477
+ .diff-content::-webkit-scrollbar-track {
1478
+ background-color: transparent;
1479
+ }
1480
+
1481
+ /* 兼容Firefox滚动条样式 */
1482
+ .diff-formatted,
1483
+ .diff-content {
1484
+ scrollbar-width: thin;
1485
+ scrollbar-color: rgba(144, 147, 153, 0.3) transparent;
1486
+ }
1104
1487
  </style>
1105
1488
 
1106
1489
  <!-- 非scoped样式,使diff格式化样式对动态内容生效 -->