Browse Source

fix: 添加commit界面,修改关联项目的bug

zhaoxingrui 5 years ago
parent
commit
fb1f186ea4

+ 1 - 0
src/assets/icon_new/git-hover.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M101.6 443.4c0 50.6 32.4 120 83 137v2c-37.6 16.6-48 101.2 2 131.6v2C132 734 96 768.6 96 828.4c0 103 97.6 131.6 183 131.6 104 0 181.4-37.4 181.4-152 0-141-202-89-202-165.6 0-27 14.4-37.4 39.4-42.6 83-15.4 135-80 135-164.4 0-14.6-3-28.4-8-42 13.4-3 26.4-6.6 39.4-11v-101c-34.4 13.6-71.4 23.6-109 23.6-107.6-62-253.6 2.6-253.6 138.4z m175.4 327.6c34 0 82.4 6 82.4 50 0 43.6-39 52.6-75.4 52.6-34.6 0-86.6-5.4-86.6-50.4 0.2-44.6 44.2-52.2 79.6-52.2zM270.6 512c-44 0-62.6-26-62.6-67.6 0-98.6 122-97.6 122-1 0 40.6-16 68.6-59.4 68.6zM928 611v98c-26.6 14.6-61 19.6-91 19.6-107 0-119.6-84.4-119.6-171.4v-175.4h1v-2c-14 0-14.6-3.2-48 2v-95h48c0-44.6 0.6-62-3-82.4h113.4c-4 27.6-3 55-3 82.4h102v95s-38.6-2-102-2V562c0 29.6 6.6 65.6 43.6 65.6 19.6 0 42.6-5.6 58.6-16.6zM636 137.4c0 37.4-29 72.4-67.6 72.4-39.6 0-69-34.4-69-72.4 0-38.6 29-73.4 69-73.4C608 64 636 100 636 137.4z m-12.4 149c-3.6 29.2-3.2 399.6 0 435.6h-111c3.2-36.2 3.6-406 0-435.6h111z" fill="#2c2c2c" /></svg>

+ 1 - 0
src/assets/icon_new/git-using.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M101.6 443.4c0 50.6 32.4 120 83 137v2c-37.6 16.6-48 101.2 2 131.6v2C132 734 96 768.6 96 828.4c0 103 97.6 131.6 183 131.6 104 0 181.4-37.4 181.4-152 0-141-202-89-202-165.6 0-27 14.4-37.4 39.4-42.6 83-15.4 135-80 135-164.4 0-14.6-3-28.4-8-42 13.4-3 26.4-6.6 39.4-11v-101c-34.4 13.6-71.4 23.6-109 23.6-107.6-62-253.6 2.6-253.6 138.4z m175.4 327.6c34 0 82.4 6 82.4 50 0 43.6-39 52.6-75.4 52.6-34.6 0-86.6-5.4-86.6-50.4 0.2-44.6 44.2-52.2 79.6-52.2zM270.6 512c-44 0-62.6-26-62.6-67.6 0-98.6 122-97.6 122-1 0 40.6-16 68.6-59.4 68.6zM928 611v98c-26.6 14.6-61 19.6-91 19.6-107 0-119.6-84.4-119.6-171.4v-175.4h1v-2c-14 0-14.6-3.2-48 2v-95h48c0-44.6 0.6-62-3-82.4h113.4c-4 27.6-3 55-3 82.4h102v95s-38.6-2-102-2V562c0 29.6 6.6 65.6 43.6 65.6 19.6 0 42.6-5.6 58.6-16.6zM636 137.4c0 37.4-29 72.4-67.6 72.4-39.6 0-69-34.4-69-72.4 0-38.6 29-73.4 69-73.4C608 64 636 100 636 137.4z m-12.4 149c-3.6 29.2-3.2 399.6 0 435.6h-111c3.2-36.2 3.6-406 0-435.6h111z" fill="#1296db" /></svg>

