zen-gitsync 2.0.5 → 2.0.6

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.
@@ -675,255 +675,319 @@ onMounted(() => {
675
675
  </script>
676
676
 
677
677
  <template>
678
- <div class="card">
679
- <h2>提交更改</h2>
680
-
681
- <div class="layout-container">
682
- <!-- 如果没有配置Git用户信息,显示提示 -->
683
- <div v-if="gitStore.userName === '' || gitStore.userEmail === ''" class="git-config-warning">
684
- <el-alert
685
- title="Git用户信息未配置"
686
- type="warning"
687
- :closable="false"
688
- show-icon
689
- >
690
- <p>您需要配置Git用户名和邮箱才能提交代码。请使用以下命令配置:</p>
691
- <pre class="config-command">git config --global user.name "Your Name"
692
- git config --global user.email "your.email@example.com"</pre>
693
- </el-alert>
694
- </div>
695
-
696
- <!-- 正常的提交区域,仅在Git用户信息已配置时显示 -->
697
- <template v-else>
698
- <!-- 左侧:提交表单 -->
699
- <div class="commit-section">
700
- <div class="commit-options">
701
- <div class="options-row">
702
- <div class="commit-mode-toggle">
703
- <el-switch v-model="isStandardCommit" active-text="标准化提交" inactive-text="普通提交" />
704
- </div>
678
+ <div class="card" :class="{ 'is-pushing': gitLogStore.isPushing || isPushing }">
679
+ <div class="card-header">
680
+ <h2>提交更改</h2>
681
+ </div>
705
682
 
706
- <div class="no-verify-toggle">
707
- <el-tooltip content="跳过 Git 钩子检查 (--no-verify)" placement="top">
708
- <el-switch v-model="skipHooks" active-text="跳过钩子 (--no-verify)" />
709
- </el-tooltip>
683
+ <div class="card-content">
684
+ <div class="layout-container">
685
+ <!-- 如果没有配置Git用户信息,显示提示 -->
686
+ <div v-if="gitStore.userName === '' || gitStore.userEmail === ''" class="git-config-warning">
687
+ <el-alert
688
+ title="Git用户信息未配置"
689
+ type="warning"
690
+ :closable="false"
691
+ show-icon
692
+ >
693
+ <p>您需要配置Git用户名和邮箱才能提交代码。请使用以下命令配置:</p>
694
+ <pre class="config-command">git config --global user.name "Your Name"
695
+ git config --global user.email "your.email@example.com"</pre>
696
+ </el-alert>
697
+ </div>
698
+
699
+ <!-- 正常的提交区域,仅在Git用户信息已配置时显示 -->
700
+ <template v-else>
701
+ <!-- 左侧:提交表单 -->
702
+ <div class="commit-section">
703
+ <div class="commit-options">
704
+ <div class="options-row">
705
+ <div class="commit-mode-toggle">
706
+ <el-switch v-model="isStandardCommit" active-text="标准化提交" inactive-text="普通提交" />
707
+ </div>
708
+
709
+ <div class="no-verify-toggle">
710
+ <el-tooltip content="跳过 Git 钩子检查 (--no-verify)" placement="top">
711
+ <el-switch v-model="skipHooks" active-text="跳过钩子 (--no-verify)" />
712
+ </el-tooltip>
713
+ </div>
710
714
  </div>
711
715
  </div>
712
- </div>
713
-
714
- <!-- 普通提交表单 -->
715
- <div v-if="!isStandardCommit" class="commit-form">
716
- <el-input v-model="commitMessage" :placeholder="placeholder" clearable />
717
- </div>
718
716
 
719
- <!-- 标准化提交表单 -->
720
- <div v-else class="standard-commit-form">
721
- <div class="standard-commit-header">
722
- <el-select v-model="commitType" placeholder="提交类型" class="type-select" clearable>
723
- <el-option v-for="item in commitTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
724
- </el-select>
725
-
726
- <div class="scope-container">
727
- <el-input v-model="commitScope" placeholder="作用域(可选)" class="scope-input" clearable />
728
- <el-button type="primary" :icon="Setting" circle size="small" class="settings-button"
729
- @click="openScopeSettings">
730
- </el-button>
731
- </div>
717
+ <!-- 普通提交表单 -->
718
+ <div v-if="!isStandardCommit" class="commit-form">
719
+ <el-input v-model="commitMessage" :placeholder="placeholder" clearable />
720
+ </div>
732
721
 
733
- <div class="description-container">
734
- <el-input v-model="commitDescription" placeholder="简短描述(必填)" class="description-input" clearable />
735
- <el-button type="primary" :icon="Setting" circle size="small" class="settings-button"
736
- @click="openDescriptionSettings">
737
- </el-button>
722
+ <!-- 标准化提交表单 -->
723
+ <div v-else class="standard-commit-form">
724
+ <div class="standard-commit-header">
725
+ <el-select v-model="commitType" placeholder="提交类型" class="type-select" clearable>
726
+ <el-option v-for="item in commitTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
727
+ </el-select>
728
+
729
+ <div class="scope-container">
730
+ <el-input v-model="commitScope" placeholder="作用域(可选)" class="scope-input" clearable />
731
+ <el-button type="primary" :icon="Setting" circle size="small" class="settings-button"
732
+ @click="openScopeSettings">
733
+ </el-button>
734
+ </div>
735
+
736
+ <div class="description-container">
737
+ <el-input v-model="commitDescription" placeholder="简短描述(必填)" class="description-input" clearable />
738
+ <el-button type="primary" :icon="Setting" circle size="small" class="settings-button"
739
+ @click="openDescriptionSettings">
740
+ </el-button>
741
+ </div>
738
742
  </div>
739
- </div>
740
743
 
741
- <el-input v-model="commitBody" type="textarea" :rows="4" placeholder="正文(可选):详细描述本次提交的内容和原因" class="body-input"
742
- clearable />
744
+ <el-input v-model="commitBody" type="textarea" :rows="4" placeholder="正文(可选):详细描述本次提交的内容和原因" class="body-input"
745
+ clearable />
743
746
 
744
- <el-input v-model="commitFooter" placeholder="页脚(可选):如 Closes #123" class="footer-input" clearable />
747
+ <el-input v-model="commitFooter" placeholder="页脚(可选):如 Closes #123" class="footer-input" clearable />
745
748
 
746
- <div class="preview-section">
747
- <div class="preview-title">提交信息预览:</div>
748
- <pre class="preview-content">{{ finalCommitMessage }}</pre>
749
+ <div class="preview-section">
750
+ <div class="preview-title">提交信息预览:</div>
751
+ <pre class="preview-content">{{ finalCommitMessage }}</pre>
749
752
 
750
- <div class="preview-title" style="margin-top: 10px;">Git命令预览:</div>
751
- <pre class="preview-content code-command">{{ gitCommandPreview }}</pre>
753
+ <div class="preview-title" style="margin-top: 10px;">Git命令预览:</div>
754
+ <pre class="preview-content code-command">{{ gitCommandPreview }}</pre>
755
+ </div>
752
756
  </div>
753
757
  </div>
754
- </div>
755
758
 
756
- <!-- 右侧:操作区域 -->
757
- <div class="actions-section">
758
- <h3>Git 操作</h3>
759
- <div class="action-groups">
760
- <div class="action-group">
761
- <div class="group-title">基础操作</div>
762
- <div class="group-buttons">
763
- <el-button
764
- type="primary"
765
- @click="addToStage"
766
- :loading="gitLogStore.isAddingFiles"
767
- class="action-button"
768
- >
769
- 暂存更改
770
- <span class="command-text">git add .</span>
771
- </el-button>
772
-
773
- <el-button
774
- type="primary"
775
- @click="commitChanges"
776
- :loading="gitLogStore.isLoadingStatus"
777
- class="action-button"
778
- >
779
- 提交
780
- <span class="command-text">git commit</span>
781
- </el-button>
782
-
783
- <el-button
784
- type="success"
785
- @click="pushToRemote"
786
- :loading="gitLogStore.isPushing"
787
- class="action-button push-button"
788
- >
789
- 推送
790
- <span class="command-text">git push</span>
791
- </el-button>
759
+ <!-- 右侧:操作区域 -->
760
+ <div class="actions-section">
761
+ <h3>Git 操作</h3>
762
+ <div class="action-groups">
763
+ <div class="action-group">
764
+ <div class="group-title">基础操作</div>
765
+ <div class="group-buttons">
766
+ <el-button
767
+ type="primary"
768
+ @click="addToStage"
769
+ :loading="gitLogStore.isAddingFiles"
770
+ class="action-button"
771
+ >
772
+ 暂存更改
773
+ <span class="command-text">git add .</span>
774
+ </el-button>
775
+
776
+ <el-button
777
+ type="primary"
778
+ @click="commitChanges"
779
+ :loading="gitLogStore.isLoadingStatus"
780
+ class="action-button"
781
+ >
782
+ 提交
783
+ <span class="command-text">git commit</span>
784
+ </el-button>
785
+
786
+ <el-button
787
+ type="success"
788
+ @click="pushToRemote"
789
+ :loading="gitLogStore.isPushing"
790
+ class="action-button push-button"
791
+ >
792
+ 推送
793
+ <span class="command-text">git push</span>
794
+ </el-button>
795
+ </div>
792
796
  </div>
793
- </div>
794
797
 
795
- <div class="action-group">
796
- <div class="group-title">组合操作</div>
797
- <div class="group-buttons">
798
- <el-button
799
- type="warning"
800
- @click="addAndCommit"
801
- :loading="gitLogStore.isAddingFiles || gitLogStore.isCommiting"
802
- class="action-button"
803
- >
804
- 暂存并提交
805
- <span class="command-text">git add + commit</span>
806
- </el-button>
807
-
808
- <el-button
809
- type="danger"
810
- @click="addCommitAndPush"
811
- :loading="gitLogStore.isAddingFiles || gitLogStore.isCommiting || gitLogStore.isPushing"
812
- class="action-button"
813
- >
814
- 一键推送
815
- <span class="command-text command-text-long">git add + commit + push</span>
816
- </el-button>
798
+ <div class="action-group">
799
+ <div class="group-title">组合操作</div>
800
+ <div class="group-buttons">
801
+ <el-button
802
+ type="warning"
803
+ @click="addAndCommit"
804
+ :loading="gitLogStore.isAddingFiles || gitLogStore.isCommiting"
805
+ class="action-button"
806
+ >
807
+ 暂存并提交
808
+ <span class="command-text">git add + commit</span>
809
+ </el-button>
810
+
811
+ <el-button
812
+ type="danger"
813
+ @click="addCommitAndPush"
814
+ :loading="gitLogStore.isAddingFiles || gitLogStore.isCommiting || gitLogStore.isPushing"
815
+ class="action-button"
816
+ >
817
+ 一键推送
818
+ <span class="command-text command-text-long">git add + commit + push</span>
819
+ </el-button>
820
+ </div>
817
821
  </div>
818
- </div>
819
822
 
820
- <div class="action-group">
821
- <div class="group-title">重置操作</div>
822
- <div class="group-buttons">
823
- <!-- <el-button
824
- type="info"
825
- @click="resetHead"
826
- :loading="gitLogStore.isResetting"
827
- :icon="Refresh"
828
- class="action-button reset-button"
829
- >
830
- 重置暂存区
831
- <span class="command-text">git reset HEAD</span>
832
- </el-button> -->
833
-
834
- <el-button
835
- type="info"
836
- @click="resetToRemote"
837
- :loading="gitLogStore.isResetting"
838
- class="action-button reset-button"
839
- >
840
- 重置到远程
841
- <span class="command-text command-text-long">git reset --hard origin/branch</span>
842
- </el-button>
823
+ <div class="action-group">
824
+ <div class="group-title">重置操作</div>
825
+ <div class="group-buttons">
826
+ <!-- <el-button
827
+ type="info"
828
+ @click="resetHead"
829
+ :loading="gitLogStore.isResetting"
830
+ :icon="Refresh"
831
+ class="action-button reset-button"
832
+ >
833
+ 重置暂存区
834
+ <span class="command-text">git reset HEAD</span>
835
+ </el-button> -->
836
+
837
+ <el-button
838
+ type="info"
839
+ @click="resetToRemote"
840
+ :loading="gitLogStore.isResetting"
841
+ class="action-button reset-button"
842
+ >
843
+ 重置到远程
844
+ <span class="command-text command-text-long">git reset --hard origin/branch</span>
845
+ </el-button>
846
+ </div>
843
847
  </div>
844
848
  </div>
845
849
  </div>
846
- </div>
847
- </template>
848
- </div>
850
+ </template>
851
+ </div>
849
852
 
850
- <!-- 简短描述设置弹窗 -->
851
- <el-dialog title="简短描述模板设置" v-model="descriptionDialogVisible" width="80vw" style="height: 80vh">
852
- <div class="template-container">
853
- <div class="template-form">
854
- <el-input v-model="newTemplateName" :placeholder="isEditingDescription ? '编辑模板内容' : '输入新模板内容'"
855
- class="template-input" clearable />
856
- <div class="template-form-buttons">
857
- <el-button v-if="isEditingDescription" @click="cancelEditDescriptionTemplate">取消</el-button>
858
- <el-button type="primary" @click="saveDescriptionTemplate" :disabled="!newTemplateName.trim()">{{
859
- isEditingDescription ? '更新模板' : '添加模板' }}</el-button>
853
+ <!-- 简短描述设置弹窗 -->
854
+ <el-dialog title="简短描述模板设置" v-model="descriptionDialogVisible" width="80vw" style="height: 80vh">
855
+ <div class="template-container">
856
+ <div class="template-form">
857
+ <el-input v-model="newTemplateName" :placeholder="isEditingDescription ? '编辑模板内容' : '输入新模板内容'"
858
+ class="template-input" clearable />
859
+ <div class="template-form-buttons">
860
+ <el-button v-if="isEditingDescription" @click="cancelEditDescriptionTemplate">取消</el-button>
861
+ <el-button type="primary" @click="saveDescriptionTemplate" :disabled="!newTemplateName.trim()">{{
862
+ isEditingDescription ? '更新模板' : '添加模板' }}</el-button>
863
+ </div>
860
864
  </div>
861
- </div>
862
865
 
863
- <div class="template-list">
864
- <h3>已保存模板</h3>
865
- <el-empty v-if="descriptionTemplates.length === 0" description="暂无保存的模板" />
866
- <el-card v-for="(template, index) in descriptionTemplates" :key="index" class="template-item">
867
- <!-- 两端对齐 -->
868
- <el-row justify="space-between" align="middle" style="width: 100%">
869
- <div class="template-content">{{ template }}</div>
870
- <div class="template-actions">
871
- <el-button type="primary" size="small" @click="useTemplate(template)">使用</el-button>
872
- <el-button type="warning" size="small" :icon="Edit"
873
- @click="startEditDescriptionTemplate(template, index)">编辑</el-button>
874
- <el-button type="danger" size="small" @click="deleteDescriptionTemplate(template)">删除</el-button>
875
- </div>
876
- </el-row>
877
- </el-card>
878
- </div>
879
- </div>
880
- </el-dialog>
881
-
882
- <!-- 作用域设置弹窗 -->
883
- <el-dialog title="作用域模板设置" v-model="scopeDialogVisible" width="80%" style="height: 80vh">
884
- <div class="template-container">
885
- <div class="template-form">
886
- <el-input v-model="newScopeTemplate" :placeholder="isEditingScope ? '编辑作用域模板内容' : '输入新作用域模板'"
887
- class="template-input" clearable />
888
- <div class="template-form-buttons">
889
- <el-button v-if="isEditingScope" @click="cancelEditScopeTemplate">取消</el-button>
890
- <el-button type="primary" @click="saveScopeTemplate" :disabled="!newScopeTemplate.trim()">{{ isEditingScope
891
- ? '更新模板' : '添加模板' }}</el-button>
866
+ <div class="template-list">
867
+ <h3>已保存模板</h3>
868
+ <el-empty v-if="descriptionTemplates.length === 0" description="暂无保存的模板" />
869
+ <el-card v-for="(template, index) in descriptionTemplates" :key="index" class="template-item">
870
+ <!-- 两端对齐 -->
871
+ <el-row justify="space-between" align="middle" style="width: 100%">
872
+ <div class="template-content">{{ template }}</div>
873
+ <div class="template-actions">
874
+ <el-button type="primary" size="small" @click="useTemplate(template)">使用</el-button>
875
+ <el-button type="warning" size="small" :icon="Edit"
876
+ @click="startEditDescriptionTemplate(template, index)">编辑</el-button>
877
+ <el-button type="danger" size="small" @click="deleteDescriptionTemplate(template)">删除</el-button>
878
+ </div>
879
+ </el-row>
880
+ </el-card>
892
881
  </div>
893
882
  </div>
883
+ </el-dialog>
884
+
885
+ <!-- 作用域设置弹窗 -->
886
+ <el-dialog title="作用域模板设置" v-model="scopeDialogVisible" width="80%" style="height: 80vh">
887
+ <div class="template-container">
888
+ <div class="template-form">
889
+ <el-input v-model="newScopeTemplate" :placeholder="isEditingScope ? '编辑作用域模板内容' : '输入新作用域模板'"
890
+ class="template-input" clearable />
891
+ <div class="template-form-buttons">
892
+ <el-button v-if="isEditingScope" @click="cancelEditScopeTemplate">取消</el-button>
893
+ <el-button type="primary" @click="saveScopeTemplate" :disabled="!newScopeTemplate.trim()">{{ isEditingScope
894
+ ? '更新模板' : '添加模板' }}</el-button>
895
+ </div>
896
+ </div>
894
897
 
895
- <div class="template-list">
896
- <h3>已保存作用域</h3>
897
- <el-empty v-if="scopeTemplates.length === 0" description="暂无保存的作用域" />
898
- <el-card v-for="(template, index) in scopeTemplates" :key="index" class="template-item">
899
- <el-row justify="space-between" align="middle" style="width: 100%">
900
- <div class="template-content">{{ template }}</div>
901
- <div class="template-actions">
902
- <el-button type="primary" size="small" @click="useScopeTemplate(template)">使用</el-button>
903
- <el-button type="warning" size="small" :icon="Edit"
904
- @click="startEditScopeTemplate(template, index)">编辑</el-button>
905
- <el-button type="danger" size="small" @click="deleteScopeTemplate(template)">删除</el-button>
906
- </div>
907
- </el-row>
908
- </el-card>
898
+ <div class="template-list">
899
+ <h3>已保存作用域</h3>
900
+ <el-empty v-if="scopeTemplates.length === 0" description="暂无保存的作用域" />
901
+ <el-card v-for="(template, index) in scopeTemplates" :key="index" class="template-item">
902
+ <el-row justify="space-between" align="middle" style="width: 100%">
903
+ <div class="template-content">{{ template }}</div>
904
+ <div class="template-actions">
905
+ <el-button type="primary" size="small" @click="useScopeTemplate(template)">使用</el-button>
906
+ <el-button type="warning" size="small" :icon="Edit"
907
+ @click="startEditScopeTemplate(template, index)">编辑</el-button>
908
+ <el-button type="danger" size="small" @click="deleteScopeTemplate(template)">删除</el-button>
909
+ </div>
910
+ </el-row>
911
+ </el-card>
912
+ </div>
909
913
  </div>
910
- </div>
911
- </el-dialog>
914
+ </el-dialog>
915
+ </div>
912
916
  </div>
913
917
  </template>
914
918
 
915
919
  <style scoped>
920
+ /* 添加动画相关的CSS */
921
+ @keyframes snakeBorder {
922
+ 0%, 100% {
923
+ border-top: 2px solid #409EFF;
924
+ border-right: 2px solid transparent;
925
+ border-bottom: 2px solid transparent;
926
+ border-left: 2px solid transparent;
927
+ }
928
+ 25% {
929
+ border-top: 2px solid #409EFF;
930
+ border-right: 2px solid #67C23A;
931
+ border-bottom: 2px solid transparent;
932
+ border-left: 2px solid transparent;
933
+ }
934
+ 50% {
935
+ border-top: 2px solid transparent;
936
+ border-right: 2px solid #67C23A;
937
+ border-bottom: 2px solid #409EFF;
938
+ border-left: 2px solid transparent;
939
+ }
940
+ 75% {
941
+ border-top: 2px solid transparent;
942
+ border-right: 2px solid transparent;
943
+ border-bottom: 2px solid #409EFF;
944
+ border-left: 2px solid #67C23A;
945
+ }
946
+ }
947
+
948
+ @keyframes glowPulse {
949
+ 0%, 100% { box-shadow: 0 0 8px rgba(64, 158, 255, 0.4); }
950
+ 50% { box-shadow: 0 0 12px rgba(103, 194, 58, 0.5); }
951
+ }
952
+
916
953
  .card {
917
954
  background-color: white;
918
- border-radius: 5px;
919
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
920
- margin-bottom: 20px;
921
- padding: 20px;
955
+ border-radius: 8px;
956
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
957
+ border: 1px solid rgba(0, 0, 0, 0.03);
958
+ height: 100%;
959
+ width: 100%;
960
+ display: flex;
961
+ flex-direction: column;
962
+ overflow: hidden;
963
+ }
964
+
965
+ .card-header {
966
+ padding: 8px 16px;
967
+ border-bottom: 1px solid #f0f0f0;
968
+ display: flex;
969
+ justify-content: space-between;
970
+ align-items: center;
971
+ height: 36px;
972
+ }
973
+
974
+ .card-header h2 {
975
+ margin: 0;
976
+ font-size: 16px;
977
+ font-weight: 500;
978
+ color: #303133;
979
+ }
980
+
981
+ .card-content {
982
+ padding: 15px;
983
+ overflow-y: auto;
984
+ flex: 1;
922
985
  }
923
986
 
924
987
  .layout-container {
925
988
  display: flex;
926
989
  gap: 20px;
990
+ height: 100%;
927
991
  }
928
992
 
929
993
  .commit-section {
@@ -1029,6 +1093,7 @@ git config --global user.email "your.email@example.com"</pre>
1029
1093
  align-items: center;
1030
1094
  justify-content: center;
1031
1095
  width: 100%;
1096
+ min-height: 40px; /* 添加最小高度确保loading不会改变按钮高度 */
1032
1097
  }
1033
1098
 
1034
1099
  .action-button :deep(.el-icon) {
@@ -1037,6 +1102,14 @@ git config --global user.email "your.email@example.com"</pre>
1037
1102
  font-size: 18px;
1038
1103
  }
1039
1104
 
1105
+ /* 添加loading状态的样式 */
1106
+ .action-button :deep(.el-icon.is-loading) {
1107
+ position: absolute;
1108
+ top: calc(50% - 10px);
1109
+ left: calc(16px);
1110
+ margin-top: 0;
1111
+ }
1112
+
1040
1113
  .command-text {
1041
1114
  position: absolute;
1042
1115
  bottom: 6px;