瀏覽代碼

fix 步骤modal闪跳

Michael Wang 3 年之前
父節點
當前提交
ae14232701
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      src/features/OnlineExam/StartExamModal.vue

+ 9 - 2
src/features/OnlineExam/StartExamModal.vue

@@ -31,6 +31,9 @@ const STEPS = [
 
 let curentStep = $ref(-1);
 
+// 为了页面在跳过此步骤是不出现此步骤的页面,所以加上这个变量来控制modal.show
+let showCheckEnv1 = $ref(false);
+
 watch(
   () => curentStep,
   async (step, oldStep) => {
@@ -43,12 +46,16 @@ watch(
       },
     });
 
+    if (STEPS[step] === "COMMITTMENT") {
+      if (!course.showUndertaking) curentStep++;
+    }
     if (STEPS[step] === "CHECK_ENV_1") {
       if (!(await isGetCheckEnvOk())) {
         emit("on-unselect-course");
         return;
       }
-      if (!serverWantCheckEnv) curentStep++;
+      if (!serverWantCheckEnv) curentStep += 2;
+      showCheckEnv1 = true;
     }
     if (STEPS[step] === "CHECK_FACE") {
       if (course.faceEnable) {
@@ -244,7 +251,7 @@ onUnmounted(() => {
 
   <n-modal
     v-if="STEPS[curentStep] === 'CHECK_ENV_1'"
-    show
+    :show="showCheckEnv1"
     :closable="false"
     preset="card"
     title="进行环境检测"