Bläddra i källkod

新增老师查看代码作业详情页面

Johnson 7 år sedan
förälder
incheckning
75c7d2aee0

+ 2 - 2
mock/serializers/assignment/DocumentResultSerializer.js

@@ -23,7 +23,7 @@ module.exports = () => {
     group: groupSerializer(),
     state: "互评中",
     result: "A",
-    url: "https://github.com",
-    reviewGroup: [1, 2, 3]
+    url: "https://github.com"
+    // reviewGroup: [1, 2, 3] 不显示,防止学生之间讨论
   };
 };

+ 24 - 2
src/api/question.js

@@ -30,13 +30,35 @@ export const getQuestionByQuesType = ({ type, page, limit }) => {
     }&limit=${limit || 10}`
   );
 };
+
+/**
+ * 根据关键字进行查找
+ * @param {string} keyword
+ * @param {string} type
+ * @returns {Promise<{data:QuestionSerializer[]}>}
+ */
+export const getTeacherKeywordQuestionsByCode = (
+  keyword = "123",
+  type = "CODE"
+) => {
+  return request(
+    `${QUESTION_MODULE}/teacher/keyword?keyword=${keyword}&type=${type}`
+  );
+};
+
 /**
  * 根据关键字进行查找
  * @param {string} keyword
+ * @param {string} type
  * @returns {Promise<{data:QuestionSerializer[]}>}
  */
-export const getTeacherKeywordQuestions = (keyword = "123") => {
-  return request(`${QUESTION_MODULE}/teacher/keyword?keyword=${keyword}`);
+export const getTeacherKeywordQuestionsByDoc = (
+  keyword = "123",
+  type = "DOCUMENT"
+) => {
+  return request(
+    `${QUESTION_MODULE}/teacher/keyword?keyword=${keyword}&type=${type}`
+  );
 };
 
 /**

+ 9 - 2
src/components/AssignmentCRUD/CreateAssignment/index.vue

@@ -165,7 +165,8 @@
 </template>
 
 <script>
-import { getTeacherKeywordQuestions } from "@/api/question";
+import { getTeacherKeywordQuestionsByCode } from "@/api/question";
+import { getTeacherKeywordQuestionsByDoc } from "@/api/question";
 import { postDocAssignment } from "@/api/assignment";
 import { postCodeAssignment } from "@/api/assignment";
 import timeMixins from "@/mixins/time";
@@ -250,7 +251,13 @@ export default {
         this.loadingSearchQuestions = true;
         this.submitting = true;
         try {
-          getTeacherKeywordQuestions(content).then(res => {
+          let questionPromise = null;
+          if (this.assignType === 1) {
+            questionPromise = getTeacherKeywordQuestionsByDoc(content);
+          } else {
+            questionPromise = getTeacherKeywordQuestionsByCode(content);
+          }
+          questionPromise.then(res => {
             this.questions = res.data;
             this.isSearchModalActive = false;
             this.loadingSearchQuestions = false;

+ 29 - 2
src/router/routes.js

@@ -85,8 +85,35 @@ export default [
         component: () => import("@/views/teacher/Code/detail")
       },
       {
-        path: "code/:codeId/test/:testId",
-        component: () => import("@/views/teacher/Code/test")
+        path: "code/:homeworkId/:projectId",
+        component: () => import("@/views/teacher/Code/test"),
+        children: [
+          {
+            path: "",
+            component: () =>
+              import("@/views/student/Code/ProjectDetail/BuildDetail")
+          },
+          {
+            path: "deploy",
+            component: () =>
+              import("@/views/student/Code/ProjectDetail/DeployDetail")
+          },
+          {
+            path: "test",
+            component: () =>
+              import("@/views/student/Code/ProjectDetail/TestDetail")
+          }
+        ]
+      },
+      {
+        path: "code/:homeworkId/:projectId/test/unit/:unitTestId",
+        component: () =>
+          import("@/views/student/Code/ProjectDetail/Test/UnitTestDetail")
+      },
+      {
+        path: "code/:homeworkId/:projectId/test/functional/:functionalTestId",
+        component: () =>
+          import("@/views/student/Code/ProjectDetail/Test/FunctionalTestDetail")
       },
 
       {

+ 1 - 1
src/views/teacher/Code/detail.vue

@@ -89,7 +89,7 @@
                 <b-table-column label="详情" centered>
                   <router-link
                     :to="{
-                      path: `${$route.path}/test/${props.row.id}`
+                      path: `${$route.path}/${props.row.id}`
                     }"
                     >查看详情</router-link
                   >

+ 45 - 15
src/views/teacher/Code/test.vue

@@ -6,22 +6,44 @@
         { name: '作业详情', path: `code/${$route.params.codeId}` },
         { name: '测试信息', path: `${$route.path}` }
       ]"
+      :tab-list="[
+        {
+          name: '构建',
+          path: `code/${$route.params.homeworkId}/${$route.params.projectId}`
+        },
+        {
+          name: '部署',
+          path: `code/${$route.params.homeworkId}/${
+            $route.params.projectId
+          }/deploy`
+        },
+        {
+          name: '测试',
+          path: `code/${$route.params.homeworkId}/${
+            $route.params.projectId
+          }/test`
+        }
+      ]"
     >
       <template slot="title">
-        测试信息
+        测试信息: {{ projectDetail.name }}
       </template>
       <template slot="content">
-        可查看最近五条测试数据
+        <strong>git 地址 : </strong>
+        <a :href="projectDetail.url">{{ projectDetail.url }}</a>
       </template>
     </page-header>
-
     <page-body>
-      <div class="data-table">和学生代码作业的测试信息的显示格式和接口相同</div>
+      <router-view
+        :project-detail="projectDetail"
+        :detail-loading="detailLoading"
+      />
     </page-body>
   </div>
 </template>
 
 <script>
+import { getProjectDetail } from "@/api/codehw";
 import PageHeader from "@/components/PageHeader";
 import PageBody from "@/components/PageBody/index";
 
@@ -30,22 +52,30 @@ export default {
     PageBody,
     PageHeader
   },
-  mounted() {
-    const { testId } = this.$route.params;
-    console.log(testId);
-  },
   data() {
-    return {};
+    return {
+      projectDetail: {},
+      detailLoading: false
+    };
+  },
+  async mounted() {
+    // console.log(
+    //   "code/" +
+    //     this.$route.params.homeworkId +
+    //     "/" +
+    //     this.$route.params.projectId
+    // );
+    const { projectId } = this.$route.params;
+    this.detailLoading = true;
+    const detail = await getProjectDetail(projectId);
+    this.projectDetail = detail.data;
+    this.detailLoading = false;
   }
 };
 </script>
 
 <style scoped>
-.breadcrumb a {
-  /*color: #7957d5;*/
-  font-weight: bold;
-}
-.collapseeeeeee {
-  margin-bottom: 10px;
+.top-nav-section {
+  padding: 0 40px;
 }
 </style>

+ 3 - 2
vue.config.js

@@ -2,8 +2,9 @@ module.exports = {
   devServer: {
     proxy: {
       "^/api": {
-        target: "http://localhost:4000/",
-        // target: "http://10.1.1.198:8080/",
+        // target: "http://localhost:4000/",
+        target: "http://10.1.1.198:8080/",
+        // target: "http://10.1.2.3:8080/",
 
         ws: true,
         changeOrigin: true