+ 1 - 0
src/assets/icon_new/git.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M101.6 443.4c0 50.6 32.4 120 83 137v2c-37.6 16.6-48 101.2 2 131.6v2C132 734 96 768.6 96 828.4c0 103 97.6 131.6 183 131.6 104 0 181.4-37.4 181.4-152 0-141-202-89-202-165.6 0-27 14.4-37.4 39.4-42.6 83-15.4 135-80 135-164.4 0-14.6-3-28.4-8-42 13.4-3 26.4-6.6 39.4-11v-101c-34.4 13.6-71.4 23.6-109 23.6-107.6-62-253.6 2.6-253.6 138.4z m175.4 327.6c34 0 82.4 6 82.4 50 0 43.6-39 52.6-75.4 52.6-34.6 0-86.6-5.4-86.6-50.4 0.2-44.6 44.2-52.2 79.6-52.2zM270.6 512c-44 0-62.6-26-62.6-67.6 0-98.6 122-97.6 122-1 0 40.6-16 68.6-59.4 68.6zM928 611v98c-26.6 14.6-61 19.6-91 19.6-107 0-119.6-84.4-119.6-171.4v-175.4h1v-2c-14 0-14.6-3.2-48 2v-95h48c0-44.6 0.6-62-3-82.4h113.4c-4 27.6-3 55-3 82.4h102v95s-38.6-2-102-2V562c0 29.6 6.6 65.6 43.6 65.6 19.6 0 42.6-5.6 58.6-16.6zM636 137.4c0 37.4-29 72.4-67.6 72.4-39.6 0-69-34.4-69-72.4 0-38.6 29-73.4 69-73.4C608 64 636 100 636 137.4z m-12.4 149c-3.6 29.2-3.2 399.6 0 435.6h-111c3.2-36.2 3.6-406 0-435.6h111z" fill="#8a8a8a" /></svg>

+ 2 - 2
src/components/GeneralTable.vue

@@ -49,9 +49,9 @@
     ></ElTableColumn>
     <ElTableColumn
       prop="timeToTake"
-      label="预期耗时"
+      label="预期耗时(人日)"
       align="center"
-      width="100"
+      width="120"
     ></ElTableColumn>
     <ElTableColumn
       label="开始时间"

+ 12 - 0
src/components/SideBar.vue

@@ -30,6 +30,7 @@ const sidebar = [
   { name: 'database', description: '数据库', hide: false },
   { name: 'apitest', description: '测试', hide: false },
   { name: 'invite', description: '项目关联', hide: false },
+  { name: 'git', description: '提交记录', hide: false },
 ];
 
 export default {
@@ -168,6 +169,17 @@ export default {
     color: #1296db;
   }
 }
+.icon[target=git]{
+  background-image: url("../assets/icon_new/git.svg");
+  .el-menu-item:hover & {
+    background-image: url("../assets/icon_new/git-hover.svg");
+    color: #2c2c2c;
+  }
+  .el-menu-item.is-active & {
+    background-image: url("../assets/icon_new/git-using.svg");
+    color: #1296db;
+  }
+}
 .title{
   font-size: 9px;
   margin-top: 12px;

+ 4 - 0
src/element-plus.ts

@@ -40,6 +40,8 @@ import {
   ElTableColumn,
   ElTabs,
   ElTag,
+  ElTimeline,
+  ElTimelineItem,
   ElTooltip,
 } from 'element-plus';
 
@@ -87,6 +89,8 @@ export const Components = [
   ElTableColumn,
   ElTabs,
   ElTag,
+  ElTimeline,
+  ElTimelineItem,
   ElTooltip,
 ];
 

+ 4 - 0
src/router/index.ts

@@ -66,6 +66,10 @@ const routes: Array<RouteRecordRaw> = [
         path: 'invite',
         component: () => import(/* webpackChunkName: "project" */'@/views/Project/Invite.vue'),
       },
+      {
+        path: 'git',
+        component: () => import(/* webpackChunkName: "project" */'@/views/Project/Commit.vue'),
+      },
     ],
   }),
 ];

+ 110 - 0
src/views/Project/Commit.vue

