Parcourir la source

新增接口,更新饼图

181250114@smail.nju.edu.cn il y a 4 ans
Parent
commit
56ad14f730

+ 3 - 1
src/network/dashboard/index.js

@@ -1,3 +1,5 @@
 import request from "@/network/request";
 
-export const  getAllUsers = config => request._get("/display/getAllUsers", config);
+export const  getAllUsers = config => request._get("/display/getAllUsers", config);
+
+export const getAllDevcloudUsers = config => request._get("display/getAllDevcloudUsers",config);

+ 3 - 1
src/network/devcloud/index.js

@@ -1,3 +1,5 @@
 import request from "@/network/request";
 
-export const  getStudentAnalysis = config => request._get("/devcloud/getStudentAnalysis", config);
+export const  getStudentAnalysis = config => request._get("/devcloud/getStudentAnalysis", config);
+
+export const getGroupAnalysis = config => request._get("/display/getGroupAnalysisById",config);

+ 3 - 2
src/views/Dashboard.vue

@@ -41,7 +41,7 @@
 </template>
 
 <script>
-import { getAllUsers } from "@/network/dashboard/index.js";
+import { getAllUsers, getAllDevcloudUsers } from "@/network/dashboard/index.js";
 export default {
   data() {
     return {
@@ -63,7 +63,8 @@ export default {
     },
     async getAllUsers() {
       try {
-        let res = await getAllUsers();
+        // let res = await getAllUsers();
+        let res = await getAllDevcloudUsers();
         if (res.success) {
           this.studentList = res.content;
           this.pageList = this.studentList.slice(

+ 85 - 53
src/views/DevGroupPage.vue

@@ -14,10 +14,10 @@
           <el-descriptions :column="2">
             <template v-for="item in productList">
               <el-descriptions-item label="项目id" :key="item.id">{{
-                item.id
+                item.projectId
               }}</el-descriptions-item>
               <el-descriptions-item label="项目名称" :key="item.name">{{
-                item.name
+                item.projectName
               }}</el-descriptions-item>
             </template>
           </el-descriptions>
@@ -29,14 +29,14 @@
           <el-descriptions :column="3">
             <template v-for="item in userList">
               <el-descriptions-item label="用户id" :key="item.id">{{
-                item.id
-              }}</el-descriptions-item>
-              <el-descriptions-item label="学号" :key="item.number">{{
-                item.number
+                item.userId
               }}</el-descriptions-item>
-              <el-descriptions-item label="姓名" :key="item.name">{{
+              <el-descriptions-item label="姓名" :key="item.number">{{
                 item.name
               }}</el-descriptions-item>
+              <el-descriptions-item label="电子邮箱" :key="item.name">{{
+                item.email
+              }}</el-descriptions-item>
             </template>
           </el-descriptions>
         </el-card>
@@ -48,13 +48,13 @@
         </div>
         <el-descriptions :column="2">
           <el-descriptions-item label="commit总次数">{{
-            commitMessage.commitTotal
+            commitMessage.commit_times
           }}</el-descriptions-item>
           <el-descriptions-item label="有效commit次数">{{
-            commitMessage.commit
+            commitMessage.valid_commit_times
           }}</el-descriptions-item>
           <el-descriptions-item label="bugList_commit次数">{{
-            commitMessage.bugList_commit
+            commitMessage.buglist_commit
           }}</el-descriptions-item>
           <el-descriptions-item label="feature_commit次数">{{
             commitMessage.feature_commit
@@ -66,7 +66,7 @@
             <span>commit具体信息</span>
           </div>
           <el-descriptions :column="1" :colon="false">
-            <template v-for="item in commitMessage.commitDetail">
+            <template v-for="item in commitMessage.commit_msg_overview">
               <el-descriptions-item :key="item">{{
                 item
               }}</el-descriptions-item>
@@ -85,16 +85,16 @@
           </div>
           <el-descriptions :column="2">
             <el-descriptions-item label="接口测试总数">{{
-              test.total
+              test.test_times
             }}</el-descriptions-item>
             <el-descriptions-item label="接口测试执行次数">{{
-              test.execute
+              test.test_concurrency_count
             }}</el-descriptions-item>
             <el-descriptions-item label="接口测试失败次数">{{
-              test.fail
+              test.test_concurrency_failure
             }}</el-descriptions-item>
             <el-descriptions-item label="接口测试通过次数">{{
-              test.pass
+              test.test_concurrency_success
             }}</el-descriptions-item>
           </el-descriptions>
         </el-card>
@@ -106,13 +106,13 @@
         </div>
         <el-descriptions :column="2">
           <el-descriptions-item label="流水线部署次数">{{
-            arrange.total
+            arrange.pipeline_deploy
           }}</el-descriptions-item>
           <el-descriptions-item label="流水线部署成功次数">{{
-            arrange.pass
+            arrange.pipeline_pass
           }}</el-descriptions-item>
           <el-descriptions-item label="流水线部署失败次数">{{
-            arrange.fail
+            arrange.pipline_failure
           }}</el-descriptions-item>
         </el-descriptions>
       </el-card>
@@ -141,6 +141,8 @@
 import * as echarts from "echarts";
 import Layout from "@/components/content/Layout";
 import Title from "@/components/content/Title";
+import { getGroupAnalysis } from "@/network/devcloud/index.js";
+import {getStudentAnalysis} from "../network/devcloud";
 export default {
   components: {
     Layout,
@@ -149,68 +151,98 @@ export default {
   data() {
     return {
       commitContribution: [
-        { name: "zqq", times: 0, proportion: 0 },
-        { name: "ty", times: 2, proportion: 0.4 },
-        { name: "kcy", times: 1, proportion: 0.2 },
-        { name: "pyy", times: 2, proportion: 0.4 },
+        // { name: "zqq", times: 0, proportion: 0 },
+        // { name: "ty", times: 2, proportion: 0.4 },
+        // { name: "kcy", times: 1, proportion: 0.2 },
+        // { name: "pyy", times: 2, proportion: 0.4 },
       ],
       interfaceContribution: [
-        { name: "zqq", times: 4, proportion: 0.8 },
-        { name: "ty", times: 0, proportion: 0 },
-        { name: "kcy", times: 0, proportion: 0 },
-        { name: "pyy", times: 1, proportion: 0.2 },
+        // { name: "zqq", times: 4, proportion: 0.8 },
+        // { name: "ty", times: 0, proportion: 0 },
+        // { name: "kcy", times: 0, proportion: 0 },
+        // { name: "pyy", times: 1, proportion: 0.2 },
       ],
       pipelineContribution: [
-        { name: "zqq", times: 1, proportion: 0.1 },
-        { name: "ty", times: 1, proportion: 0.1 },
-        { name: "kcy", times: 2, proportion: 0.2 },
-        { name: "pyy", times: 6, proportion: 0.6 },
+        // { name: "zqq", times: 1, proportion: 0.1 },
+        // { name: "ty", times: 1, proportion: 0.1 },
+        // { name: "kcy", times: 2, proportion: 0.2 },
+        // { name: "pyy", times: 6, proportion: 0.6 },
       ],
       commitPie: [],
       testPie: [],
       deployPie: [],
       arrange: {
-        total: 10,
-        pass: 20,
-        fail: 20,
+        // total: 10,
+        // pass: 20,
+        // fail: 20,
       },
       test: {
-        total: 20,
-        execute: 200,
-        pass: 10,
-        fail: 20,
+        // total: 20,
+        // execute: 200,
+        // pass: 10,
+        // fail: 20,
       },
       commitMessage: {
-        commitTotal: 5,
-        commit: 3,
-        bugList_commit: 4,
-        feature_commit: 3,
-        commitDetail: [
-          "- fix: 修改错误",
-          "- feat: 增加评论区功能",
-          "- feat: 增加头像上传",
-          "- fix: 修复登录页面的错误",
-        ],
+        // commitTotal: 5,
+        // commit: 3,
+        // bugList_commit: 4,
+        // feature_commit: 3,
+        // commitDetail: [
+        //   "- fix: 修改错误",
+        //   "- feat: 增加评论区功能",
+        //   "- feat: 增加头像上传",
+        //   "- fix: 修复登录页面的错误",
+        // ],
       },
       userList: [
-        { id: 11, name: "测试", number: "2222" },
-        { id: 12, name: "测试2", number: "2222" },
-        { id: 13, name: "测试3", number: "2222" },
+        // { id: 11, name: "测试", number: "2222" },
+        // { id: 12, name: "测试2", number: "2222" },
+        // { id: 13, name: "测试3", number: "2222" },
       ],
       productList: [
-        { id: 1, name: "fun_frontEnd" },
-        { id: 2, name: "fun_backEnd" },
+        // { id: 1, name: "fun_frontEnd" },
+        // { id: 2, name: "fun_backEnd" },
       ],
     };
   },
-  mounted() {
+  async mounted() {
+    await this.getData();
     this.getAnalysis();
     this.getCommitPie();
     this.getTestPie();
     this.getDeployPie();
   },
   methods: {
+    async getData(){
+      try{
+        let res = await getGroupAnalysis({
+          params: {
+            user_id: this.$route.params.id,
+          },
+        });
+        // console.log(res);
+        console.log("here");
+        // console.log(res.content.commit["commit_contribution"]);
+        if(res.success){
+          this.userList = res.content.students;
+          this.productList = res.content.projects;
+          this.commitMessage = res.content.commit;
+          this.commitContribution = res.content.commit.commit_contribution;
+          this.test = res.content.test;
+          this.interfaceContribution = res.content.test.test_contribution;
+          this.arrange = res.content.pipeline;
+          this.pipelineContribution = res.content.pipeline.pipeline_contribution;
+        }
+        console.log("done");
+        console.log(this.commitContribution);
+      } catch(e) {
+        this.$message.error(e.message);
+      }
+    },
+
     getAnalysis() {
+      console.log("analysis");
+      console.log(this.commitContribution);
       for (let i = 0; i < this.commitContribution.length; i++) {
         this.commitPie.push({
           value: this.commitContribution[i].times,

+ 5 - 4
src/views/DevStudentPage.vue

@@ -170,10 +170,11 @@ export default {
       productList: [],
     };
   },
-  created() {
-    this.getData();
-  },
-  mounted() {
+  // created() {
+  //   this.getData();
+  // },
+  async mounted() {
+    await this.getData();
     this.getAnaylysis();
   },
   methods: {