2 Commits 78af468934 ... 28382d31e1

Autore SHA1 Messaggio Data
  mjh 28382d31e1 fix: 停止record时弹出提示 3 anni fa
  mjh 6afe800290 fix: 取消注释停止按钮 3 anni fa

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

@@ -218,7 +218,7 @@
           <el-table-column prop="score" label="成绩" width="150"/>
           <el-table-column label="操作" type="expand" width="50">
             <template #default="scope">
-              <CommitBoard :commit-id="scope.row.id" :exam-id="$route.params.examId"></CommitBoard>
+              <CommitBoard :commit-id="scope.row.id" :exam-id="Number($route.params.examId)"></CommitBoard>
             </template>
           </el-table-column>
         </el-table>

+ 12 - 9
src/views/CoderPage/ResultPage/CommitPage/components/CommitBoard.vue

@@ -47,11 +47,11 @@
           >详情
           </el-button>
           <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 type="text" class="stop-record-button"
+                     :disabled="scope.row.status!==`RUNNING`"
+                     @click="handleStopRecordButtonClick(scope.row.id)">
+            停止
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -65,7 +65,6 @@
 
 <script>
 import {formatTimestamp, buildStatusToTagType, buildStatusToTagContent} from "@/utils/coder-utils";
-import PageHeader from "@/views/ProblemPage/components/PageHeader.vue";
 import RecordDetail from "@/views/CoderPage/ResultPage/CommitPage/RecordPage/RecordDetail";
 
 export default {
@@ -100,7 +99,6 @@ export default {
       this.$apis.getCommitByCommitId(this.commitId)
         .then(_res => {
           this.commit = _res.data.res;
-          console.log("commit", this.commit);
         }).catch(_err => {
         console.log(_err);
 
@@ -133,8 +131,13 @@ export default {
     },
     // 点击"停止"按钮,停止当前提交的运行;
     async handleStopRecordButtonClick(recordId) {
-      const res = (await this.$apis.stopRecordById(recordId)).data;
-      this.fetchData();
+      const response = await this.$apis.stopRecordById(recordId);
+      if (response.data.res) {
+        this.$message.success(`记录${recordId}被用户手动停止`);
+        setTimeout(() => this.fetchData(), 0);
+      } else {
+        this.$message.error(response.data);
+      }
     },
   }
 };