Browse Source

fix: Coder题目选择的确认按钮、老师生成自测卷

Leonezhurui 3 years ago
parent
commit
8f6b06b472

+ 5 - 0
src/components/PageHeader.vue

@@ -27,5 +27,10 @@ export default {
     align-items: center;
     justify-content: space-between;
   }
+  .actions {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+  }
 }
 </style>

+ 29 - 2
src/views/CoderPage/ExamDetail.vue

@@ -19,7 +19,15 @@
               参加考试
             </el-button>
             <el-button
-              v-if="(isStudentGroup && exam.joined) || (isTeacherGroup)"
+                v-if="(isStudentGroup || isTeacherGroup) && !exam.joined"
+                type="primary"
+                :loading="loading.create"
+                @click="createExamPaper"
+            >
+              生成自测试卷
+            </el-button>
+            <el-button
+              v-if="(isStudentGroup || isTeacherGroup) && exam.joined"
               type="primary"
               @click="jumpToCoderOnlineExam"
             >
@@ -434,6 +442,7 @@ export default {
         delete: false,
         console: false,
         refresh: false,
+        create: false,
       },
 
       range: [],
@@ -608,7 +617,7 @@ export default {
     jumpToCoderOnlineExam() {
       let firstQuestionId = this.exam.problems[0].id;
       // let nextURL = "https://coder.seec.seecoder.cn/exam/" + this.exam.id + "?id_token=" + this.$store.state.user.token; //跳转到Coder
-      let nextURL = `https://ide-test.seec.seecoder.cn/?examId=${this.exam.id}&questionId=${firstQuestionId}&id_token=${this.$store.state.user.token}`;
+      let nextURL = `https://ide.seec.seecoder.cn/?examId=${this.exam.id}&questionId=${firstQuestionId}&id_token=${this.$store.state.user.token}`;
       window.open(nextURL);
     },
     goToDetect() {
@@ -713,6 +722,24 @@ export default {
         this.dialog.join = false;
       });
     },
+    createExamPaper() { // 生成自测试卷(老师选择考试,否则不能正常自测)
+      this.loading.create = true;
+      this.$apis.joinCoderExam(this.exam.id)
+          .then(_res => {
+            this.$message.success({
+              message: "生成自测试卷成功!",
+              center: true
+            });
+            this.fetchExamDetail();
+          }).catch(_err => {
+        this.$message.error({
+          message: "生成自测试卷出错!",
+          center: true
+        });
+      }).finally(() => {
+        this.loading.create = false;
+      });
+    },
     //TODO 下载考试成绩的认证过程,信息安全问题
     //下载考试成绩单
     download() {

+ 10 - 0
src/views/CourseDetailPage/tabs/TaskTab.vue

@@ -206,9 +206,14 @@
     <el-pagination
         background
         layout="prev, pager, next"
+        style="margin-top: 10px;"
         :total="problemPageInfo.total"
         @current-change="changePage"
     />
+    <div style="display: flex; justify-content: flex-end;">
+      <el-button type="primary" size="large" @click="coderProblemDialog = false">确认</el-button>
+      <el-button type="danger" size="large" @click="clearProblemCart">取消</el-button>
+    </div>
   </el-dialog>
 
   <!-- 创建Eval考试-->
@@ -618,6 +623,11 @@ export default {
           .includes(problem.id);
     },
 
+    clearProblemCart() {
+      this.$store.commit("clearProblem");
+      this.coderProblemDialog = false;
+    },
+
     addEnable(problem) { //是否可以添加题目
       return this.$store.getters.isTeacher && problem.modifiedAt;
     },

+ 8 - 5
src/views/ManagePage/ManagePage.vue

@@ -116,16 +116,19 @@
         <page-header>
           <template #actions>
             <el-input v-model="dialogProblemName"
-                      style="width:200px;"
+                      style="width:200px; margin-right: 10px;"
                       placeholder="搜索"
+
             />
-            <el-select v-model="dialogProblemTypeStr" @change="fetchProblemData(1)">
+            <el-select v-model="dialogProblemTypeStr" @change="fetchProblemData(1)"
+                       style="margin-right: 10px;"
+            >
               <el-option v-for="item in problemTypeOptions" :key="item.value" :value="item.value">
                 {{ item.label }}
               </el-option>
             </el-select>
-            <el-button @click="uploadFile" type="primary" style="margin-right: 40px">
-              <el-icon :size="14">
+            <el-button @click="uploadFile" type="primary" style="display:inline-block; height: 40px; margin-right: 40px;">
+              <el-icon :size="13">
                 <UploadFilled/>
               </el-icon>
               上传题目
@@ -150,7 +153,7 @@
               <span>{{ formatTimestamp(scope.row.createdAt) }}</span>
             </template>
           </el-table-column>
-          <el-table-column label="操作" width="200">
+          <el-table-column label="操作" width="100">
             <template #default="scope">
               <el-button
                   type="primary"

+ 1 - 1
src/views/ProblemPage/ProblemPage.vue

@@ -94,4 +94,4 @@ export default {
   margin: 40px 10vw 80px 10vw;
   min-height: calc(100vh - 100px);
 }
-</style>
+</style>