Pārlūkot izejas kodu

已提交和未提交的逻辑还没补全

Prevalence 7 gadi atpakaļ
vecāks
revīzija
e155de46d0

+ 26 - 0
src/api/dlwork.js

@@ -88,3 +88,29 @@ export const putDLAssignment = (
     }
   });
 };
+/**
+ * 老师查看某一个具体机器学习作业的信息
+ * @param dlworkId
+ * @returns {Promise<*>}
+ */
+export const getDLAssignmentById = dlworkId => {
+  return request(`${DL_WORK_MODULE}/teacher/dlwork/${dlworkId}`);
+};
+/**
+ * 老师查看单个机器学习作业下所有已经提交的组的信息
+ * @param dlworkId
+ * @returns {Promise<*>}
+ */
+export const getDLProcedureListById = dlworkId => {
+  return request(
+    `${DL_WORK_MODULE}/teacher/dlwork/${dlworkId}/submitted/procedure`
+  );
+};
+/**
+ * 老师查看未提交的人的信息
+ * @param dlworkId
+ * @returns {Promise<*>}
+ */
+export const getUnsubmittedList = dlworkId => {
+  return request(`${DL_WORK_MODULE}/teacher/dlwork/${dlworkId}/unsubmitted`);
+};

+ 4 - 0
src/router/routes.js

@@ -80,6 +80,10 @@ export default [
         path: "dlwork",
         component: () => import("@/views/teacher/DlWork/index")
       },
+      {
+        path: "dlwork/:dlworkId",
+        component: () => import("@/views/teacher/DlWork/detail")
+      },
       {
         path: "code",
         component: () => import("@/views/teacher/Code/index")

+ 213 - 0
src/views/teacher/DlWork/detail.vue

@@ -0,0 +1,213 @@
+<template>
+  <div>
+    <page-header
+      :loading="loadingCommittedGroups"
+      :routes="[
+        { name: '机器学习作业', path: 'dlwork' },
+        { name: '作业详情', path: `${$route.path}` }
+      ]"
+    >
+      <template slot="title">
+        {{ problemInfo.name }}
+      </template>
+      <template slot="content">
+        {{ problemInfo.description }}
+      </template>
+    </page-header>
+
+    <page-body>
+      <div class="data-table">
+        <b-tabs>
+          <b-tab-item :label="submitInfo.yes">
+            <page-section-loading :show="loadingCommittedGroups" />
+            <b-table
+              v-if="!loadingCommittedGroups"
+              :data="codeProcedureList"
+              detailed
+              detail-key="id"
+            >
+              <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="geneTag(props.row.buildStatus.key)">
+                    {{
+                      props.row.buildStatus.key === 0
+                        ? "未构建"
+                        : props.row.buildStatus.key === -1
+                        ? "失败"
+                        : "成功"
+                    }}
+                  </span>
+                </b-table-column>
+
+                <b-table-column label="部署" centered>
+                  <span :class="geneTag(props.row.deployStatus.key)">
+                    {{
+                      props.row.deployStatus.key === 0
+                        ? "未部署"
+                        : props.row.deployStatus.key === -1
+                        ? "失败"
+                        : "成功"
+                    }}
+                  </span>
+                </b-table-column>
+                <b-table-column label="准确率" centered>
+                  <span :class="geneTag(props.row.unitTestStatus.key)">
+                    {{
+                      props.row.unitTestStatus.key === 0
+                        ? "未测试"
+                        : props.row.unitTestStatus.key === -1
+                        ? "构建失败"
+                        : props.row.unitTestStatus.passCount +
+                          "/" +
+                          props.row.unitTestStatus.testCount
+                    }}
+                  </span>
+                </b-table-column>
+                <b-table-column label="详情" centered>
+                  <router-link
+                    :to="{
+                      path: `${$route.path}/${props.row.id}`
+                    }"
+                    >查看详情
+                  </router-link>
+                </b-table-column>
+              </template>
+            </b-table>
+          </b-tab-item>
+
+          <b-tab-item :label="submitInfo.no">
+            <page-section-loading :show="loadingUncommittedGroups" />
+            <b-table v-if="!loadingUncommittedGroups" :data="unsubmitedGroups">
+              <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>
+              </template>
+            </b-table>
+          </b-tab-item>
+        </b-tabs>
+      </div>
+    </page-body>
+  </div>
+</template>
+
+<script>
+import PageHeader from "@/components/PageHeader";
+import PageBody from "@/components/PageBody/index";
+import { getCodeProcedureListByCodeId } from "@/api/assignment";
+import { getUnsubmittedCodeGroupsList } from "@/api/assignment";
+import { getDLAssignmentById } from "@/api/dlwork";
+
+import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
+
+const tag = {
+  success: "tag is-success",
+  failed: "tag is-danger",
+  uncommitted: "tag is-dark"
+};
+
+const status = {
+  uncommitted: "UNCOMMITTED",
+  success: "SUCCESS",
+  failed: "FAILED"
+};
+
+export default {
+  components: {
+    PageBody,
+    PageHeader,
+    PageSectionLoading
+  },
+  mounted() {
+    const { codeId } = this.$route.params;
+    this.codeId = codeId;
+    this.loadingUncommittedGroups = true;
+    this.loadingCommittedGroups = true;
+    getDLAssignmentById(codeId).then(res => {
+      this.problemInfo = res.data.problem;
+    });
+    getCodeProcedureListByCodeId(codeId).then(res => {
+      this.codeProcedureList = res.data;
+      this.submitInfo.yes = "已提交:" + this.codeProcedureList.length;
+      this.loadingCommittedGroups = false;
+    });
+    getUnsubmittedCodeGroupsList(codeId).then(res => {
+      this.unsubmitedGroups = res.data;
+      this.submitInfo.no = "未提交:" + this.unsubmitedGroups.length;
+      this.loadingUncommittedGroups = false;
+    });
+  },
+  data() {
+    return {
+      codeId: null,
+      codeProcedureList: [],
+      unsubmitedGroups: [],
+      problemInfo: {
+        id: null,
+        name: null,
+        description: null
+      },
+      tag,
+      status,
+      submitInfo: {
+        yes: "已提交",
+        no: "未提交"
+      },
+      loadingCommittedGroups: false,
+      loadingUncommittedGroups: false
+    };
+  },
+  methods: {
+    geneTag(state) {
+      let showTag = "";
+      if (state === -1) {
+        showTag = tag.failed;
+      } else if (state === 0) {
+        showTag = tag.uncommitted;
+      } else {
+        showTag = tag.success;
+      }
+      return showTag;
+    }
+  }
+};
+</script>
+<style scoped>
+.breadcrumb a {
+  /*color: #7957d5;*/
+  font-weight: bold;
+}
+
+.data-table {
+  width: 100%;
+  padding: 30px;
+  min-height: 80vh;
+  background-color: #ffffff;
+}
+
+.form-group {
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 1.5rem;
+}
+</style>

+ 1 - 1
src/views/teacher/DlWork/index.vue

@@ -32,7 +32,7 @@
             <b-table-column label="作业名称" centered>
               <router-link
                 :to="{
-                  path: `code/${props.row.id}`
+                  path: `dlwork/${props.row.id}`
                 }"
               >
                 {{ props.row.name }}