@@ -0,0 +1,110 @@
+<template>
+  <div class="container">
+    <el-row class="row-item title">
+      <h2>commit记录</h2>
+    </el-row>
+    <div>
+      <ElTimeline>
+        <ElTimelineItem
+          v-for="(git, index) in gits"
+          :key="index"
+          :timestamp="git.timestamp"
+          placement="top">
+          <ElCard>
+            <h3 class="id">#{{git.id}}</h3>
+            <div style="margin-top: 10px; font-size: 16px">{{git.message}}</div>
+            <div style="margin-top: 10px">
+              <el-row>
+                <el-col :span="12">
+                  处理人:<span style="font-weight: bold">{{git.gitlabUsername}}</span>
+                </el-col>
+                <el-col :span="12">
+                  类型:
+                  <span v-if="git.relatedType === 'BUG_ID'" class="node bug">缺陷</span>
+                  <span v-else class="node requirement">需求</span></el-col>
+              </el-row>
+            </div>
+          </ElCard>
+        </ElTimelineItem>
+      </ElTimeline>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'Commit.vue',
+  data() {
+    return {
+      gits: [
+        {
+          id: '010f2a0ccf522fe6c1408bffdd494782880c1ec9',
+          message: 'fix: working on #942#, 处理bug942',
+          timestamp: '2021-07-10 15:09:36',
+          gitlabUsername: 'xiaofei',
+          relatedType: 'BUG_ID',
+          relatedId: 942,
+        },
+        {
+          id: '030a88a98695d83bdd91937783c08323451d5046',
+          message: 'feat: complete #878# ',
+          timestamp: '2021-07-09 23:18:20',
+          gitlabUsername: '17313',
+          relatedType: 'TREE_ID',
+          relatedId: 878,
+        },
+        {
+          id: '07f536fc5d660d8085d360961ab4fd337df9b8f1',
+          message: 'fix: fixing on #17#',
+          timestamp: '2021-07-08 13:45:22',
+          gitlabUsername: 'suyiiis',
+          relatedType: 'BUG_ID',
+          relatedId: 17,
+        },
+        {
+          id: '0c75b8b675291c1f90a56e912befc38341ec3171',
+          message: 'feat: complete #273#',
+          timestamp: '2021-07-08 10:11:23',
+          gitlabUsername: 'YGcatwhite',
+          relatedType: 'TREE_ID',
+          relatedId: 273,
+        },
+      ],
+    };
+  },
+};
+</script>
+
+<style scoped>
+.container {
+  margin: 50px 100px;
+  width: 30%;
+}
+.row-item {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin-bottom: 10px;
+}
+.id {
+  width: fit-content;
+  height: 20px;
+  background-color: #2185d0;
+  color: #fff;
+  border: 0 solid transparent;
+  border-radius: .28571429rem;
+}
+.node {
+  width: 15px;
+  color: #FFFFFF;
+  border-radius: 3px;
+  font-size: 14px;
+  text-align: center;
+}
+.bug {
+  background-color: chocolate;
+}
+.requirement {
+  background-color: #42b983;
+}
+</style>

+ 11 - 2
src/views/Project/Invite.vue

@@ -56,8 +56,17 @@ export default {
       ElMessage.success('邀请码将在5分钟后失效,请及时完成操作!');
     },
     async relate() {
-      await ProjectAPI.relateProject(this.$store.state.workspace.currentProjectId, this.targetCode);
-      ElMessage.success('关联成功');
+      await ProjectAPI.relateProject(this.$store.state.workspace.currentProjectId, this.targetCode).then((res) => {
+        if (res === '验证码有效时间为五分钟,已过期') {
+          ElMessage.warning('验证码有效时间为五分钟,已过期');
+        } else if (res === '不可将本项目与自身关联!') {
+          ElMessage.error('不可将本项目与自身关联!');
+        } else if (res === '该项目已与目标项目关联过,无须重复关联') {
+          ElMessage.warning('该项目已与目标项目关联过,无须重复关联');
+        } else {
+          ElMessage.success('关联成功');
+        }
+      });
       this.targetCode = '';
     },
   },