Johnson 7 лет назад
Родитель
Сommit
2067bac26c

+ 4 - 4
src/api/assignment.js

@@ -64,8 +64,8 @@ export const delCodeAssignment = () => {
  * 老师查看代码作业列表
  * @returns {Promise<{data:CodeSerializerType[]}>}
  */
-export const getCodeAssignmentListByTeacher = () => {
-  return request(`${ASSIGNMENT_MODULE}/teacher/course/:courseId/code`);
+export const getCodeAssignmentListByTeacher = (courseId = 123) => {
+  return request(`${ASSIGNMENT_MODULE}/teacher/course/${courseId}/code`);
 };
 
 /**
@@ -193,7 +193,7 @@ export const delDocAssignment = () => {
  * 老师查看文档作业列表
  * @returns {Promise<{data:DocumentSerializerType[]}>}
  */
-export const getDocAssignmentListByTeacher = (courseId = 123) => {
+export const getDocAssignmentListTeacherByCrs = (courseId = 123) => {
   return request(`${ASSIGNMENT_MODULE}/teacher/course/${courseId}/document`);
 };
 
@@ -225,7 +225,7 @@ export const getDocResultById = (documentId = 123) => {
  * 老师查看文档作业的成绩列表(已提交小组)
  * @returns {Promise<{data:DocumentResultSerializerType}>}
  */
-export const getDocResultListByDocId = (documentId = 123) => {
+export const getSubmittedDocResultListByDocId = (documentId = 123) => {
   return request(
     `${ASSIGNMENT_MODULE}/teacher/document/${documentId}/submitted/result`
   );

+ 121 - 155
src/views/teacher/Code/detail.vue

@@ -30,60 +30,88 @@
         </div>
         <!---->
         <b-tabs type="is-boxed">
-          <b-tab-item>
-            <template slot="header">
-              <span> {{ submitInfo.yes }} </span>
-            </template>
-            <div class="submitted-list">
-              <b-table :data="showResult" paginated per-page="5">
-                <template slot-scope="props">
-                  <b-table-column
-                    field="id"
-                    label="小组ID"
-                    width="120"
-                    numeric
-                    sortable
-                    centered
-                  >
-                    {{ props.row.id }}
-                  </b-table-column>
-                  <b-table-column label="构建" centered>
-                    <span :class="props.row.buildTag">{{
-                      props.row.buildStatus
-                    }}</span>
-                  </b-table-column>
+          <b-tab-item label="已提交">
+            <b-table :data="codeProcedureList" paginated per-page="5">
+              <template slot-scope="props">
+                <b-table-column
+                  field="id"
+                  label="小组ID"
+                  width="120"
+                  numeric
+                  sortable
+                  centered
+                >
+                  {{ props.row.group.id }}
+                </b-table-column>
+                <b-table-column label="构建" centered>
+                  <span :class="geneTitleAndTag(props.row.buildStatus.key).tag">
+                    {{ geneTitleAndTag(props.row.buildStatus.key).title }}
+                  </span>
+                </b-table-column>
 
-                  <b-table-column label="部署" centered>
-                    <span :class="props.row.deployTag">{{
-                      props.row.deployStatus
-                    }}</span>
-                  </b-table-column>
-                  <b-table-column label="测试">
-                    <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>
-              </b-table>
-            </div>
+                <b-table-column label="部署" centered>
+                  <span
+                    :class="geneTitleAndTag(props.row.deployStatus.key).tag"
+                  >
+                    {{ geneTitleAndTag(props.row.deployStatus.key).title }}
+                  </span>
+                </b-table-column>
+                <b-table-column label="单元测试">
+                  <span
+                    :class="geneTitleAndTag(props.row.unitTestStatus.key).tag"
+                  >
+                    {{ props.row.unitTestStatus.passCount }}/{{
+                      props.row.unitTestStatus.testCount
+                    }}
+                  </span>
+                </b-table-column>
+                <b-table-column label="功能测试">
+                  <span
+                    :class="
+                      geneTitleAndTag(props.row.functionTestStatus.key).tag
+                    "
+                  >
+                    {{ props.row.functionTestStatus.passCount }}/{{
+                      props.row.functionTestStatus.testCount
+                    }}
+                  </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>
+            </b-table>
           </b-tab-item>
-          <b-tab-item>
-            <template slot="header">
-              <span> {{ submitInfo.no }} </span>
-            </template>
-            <b-table
-              :data="unsubmited.data"
-              :columns="unsubmited.columns"
-            ></b-table>
+
+          <b-tab-item :label="submitInfo.no">
+            <b-table :data="unsubmitedGroups" paginated per-page="5">
+              <template slot-scope="props">
+                <b-table-column
+                  field="id"
+                  label="小组ID"
+                  width="120"
+                  numeric
+                  sortable
+                  centered
+                >
+                  {{ props.row.id }}
+                </b-table-column>
+                <b-table-column label="小组名称" centered>
+                  {{ props.row.name }}
+                </b-table-column>
+                <b-table-column label="小组成员" centered>
+                  <span v-for="member in props.row.members" :key="member.id"
+                    >{{ member.username }}&emsp;</span
+                  >
+                </b-table-column>
+              </template>
+            </b-table>
           </b-tab-item>
         </b-tabs>
       </div>
@@ -94,71 +122,9 @@
 <script>
 import PageHeader from "@/components/PageHeader";
 import PageBody from "@/components/PageBody/index";
+import { getCodeProcedureListByCodeId } from "@/api/assignment";
+import { getUnsubmittedCodeGroupsList } from "@/api/assignment";
 
-const unsubmited = {
-  data: [
-    {
-      id: 1,
-      PM: "Jesse",
-      members: "Simmons\tClarence\tTina\tJohn"
-    },
-    {
-      id: 2,
-      PM: "Jesse",
-      members: "Simmons Clarence Tina John"
-    },
-    {
-      id: 3,
-      PM: "Jesse",
-      members: "Simmons Clarence Tina John"
-    }
-  ],
-  columns: [
-    {
-      field: "id",
-      label: "小组ID",
-      numeric: true,
-      centered: true
-    },
-    {
-      field: "PM",
-      label: "组长"
-    },
-    {
-      field: "members",
-      label: "组员"
-    }
-  ]
-};
-const info = [
-  {
-    id: 1,
-    PM: "Jesse",
-    members: "Simmons\tClarence\tTina\tJohn",
-    build: 0,
-    deploy: 0,
-    test: -1,
-    pass: 0,
-    testNum: 10
-  },
-  {
-    id: 2,
-    build: 1,
-    deploy: 1,
-    test: 0,
-    pass: 0,
-    testNum: 10
-  },
-  {
-    id: 3,
-    build: 1,
-    deploy: 1,
-    test: 1,
-    pass: 10,
-    testNum: 10
-  }
-];
-const showResult = [];
 const assignmentInfo = {
   id: 0,
   name: "",
@@ -170,23 +136,13 @@ const assignmentInfo = {
 const tag = {
   success: "tag is-success",
   failed: "tag is-danger",
-  blank: "tag is-dark"
+  uncommitted: "tag is-dark"
 };
 
 const status = {
-  pending: "PENDING",
+  uncommitted: "UNCOMMITTED",
   success: "SUCCESS",
-  failed: "FAILED",
-  blank: "BLANK"
-};
-
-const submitCount = {
-  yes: 19,
-  no: 8
-};
-const submitInfo = {
-  yes: "已提交:" + submitCount.yes,
-  no: "未提交:" + submitCount.no
+  failed: "FAILED"
 };
 
 export default {
@@ -194,30 +150,49 @@ export default {
     PageBody,
     PageHeader
   },
-  mounted() {
+  async mounted() {
     this.assignmentInfo = this.$route.query.assignmentInfo;
-    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
-      });
-    }
+    getCodeProcedureListByCodeId(123).then(res => {
+      this.codeProcedureList = res.data;
+      this.submitInfo.yes = "已提交:" + this.codeProcedureList.length;
+    });
+    getUnsubmittedCodeGroupsList(123).then(res => {
+      this.unsubmitedGroups = res.data;
+      this.submitInfo.no = "未提交:" + this.unsubmitedGroups.length;
+    });
   },
   data() {
     return {
-      info,
-      unsubmited,
+      codeProcedureList: [],
+      unsubmitedGroups: [],
+      showResult: [],
       assignmentInfo,
       tag,
       status,
-      showResult,
-      submitInfo
+      submitInfo: {
+        yes: "",
+        no: ""
+      }
     };
+  },
+  methods: {
+    geneTitleAndTag(state) {
+      let data = {
+        title: "",
+        tag: ""
+      };
+      if (state === 2) {
+        data.title = status.failed;
+        data.tag = tag.failed;
+      } else if (state === 0) {
+        data.title = status.uncommitted;
+        data.tag = tag.uncommitted;
+      } else {
+        data.title = status.success;
+        data.tag = tag.success;
+      }
+      return data;
+    }
   }
 };
 </script>
@@ -233,19 +208,10 @@ export default {
   min-height: 80vh;
   background-color: #ffffff;
 }
-.submitted-list {
-  /*margin-top: 30px;*/
-}
+
 .form-group {
   display: flex;
   justify-content: space-between;
   margin-bottom: 1.5rem;
 }
-
-.submit-state {
-  display: flex;
-  margin-top: 20px;
-  align-items: center;
-  margin-bottom: 20px;
-}
 </style>

+ 41 - 32
src/views/teacher/Code/index.vue

@@ -23,11 +23,11 @@
           detail-key="id"
         >
           <template slot-scope="props">
-            <b-table-column field="id" label="题目ID" numeric sortable centered>
+            <b-table-column field="id" label="作业ID" numeric sortable centered>
               {{ props.row.id }}
             </b-table-column>
 
-            <b-table-column label="题目名称" centered>
+            <b-table-column label="作业名称" centered>
               <router-link
                 :to="{
                   path: `/course-teacher/:courseId/code/detail`,
@@ -37,17 +37,20 @@
                 {{ props.row.name }}
               </router-link>
             </b-table-column>
+            <b-table-column label="作业状态" centered>
+              {{ props.row.status }}
+            </b-table-column>
 
             <b-table-column label="开始时间" centered>
-              {{ new Date(props.row.startAt).getFullYear() }}-{{
-                new Date(props.row.startAt).getMonth() + 1
-              }}-{{ new Date(props.row.startAt).getDate() }}
+              {{ new Date(props.row.startAt * 1000).getFullYear() }}-{{
+                new Date(props.row.startAt * 1000).getMonth() + 1
+              }}-{{ new Date(props.row.startAt * 1000).getDate() }}
             </b-table-column>
 
             <b-table-column label="结束时间" centered>
-              {{ new Date(props.row.endAt).getFullYear() }}-{{
-                new Date(props.row.endAt).getMonth() + 1
-              }}-{{ new Date(props.row.endAt).getDate() }}
+              {{ new Date(props.row.endAt * 1000).getFullYear() }}-{{
+                new Date(props.row.endAt * 1000).getMonth() + 1
+              }}-{{ new Date(props.row.endAt * 1000).getDate() }}
             </b-table-column>
 
             <b-table-column label="修改" centered>
@@ -115,37 +118,43 @@
 <script>
 import PageHeader from "@/components/PageHeader";
 import PageBody from "@/components/PageBody/index";
-const codeData = [
-  {
-    id: 1,
-    name: "购物车web项目",
-    description: "1111111111111这里是文档描述",
-    startAt: 1547107174000,
-    endAt: 1547971174000
-  },
-  {
-    id: 2,
-    name: "电影票web项目",
-    description: "222222222222这里是文档描述",
-    startAt: 1547107174000,
-    endAt: 1547971174000
-  },
-  {
-    id: 3,
-    name: "SEECweb项目",
-    description: "3333333333333333这里是文档描述",
-    startAt: 1547107174000,
-    endAt: 1547971174000
-  }
-];
+import { getCodeAssignmentListByTeacher } from "@/api/assignment";
+// const codeData = [
+//   {
+//     id: 1,
+//     name: "购物车web项目",
+//     description: "1111111111111这里是文档描述",
+//     startAt: 1547107174000,
+//     endAt: 1547971174000
+//   },
+//   {
+//     id: 2,
+//     name: "电影票web项目",
+//     description: "222222222222这里是文档描述",
+//     startAt: 1547107174000,
+//     endAt: 1547971174000
+//   },
+//   {
+//     id: 3,
+//     name: "SEECweb项目",
+//     description: "3333333333333333这里是文档描述",
+//     startAt: 1547107174000,
+//     endAt: 1547971174000
+//   }
+// ];
 export default {
   components: {
     PageBody,
     PageHeader
   },
+  mounted() {
+    getCodeAssignmentListByTeacher(123).then(res => {
+      this.codeData = res.data;
+    });
+  },
   data() {
     return {
-      codeData,
+      codeData: [],
       codeAssignment: {
         id: -1,
         name: "",

+ 99 - 164
src/views/teacher/Document/detail.vue

@@ -3,14 +3,15 @@
     <page-header
       :routes="[
         { name: '文档作业', path: 'document' },
-        { name: `${assignmentInfo.name}`, path: 'document/detail' }
+        { name: `${title}`, path: 'document/detail' }
       ]"
     >
       <template slot="title">
         {{ assignmentInfo.name }}
       </template>
       <template slot="content">
-        作业进行阶段:{{ status }}
+        题目描述:{{ assignmentInfo.description }} <br />
+        题目进行阶段:{{ status }}
       </template>
     </page-header>
 
@@ -31,63 +32,87 @@
 
         <b-tabs>
           <b-tab-item :label="submitInfo.yes">
-            <div class="submitted-list">
-              <b-table
-                :data="data"
-                paginated
-                per-page="5"
-                detailed
-                detail-key="id"
-              >
-                <template slot-scope="props">
-                  <b-table-column
-                    field="id"
-                    label="小组ID"
-                    width="120"
-                    numeric
-                    sortable
-                    centered
-                  >
-                    {{ props.row.id }}
-                  </b-table-column>
+            <b-table
+              :data="submittedData"
+              paginated
+              per-page="5"
+              detailed
+              detail-key="id"
+            >
+              <template slot-scope="props">
+                <b-table-column
+                  field="id"
+                  label="小组ID"
+                  width="120"
+                  numeric
+                  sortable
+                  centered
+                >
+                  {{ props.row.group ? props.row.group.id : "" }}
+                </b-table-column>
+                <b-table-column label="小组名称" centered>
+                  {{ props.row.group ? props.row.group.name : "" }}
+                </b-table-column>
 
-                  <b-table-column label="互评负责组" centered>
-                    {{ props.row.charge }}
-                  </b-table-column>
+                <b-table-column label="互评负责组" centered>
+                  <span v-for="groupId in props.row.reviewGroup" :key="groupId"
+                    >{{ groupId }}&emsp;</span
+                  >
+                </b-table-column>
 
-                  <b-table-column label="分数" centered>
-                    {{ props.row.score }}
-                  </b-table-column>
-                  <b-table-column field="difficulty" label="详情" centered
-                    ><a :href="props.row.url" target="_blank"
-                      >查看详情-加提示框</a
-                    >
-                  </b-table-column>
-                </template>
+                <b-table-column label="分数" centered>
+                  {{ props.row.result }}
+                </b-table-column>
+                <b-table-column field="difficulty" label="详情" centered
+                  ><a :href="props.row.url" target="_blank"
+                    >查看详情-加提示框</a
+                  >
+                </b-table-column>
+              </template>
 
-                <template slot="detail">
-                  <article class="media">
-                    <div class="media-content">
-                      <div class="content">
-                        <p>
-                          <strong>小组成员:</strong
-                          ><small>小明&emsp;小黄&emsp;小兰</small> <br />
-                          <strong>git地址:</strong
-                          ><small>https://www.github.com</small> <br />
-                        </p>
-                      </div>
+              <template slot="detail" slot-scope="props">
+                <article class="media">
+                  <div class="media-content">
+                    <div class="content">
+                      <p>
+                        <strong>小组成员:</strong
+                        ><small>{{
+                          props.row.group ? props.row.group.members : ""
+                        }}</small>
+                        <br />
+                        <strong>git地址:</strong
+                        ><small>{{ props.row.url }}</small> <br />
+                      </p>
                     </div>
-                  </article>
-                </template>
-              </b-table>
-            </div>
+                  </div>
+                </article>
+              </template>
+            </b-table>
           </b-tab-item>
 
           <b-tab-item :label="submitInfo.no">
-            <b-table
-              :data="unsubmited.data"
-              :columns="unsubmited.columns"
-            ></b-table>
+            <b-table :data="unsubmitedGroups" paginated per-page="5">
+              <template slot-scope="props">
+                <b-table-column
+                  field="id"
+                  label="小组ID"
+                  width="120"
+                  numeric
+                  sortable
+                  centered
+                >
+                  {{ props.row.id }}
+                </b-table-column>
+                <b-table-column label="小组名称" centered>
+                  {{ props.row.name }}
+                </b-table-column>
+                <b-table-column label="小组成员" centered>
+                  <span v-for="member in props.row.members" :key="member.id"
+                    >{{ member.username }}&emsp;</span
+                  >
+                </b-table-column>
+              </template>
+            </b-table>
           </b-tab-item>
         </b-tabs>
       </div>
@@ -98,88 +123,13 @@
 <script>
 import PageHeader from "@/components/PageHeader";
 import PageBody from "@/components/PageBody/index";
-
-const unsubmited = {
-  data: [
-    {
-      id: 1,
-      PM: "Jesse",
-      members: "Simmons\tClarence\tTina\tJohn"
-    },
-    {
-      id: 2,
-      PM: "Jesse",
-      members: "Simmons Clarence Tina John"
-    },
-    {
-      id: 3,
-      PM: "Jesse",
-      members: "Simmons Clarence Tina John"
-    }
-  ],
-  columns: [
-    {
-      field: "id",
-      label: "小组ID",
-      // width: "80",
-      numeric: true,
-      centered: true
-    },
-    {
-      field: "PM",
-      label: "组长"
-    },
-    {
-      field: "members",
-      label: "组员"
-    }
-  ]
-};
-const submitCount = {
-  yes: 19,
-  no: 8
-};
-const submitInfo = {
-  yes: "已提交:" + submitCount.yes,
-  no: "未提交:" + submitCount.no
-};
-const data = [
-  {
-    id: 1,
-    charge: "2,3,4,5",
-    score: "暂无",
-    detail: "查看详情-直接跳转至git地址",
-    url: "https://github.com/"
-  },
-  {
-    id: 2,
-    charge: "1,3,5",
-    score: "暂无",
-    detail: "查看详情",
-    url: "https://github.com/"
-  },
-  {
-    id: 3,
-    charge: "1,3,5",
-    score: "C",
-    detail: "查看详情",
-    url: "https://github.com/"
-  },
-  {
-    id: 4,
-    charge: "1,3,5",
-    score: "D",
-    detail: "查看详情",
-    url: "https://github.com/"
-  }
-];
+import { getSubmittedDocResultListByDocId } from "@/api/assignment";
+import { getUnsubmittedDocGroupsByDocId } from "@/api/assignment";
 
 const assignmentInfo = {
   id: 0,
   name: "",
-  description: "",
-  startAt: 0,
-  endAt: 0
+  description: ""
 };
 
 export default {
@@ -189,22 +139,29 @@ export default {
   },
   mounted() {
     this.assignmentInfo = this.$route.query.assignmentInfo;
-    console.log(this.assignmentInfo.name);
-    console.log(this.assignmentInfo.description);
+    this.title = this.$route.query.title;
+    getSubmittedDocResultListByDocId(123).then(res => {
+      this.status = res.status;
+      this.submittedData = res.data;
+      this.submitInfo.yes = "已提交:" + this.submittedData.length;
+    });
+    getUnsubmittedDocGroupsByDocId(123).then(res => {
+      this.unsubmitedGroups = res.data;
+      this.submitInfo.no = "未提交:" + this.unsubmitedGroups.length;
+    });
   },
+
   data() {
     return {
-      status: "正在互评",
-      courses: [],
-      review: [],
-      questionType: [
-        { id: 1, title: "文档作业题目" },
-        { id: 2, title: "代码作业题目" }
-      ],
-      data,
-      unsubmited,
+      title: "",
+      submittedData: [],
+      unsubmitedGroups: [],
+      status: "",
       assignmentInfo,
-      submitInfo
+      submitInfo: {
+        yes: "",
+        no: ""
+      }
     };
   }
 };
@@ -221,30 +178,8 @@ export default {
   min-height: 80vh;
   background-color: #ffffff;
 }
-.submitted-list {
-  /*margin-top: 30px;*/
-}
 .form-group {
   display: flex;
   justify-content: space-between;
 }
-.description {
-  overflow: hidden;
-  text-overflow: ellipsis;
-  -webkit-box-orient: vertical;
-  -webkit-line-clamp: 1;
-  word-wrap: break-word;
-  word-break: break-all;
-  display: -webkit-box;
-}
-.process-bar {
-  width: 50%;
-  margin-right: 10px;
-}
-.submit-state {
-  display: flex;
-  margin-top: 20px;
-  align-items: center;
-  margin-bottom: 20px;
-}
 </style>

+ 23 - 28
src/views/teacher/Document/index.vue

@@ -16,22 +16,34 @@
 
     <page-body>
       <div class="data-table">
-        <b-table :data="data" paginated per-page="5" detailed detail-key="id">
+        <b-table
+          :data="docData"
+          paginated
+          per-page="5"
+          detailed
+          detail-key="id"
+        >
           <template slot-scope="props">
-            <b-table-column field="id" label="题目ID" numeric sortable centered>
+            <b-table-column field="id" label="ID" numeric sortable centered>
               {{ props.row.id }}
             </b-table-column>
 
-            <b-table-column label="题目名称" centered>
+            <b-table-column label="作业名称" centered>
               <router-link
                 :to="{
                   path: `/course-teacher/:courseId/document/detail`,
-                  query: { assignmentInfo: props.row }
+                  query: {
+                    assignmentInfo: props.row.problem,
+                    title: props.row.name
+                  }
                 }"
               >
                 {{ props.row.name }}
               </router-link>
             </b-table-column>
+            <b-table-column label="状态" centered>
+              {{ props.row.status }}
+            </b-table-column>
 
             <b-table-column label="开始时间" centered>
               {{ new Date(props.row.startAt).getFullYear() }}-{{
@@ -110,37 +122,20 @@
 import PageHeader from "@/components/PageHeader";
 import PageBody from "@/components/PageBody/index";
 import { required } from "vuelidate/lib/validators";
-const docData = [
-  {
-    id: 1,
-    name: "软件需求规格说明书",
-    description: "1111111111111这里是文档描述",
-    startAt: 1547107174000,
-    endAt: 1547971174000
-  },
-  {
-    id: 2,
-    name: "用户需求列表",
-    description: "222222222222222222这里是文档描述",
-    startAt: 1547107174000,
-    endAt: 1547971174000
-  },
-  {
-    id: 3,
-    name: "面谈报告",
-    description: "333333333333333这里是文档描述",
-    startAt: 1547107174000,
-    endAt: 1547971174000
-  }
-];
+import { getDocAssignmentListTeacherByCrs } from "@/api/assignment";
 export default {
   components: {
     PageBody,
     PageHeader
   },
+  mounted() {
+    getDocAssignmentListTeacherByCrs(123).then(res => {
+      this.docData = res.data;
+    });
+  },
   data() {
     return {
-      data: docData,
+      docData: [],
       docAssignment: {
         id: -1,
         name: "",