Переглянути джерело

feat:前端显示作业timeline

lalala 1 рік тому
батько
коміт
fa96058722
1 змінених файлів з 35 додано та 7 видалено
  1. 35 7
      src/views/CourseDetailPage/tabs/TaskTab.vue

+ 35 - 7
src/views/CourseDetailPage/tabs/TaskTab.vue

@@ -12,23 +12,34 @@
                  style="color: #f5b86e;">Eval测试
       </el-button>
       <el-button v-if="eaiId"
-                 @click="handleAddEaiClick"
+                 @click="handleAddEaiWritingClick"
                  icon="el-icon-circle-plus-outline"
-                 style="color: #50A879;">Eai任务
+                 style="color: #50A879;">写作任务
+      </el-button>
+      <el-button v-if="eaiId"
+                 @click="handleAddEaiSpeakingClick"
+                 icon="el-icon-circle-plus-outline"
+                 style="color: #50A879;">口语任务
       </el-button>
       <el-timeline>
         <el-timeline-item
             v-for="task in courseTaskList"
             :key="task['id']"
-            :timestamp="task['examId'] ? task.startTime.substring(0, 16) + ' — ' + task.endTime.substring(0, 16) : timestampToTime(task['startAt'] * 1000) + ' — ' + timestampToTime(task['endAt'] * 1000)"
+            :timestamp="(task['examId'] || task['eaiId']) ? task.startTime.substring(0, 16) + ' — ' + task.endTime.substring(0, 16) : timestampToTime(task['startAt'] * 1000) + ' — ' + timestampToTime(task['endAt'] * 1000)"
             :color="courseTaskStatusColor(task)" @click="toTask(task)">
           <el-row>
             <el-tag v-if="task['examId']" class="timeline-content" size="small" color="#f5b86e" effect="dark"
                     style="border: none">E
             </el-tag>
-            <el-tag v-else class="timeline-content" size="small" color="#8dc9e2" effect="dark"
+            <el-tag v-if="task['coderId']" class="timeline-content" size="small" color="#8dc9e2" effect="dark"
                     style="border: none">C
             </el-tag>
+            <el-tag v-if="task['type'] ==='写作'" class="timeline-content" size="small" color="#50A879" effect="dark"
+                    style="border: none">W
+            </el-tag>
+            <el-tag v-if="task['type'] ==='AI口语'" class="timeline-content" size="small" color="#50A879" effect="dark"
+                    style="border: none">S
+            </el-tag>
             <el-row v-if="task['examId']" class="timeline-content">
               <el-tag v-if="this.state(task)==='NOT_STARTED'" size="small">未开始</el-tag>
               <el-tag v-else-if="this.state(task)==='RUNNING'" size="small" type="success">进行中</el-tag>
@@ -44,6 +55,9 @@
             <el-row v-if="task['examId']" class="task-title timeline-content">
               {{ task["examName"] }}
             </el-row>
+            <el-row v-if="task['eaiId']" class="task-title timeline-content">
+              {{ task["assignmentName"] }}
+            </el-row>
             <el-row v-else class="task-title timeline-content">
               {{ task.name }}
             </el-row>
@@ -62,6 +76,12 @@
             <el-tag v-if="task['examId']" class="timeline-content" size="small" color="#f5b86e" effect="dark"
                     style="border: none">E
             </el-tag>
+            <el-tag v-if="task['type'] ==='写作'" class="timeline-content" size="small" color="#50A879" effect="dark"
+                    style="border: none">W
+            </el-tag>
+            <el-tag v-if="task['type'] ==='AI口语'" class="timeline-content" size="small" color="#50A879" effect="dark"
+                    style="border: none">S
+            </el-tag>
             <el-tag v-else class="timeline-content" size="small" color="#8dc9e2" effect="dark"
                     style="border: none">C
             </el-tag>
@@ -469,7 +489,15 @@ export default {
           _this.coderExamList = (await _this.$apis.getTeacherCoderExamsByCourseId(_this.coderId)).data.data || [];
         }
         if(this.eaiId !== null) {
-          _this.eaiExamList = (await _this.$apis.getTeacherEaiExamsByCourseId(_this.eaiId)).data.data || [];
+          const result = (await _this.$apis.getTeacherEaiExamsByCourseId(_this.eaiId)).data.data || [];
+          _this.eaiExamList = result.map(item => ({
+            eaiId: item.assignmentId,
+            assignmentName:item.assignmentName,
+            startTime:item.startTime,
+            endTime:item.endTime,
+            type:item.type,
+            status:item.status
+          }));
         }
       } else if (this.isStudent) {
         if (_this.evalId !== null) {
@@ -498,7 +526,7 @@ export default {
     },
 
     state(VO) {
-      if (VO["examId"]) {
+      if (VO["examId"] || VO["eaiId"]) {
         if (new Date(VO.endTime) < new Date()) {
           return "FINISHED";
         } else if (new Date(VO.startTime) > new Date()) {
@@ -506,7 +534,7 @@ export default {
         } else {
           return "RUNNING";
         }
-      } else {
+      }else {
         if (VO.status === "CLOSED") {
           return "CLOSED";
         } else if (VO["startAt"] * 1000 > new Date()) {