Johnson 7 лет назад
Родитель
Сommit
95f2e4c838

+ 5 - 1
src/router/routes.js

@@ -74,12 +74,16 @@ export default [
       },
       {
         path: "code",
-        component: () => import("@/views/teacher/Code")
+        component: () => import("@/views/teacher/Code/index")
       },
       {
         path: "code/detail",
         component: () => import("@/views/teacher/Code/detail")
       },
+      {
+        path: "code/detail/test",
+        component: () => import("@/views/teacher/Code/test")
+      },
 
       {
         path: "document",

+ 69 - 56
src/views/teacher/Code/detail.vue

@@ -29,25 +29,10 @@
           </b-field>
         </div>
 
-        <div class="submit-state">
-          提交情况:<progress
-            class="process-bar progress is-link"
-            value="30"
-            max="100"
-          ></progress>
-          13/52
-        </div>
-
         <b-tabs>
           <b-tab-item label="已提交">
             <div class="submitted-list">
-              <b-table
-                :data="data"
-                paginated
-                per-page="5"
-                detailed
-                detail-key="id"
-              >
+              <b-table :data="showResult" paginated per-page="5">
                 <template slot-scope="props">
                   <b-table-column
                     field="id"
@@ -59,37 +44,31 @@
                   >
                     {{ props.row.id }}
                   </b-table-column>
-
-                  <b-table-column label="所处阶段" centered>
-                    {{ props.row.stage }}
-                  </b-table-column>
-
                   <b-table-column label="构建" centered>
-                    <span class="tag is-success">{{ props.row.build }}</span>
+                    <span :class="props.row.buildTag">{{
+                      props.row.buildStatus
+                    }}</span>
                   </b-table-column>
 
                   <b-table-column label="部署" centered>
-                    <span class="tag is-warning">{{ props.row.deploy }}</span>
+                    <span :class="props.row.deployTag">{{
+                      props.row.deployStatus
+                    }}</span>
                   </b-table-column>
                   <b-table-column label="测试">
-                    <span class="tag is-danger">{{ props.row.test }}</span>
+                    <span :class="props.row.testTag">{{
+                      props.row.testStatus
+                    }}</span>
+                  </b-table-column>
+                  <b-table-column label="详情">
+                    <router-link
+                      :to="{
+                        path: `/course-teacher/:courseId/code/detail/test`,
+                        query: { assignmentInfo: props.row }
+                      }"
+                      >查看详情</router-link
+                    >
                   </b-table-column>
-                </template>
-
-                <template slot="detail">
-                  <article class="media">
-                    <div class="media-content">
-                      <div class="content">
-                        <p>
-                          <strong>成绩详情</strong>
-                          <small
-                            >这里可以放具体的作业成绩,前面可以放总评啥的</small
-                          >
-                          <br />
-                        </p>
-                      </div>
-                    </div>
-                  </article>
                 </template>
               </b-table>
             </div>
@@ -133,7 +112,6 @@ const unsubmited = {
     {
       field: "id",
       label: "小组ID",
-      // width: "80",
       numeric: true,
       centered: true
     },
@@ -147,29 +125,36 @@ const unsubmited = {
     }
   ]
 };
