瀏覽代碼

考试列表,新增刷新按钮

刘洋 2 年之前
父節點
當前提交
cd814a7bb6
共有 2 個文件被更改,包括 18 次插入1 次删除
  1. 6 0
      src/features/OnlineExam/OnlineExamHome.vue
  2. 12 1
      src/features/OnlineExam/OnlineExamList.vue

+ 6 - 0
src/features/OnlineExam/OnlineExamHome.vue

@@ -85,6 +85,11 @@ async function getData() {
     }
   }
 }
+		
+async function refresh() {
+  loading = true;
+  await getData().finally(() => (loading = false));
+}
 </script>
 
 <template>
@@ -95,6 +100,7 @@ async function getData() {
       :courses="courses"
       :endCourses="endCourses"
       :examType="examType"
+      @refresh="refresh"
     />
   </div>
 </template>

+ 12 - 1
src/features/OnlineExam/OnlineExamList.vue

@@ -9,6 +9,7 @@ import { WEEKDAY_NAMES } from "@/constants/constants";
 import OnlineExamResultList from "./OnlineExamResultList.vue";
 import { useRoute } from "vue-router";
 import { watch } from "vue";
+import { Refresh } from "@vicons/ionicons5";
 
 const {
   courses = [],
@@ -142,11 +143,16 @@ async function raceEnter(course: OnlineExam) {
     });
   }
 }
+		
+const emit = defineEmits<{ (e: "refresh"): void }>();
+function refreshPage() {
+  emit("refresh");
+}
 </script>
 
 <template>
   <div class="list">
-    <div style="display: flex; margin-bottom: 10px">
+    <div style="display: flex; margin-bottom: 10px; align-items: center">
       <n-button
         type="success"
         :class="selectExamState != 'EXAMING' && 'button-unselected'"
@@ -162,6 +168,11 @@ async function raceEnter(course: OnlineExam) {
       >
         已结束考试
       </n-button>
+      	
+      <n-button strong secondary circle type="success" @click="refreshPage">
+        <template #icon>
+          <n-icon><Refresh /></n-icon> </template
+      ></n-button>
     </div>
 
     <table>