浏览代码

Merge branch 'master' into seec

# Conflicts:
#	src/api/coder.js
mjh 3 年之前
父节点
当前提交
2b8b9a1346

+ 7 - 7
src/api/coder.js

@@ -9,7 +9,7 @@ function getStudentCoderExams({page, limit}) {
   });
   });
 }
 }
 
 
-function getStudentCoderExamsGroupByCourse() {
+function getStudentCoderExamsGroupByCourse(){
   return axios.get(`${prefix}/exam/student/groupByCourse`);
   return axios.get(`${prefix}/exam/student/groupByCourse`);
 }
 }
 
 
@@ -24,7 +24,7 @@ function getRecommendCoderExams() {
   return axios.get(`${prefix}/exam/recommend`);
   return axios.get(`${prefix}/exam/recommend`);
 }
 }
 
 
-function getRecommendCoderExamsGroupByCourse() {
+function getRecommendCoderExamsGroupByCourse(){
   return axios.get(`${prefix}/exam/recommend/groupByCourse`);
   return axios.get(`${prefix}/exam/recommend/groupByCourse`);
 }
 }
 
 
@@ -36,11 +36,11 @@ function getStudentCoderExamsByCourseId(courseId) {
   return axios.get(`${prefix}/exam/student/course`, {params: {courseId,}});
   return axios.get(`${prefix}/exam/student/course`, {params: {courseId,}});
 }
 }
 
 
-function getTeacherCoderExamsGroupByCourse() {
+function getTeacherCoderExamsGroupByCourse(){
   return axios.get(`${prefix}/exam/teacher/groupByCourse`);
   return axios.get(`${prefix}/exam/teacher/groupByCourse`);
 }
 }
 
 
-function retrievePageProblem(page, limit, typeStr, name) {
+function retrievePageProblem(page, limit, typeStr, name){
   return axios.get(`${prefix}/problem`, {
   return axios.get(`${prefix}/problem`, {
     params: {
     params: {
       page,
       page,
@@ -51,7 +51,7 @@ function retrievePageProblem(page, limit, typeStr, name) {
   });
   });
 }
 }
 
 
-function createCoderExam(data) {
+function createCoderExam(data){
   return axios.post(`${prefix}/exam/create`, data);
   return axios.post(`${prefix}/exam/create`, data);
 }
 }
 
 
@@ -119,7 +119,7 @@ function changeExamIsShownForStu(examId, status) {
   return axios.post(`${prefix}/exam/${examId}/console?showConsole=${status}`);
   return axios.post(`${prefix}/exam/${examId}/console?showConsole=${status}`);
 }
 }
 
 
-function stopRecord(recordId) {
+function stopRecordById(recordId) {
   return axios.put(`${prefix}/record/stop`, null, {
   return axios.put(`${prefix}/record/stop`, null, {
     params: {
     params: {
       recordId,
       recordId,
@@ -156,7 +156,7 @@ const coderAPIs = {
   getRecordByRecordId,
   getRecordByRecordId,
   getExamIsShownForStu,
   getExamIsShownForStu,
   changeExamIsShownForStu,
   changeExamIsShownForStu,
-  stopRecord,
+  stopRecordById,
 };
 };
 
 
 export default coderAPIs;
 export default coderAPIs;

+ 1 - 1
src/views/CoderPage/ExamDetail.vue

@@ -310,7 +310,7 @@
             <el-table-column label="操作" width="200">
             <el-table-column label="操作" width="200">
               <template #default="scope">
               <template #default="scope">
                 <el-button type="text" @click="jumpToCodemirror(scope.row.owner)">源码</el-button>
                 <el-button type="text" @click="jumpToCodemirror(scope.row.owner)">源码</el-button>
-                |
+                <el-divider direction="vertical"/>
                 <el-button type="text" @click="jumpToResultDetail(scope.row.id)">详情</el-button>
                 <el-button type="text" @click="jumpToResultDetail(scope.row.id)">详情</el-button>
               </template>
               </template>
             </el-table-column>
             </el-table-column>

+ 16 - 17
src/views/CoderPage/ResultPage/CommitPage/components/CommitBoard.vue

@@ -45,12 +45,9 @@
               type="text"
               type="text"
               @click="this.openRecordDetail(scope.row.id)"
               @click="this.openRecordDetail(scope.row.id)"
           >详情</el-button>
           >详情</el-button>
-          <el-button
-              v-if="stopRecordButton(scope.row.status)"
-              type="danger"
-              size="mini"
-              @click="dialog.stop = scope.$index"
-          >
+          <el-divider direction="vertical"/>
+          <el-button type="text" class="stop-record-button" :disabled="scope.row.status!==`RUNNING`"
+                     @click="handleStopRecordButtonClick(scope.row.id)">
             停止
             停止
           </el-button>
           </el-button>
         </template>
         </template>
@@ -132,17 +129,11 @@ export default {
           return "black";
           return "black";
       }
       }
     },
     },
-    stopRecordButton(status) {
-      if (this.commit.createdAt !== undefined) {
-        return (
-            status === "RUNNING" &&
-            (Date.parse(new Date().toString()) / 1000 - this.commit.createdAt) /
-            60 >
-            7
-        );
-      }
-      return false;
-    }
+    // 点击"停止"按钮,停止当前提交的运行;
+    async handleStopRecordButtonClick(recordId){
+      const res = (await this.$apis.stopRecordById(recordId)).data;
+      this.fetchData();
+    },
   }
   }
 };
 };
 </script>
 </script>
@@ -162,4 +153,12 @@ export default {
   border-bottom: none !important;
   border-bottom: none !important;
   padding-bottom: 0 !important;
   padding-bottom: 0 !important;
 }
 }
+
+.stop-record-button{
+  color: var(--el-color-danger);
+}
+
+.stop-record-button:hover{
+  opacity: 75%;
+}
 </style>
 </style>