-const data = [
+const info = [
   {
     id: 1,
     stage: "测试",
-    build: "SUCCESS",
-    deploy: "SUCCESS",
-    test: "10/10"
+    build: 0,
+    deploy: 0,
+    test: -1,
+    pass: 0,
+    testNum: 10
   },
   {
     id: 2,
     stage: "测试",
-    build: "SUCCESS",
-    deploy: "SUCCESS",
-    test: "10/10"
+    build: 1,
+    deploy: 1,
+    test: 0,
+    pass: 0,
+    testNum: 10
   },
   {
-    id: 2,
+    id: 3,
     stage: "测试",
-    build: "SUCCESS",
-    deploy: "SUCCESS",
-    test: "10/10"
+    build: 1,
+    deploy: 1,
+    test: 1,
+    pass: 10,
+    testNum: 10
   }
 ];
+const showResult = [];
 const assignmentInfo = {
   id: 0,
   name: "",
@@ -178,6 +163,18 @@ const assignmentInfo = {
   endAt: 0
 };
 
+const tag = {
+  success: "tag is-success",
+  failed: "tag is-danger",
+  blank: "tag is-dark"
+};
+
+const status = {
+  success: "SUCCESS",
+  failed: "FAILED",
+  blank: "BLANK"
+};
+
 export default {
   components: {
     PageBody,
@@ -185,14 +182,30 @@ export default {
   },
   mounted() {
     this.assignmentInfo = this.$route.query.assignmentInfo;
-    console.log(this.assignmentInfo.name);
-    console.log(this.assignmentInfo.description);
+    for (var item of info) {
+      showResult.push({
+        id: item.id,
+        buildStatus: item.build === 1 ? status.success : status.failed,
+        buildTag: item.build === 1 ? tag.success : tag.failed,
+        deployStatus: item.deploy === 1 ? status.success : status.failed,
+        deployTag: item.deploy === 1 ? tag.success : tag.failed,
+        testStatus: item.test === 1 ? status.success : status.failed,
+        testTag: item.test === 1 ? tag.success : tag.failed
+      });
+    }
   },
   data() {
     return {
-      data,
+      info,
       unsubmited,
-      assignmentInfo
+      assignmentInfo,
+      tag,
+      status,
+      showResult,
+      submitCount: {
+        yes: 19,
+        no: 8
+      }
     };
   }
 };

+ 114 - 0
src/views/teacher/Code/test.vue

@@ -0,0 +1,114 @@
+<template>
+  <div>
+    <page-header
+      :routes="[
+        { name: '代码作业', path: 'code' },
+        { name: '购物车web项目', path: 'code/detail' },
+        { name: '测试信息', path: 'code/detail/test' }
+      ]"
+    >
+      <template slot="title">
+        测试信息
+      </template>
+      <template slot="content">
+        可查看最近五条测试数据
+      </template>
+    </page-header>
+
+    <page-body>
+      <b-collapse
+        :open="false"
+        class="collapseeeeeee"
+        v-for="item in testResult"
+        :key="item.id"
+      >
+        <button class="button is-primary " slot="trigger">
+          测试时间:2019-1-18 23:02{{ item.id }}
+        </button>
+        <div class="notification card">
+          <div class="content">
+            <h3>Build Info</h3>
+            <p>{{ item.buildResult }}</p>
+            <h3>Deploy Info</h3>
+            <p>{{ item.deployResult }}</p>
+            <h3>Unit Test Info</h3>
+            <p>{{ item.unitTestResult }}</p>
+            <h3>Functional Test Info</h3>
+            <p>{{ item.functionTestResult }}</p>
+          </div>
+        </div>
+      </b-collapse>
+    </page-body>
+  </div>
+</template>
+
+<script>
+import PageHeader from "@/components/PageHeader";
+import PageBody from "@/components/PageBody/index";
+
+const testResult = [
+  {
+    id: "1547130528000",
+    buildResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    deployResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    unitTestResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    functionTestResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS"
+  },
+  {
+    id: "1547130722000",
+    buildResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    deployResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    unitTestResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    functionTestResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS"
+  },
+  {
+    id: "1547123230722000",
+    buildResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    deployResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    unitTestResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    functionTestResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS"
+  },
+  {
+    id: "154712320722000",
+    buildResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    deployResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    unitTestResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    functionTestResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS"
+  },
+  {
+    id: "1547130434722000",
+    buildResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    deployResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    unitTestResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS",
+    functionTestResult: "SUCCESSSUCCESSSUCCESSSUCCESSSUCCESSSUCCESS"
+  }
+];
+const showResult = [];
+
+export default {
+  components: {
+    PageBody,
+    PageHeader
+  },
+  mounted() {
+    this.assignmentInfo = this.$route.query.assignmentInfo;
+  },
+  data() {
+    return {
+      assignmentInfo: {},
+      showResult,
+      testResult
+    };
+  }
+};
+</script>
+
+<style scoped>
+.breadcrumb a {
+  /*color: #7957d5;*/
+  font-weight: bold;
+}
+.collapseeeeeee {
+  margin-bottom: 10px;
+}
+</style>

+ 1 - 15
src/views/teacher/Document/detail.vue

@@ -29,15 +29,6 @@
           </b-field>
         </div>
 
-        <div class="submit-state">
-          提交情况:<progress
-            class="process-bar progress is-link"
-            value="30"
-            max="100"
-          ></progress>
-          13/52
-        </div>
-
         <b-tabs>
           <b-tab-item label="已提交">
             <div class="submitted-list">
@@ -71,12 +62,7 @@
                   <b-table-column label="分数" centered>
                     {{ props.row.score }}
                   </b-table-column>
-                  <b-table-column
-                    field="difficulty"
-                    label="详情"
-                    sortable
-                    centered
-                  >
+                  <b-table-column field="difficulty" label="详情" centered>
                     {{ props.row.detail }}
                   </b-table-column>
                 </template>