Browse Source

fix: 停止record时弹出提示

mjh 3 năm trước cách đây
mục cha
commit
28382d31e1

+ 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>

+ 7 - 3
src/views/CoderPage/ResultPage/CommitPage/components/CommitBoard.vue

@@ -99,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);
 
@@ -132,8 +131,13 @@ export default {
     },
     // 点击"停止"按钮,停止当前提交的运行;
     async handleStopRecordButtonClick(recordId) {
-      await this.$apis.stopRecordById(recordId);
-      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);
+      }
     },
   }
 };