Prevalence 7 vuotta sitten
vanhempi
commit
50fb82510c

+ 2 - 10
src/api/dlwork.js

@@ -53,18 +53,10 @@ export const getStudentDLProjectDetail = (dlworkId, userId) => {
  * @returns {Promise<*>}
  */
 export const postDLAssignment = (
-  {
-    type,
-    name,
-    dlType,
-    useGPU: numberOfGPU,
-    description,
-    startAt,
-    endAt,
-    problem
-  },
+  { type, name, dlType, numberOfGPU, description, startAt, endAt, problem },
   courseId
 ) => {
+  console.log("dlType is ", dlType);
   return request(`${DL_WORK_MODULE}/course/${courseId}/dlwork`, {
     method: "POST",
     body: {

+ 14 - 0
src/api/question.js

@@ -57,6 +57,20 @@ export const getTeacherKeywordQuestionsByCode = (
     `${QUESTION_MODULE}/teacher/keyword?keyword=${keyword}&type=${type}`
   );
 };
+/**
+ * 根据关键字及问题分类进行查找
+ * @param {string} keyword
+ * @param {string} type
+ * @returns {Promise<{data:QuestionSerializer[]}>}
+ */
+export const getTeacherKeywordQuestionsByDL = (
+  keyword = "123",
+  type = "ML"
+) => {
+  return request(
+    `${QUESTION_MODULE}/teacher/keyword?keyword=${keyword}&type=${type}`
+  );
+};
 
 /**
  * 根据关键字进行查找

+ 10 - 6
src/components/AssignmentCRUD/CreateAssignment/index.vue

@@ -31,23 +31,23 @@
           <div style="display: flex; margin-bottom: 0.5em">
             <b-radio
               name="dlType"
-              value="0"
-              v-model="$v.params.dlType"
+              native-value="0"
+              v-model="$v.params.dlType.$model"
               style="flex: 1"
             >
               Tensorflow
             </b-radio>
             <b-radio
               name="dlType"
-              value="1"
-              v-model="$v.params.dlType"
+              native-value="1"
+              v-model="$v.params.dlType.$model"
               style="flex: 1"
               >Pytorch
             </b-radio>
             <b-input
               type="number"
               placeholder="使用GPU数量"
-              v-model="$v.params.numberOfGPU"
+              v-model="$v.params.numberOfGPU.$model"
             ></b-input>
           </div>
 
@@ -201,6 +201,7 @@
 <script>
 import { getTeacherKeywordQuestionsByCode } from "@/api/question";
 import { getTeacherKeywordQuestionsByDoc } from "@/api/question";
+import { getTeacherKeywordQuestionsByDL } from "@/api/question";
 import { postDocAssignment } from "@/api/assignment";
 import { postCodeAssignment } from "@/api/assignment";
 import { postDLAssignment } from "@/api/dlwork";
@@ -299,8 +300,10 @@ export default {
           let questionPromise = null;
           if (this.assignType === 1) {
             questionPromise = getTeacherKeywordQuestionsByDoc(content);
-          } else {
+          } else if (this.assignType === 0) {
             questionPromise = getTeacherKeywordQuestionsByCode(content);
+          } else {
+            questionPromise = getTeacherKeywordQuestionsByDL(content);
           }
           questionPromise.then(res => {
             this.questions = res.data;
@@ -350,6 +353,7 @@ export default {
           startAt: parseInt(this.params.startAt),
           endAt: parseInt(this.params.endAt)
         };
+        console.log("In CreateAssignment the dlType is ", this.params.dlType);
         if (this.assignType === 1) {
           // 文档作业
           this.myPromise = postDocAssignment(param, this.courseId);

+ 1 - 4
src/views/student/DlWork/detail.vue

@@ -28,9 +28,7 @@
         <a :href="dlTestDetail.url">{{ dlTestDetail.url }}</a>
       </template>
       <template slot="content">
-        <strong
-          ><br /><br />当前构建成功率 :{{ dlTestDetail.rateofsuccess }}</strong
-        >
+        <strong><br /><br />当前构建成功率 :100%</strong>
       </template>
     </page-header>
     <page-body>
@@ -63,7 +61,6 @@ export default {
     this.detailLoading = true;
     const detail = await getDLProjectDetail(homeworkId);
     this.dlTestDetail = detail.data;
-    console.log(this.dlTestDetail);
     this.detailLoading = false;
   }
 };

+ 19 - 12
src/views/student/DlWork/dlTestDetail.vue

@@ -8,19 +8,27 @@
           class="test-item"
           :key="item.id"
           :to="`${$route.path}/unit/${item.id}`"
-          v-for="item in dlTestList"
+          v-for="item in testList"
           tag="div"
         >
           <div><strong>准确率测试 : #</strong> {{ item.id }}</div>
           <span>准确率 : </span>
-          <div class="tag is-success" style="width: 40px;height:1.5em">
-            <strong style="color: white;">{{
-              item.accuracy ? item.accuracy : "100%"
-            }}</strong>
+          <div
+            v-if="item.accuracy > 90"
+            class="tag is-success"
+            style="width: 40px;height:1.5em"
+          >
+            <strong style="color: white;">{{ item.accuracy }}</strong>
+          </div>
+          <div
+            v-if="item.accuracy < 90"
+            class="tag is-danger"
+            style="width: 40px;height:1.5em"
+          >
+            <strong style="color: white;">{{ item.accuracy }}</strong>
           </div>
           <br />
-          <span>得分 : </span>
-          <strong>{{ item.score ? item.score : "100" }}</strong
+          <span>得分 : </span> <strong>{{ item.score }}</strong
           ><br />
           <span>{{ displayUnixTime(item.time) }}</span>
         </router-link>
@@ -31,7 +39,6 @@
 
 <script>
 import timeMixins from "@/mixins/time";
-// import { makeFunctionalTest } from "@/api/codehw";
 import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
 
 export default {
@@ -40,7 +47,7 @@ export default {
     projectDetail: {
       type: Object,
       default: () => ({
-        dlTestList: []
+        testList: []
       })
     },
     detailLoading: {
@@ -49,8 +56,8 @@ export default {
     }
   },
   computed: {
-    dlTestList() {
-      return this.sortTestList(this.projectDetail.dlTestList);
+    testList() {
+      return this.sortTestList(this.projectDetail.testList);
     }
   },
   data() {
@@ -64,7 +71,7 @@ export default {
       console.log(list);
       if (!list) return [];
       const copyList = list.slice(0);
-      copyList.sort((a, b) => b.time - a.time);
+      copyList.sort((a, b) => b.testTime - a.testTime);
       return copyList;
     }
   }