Browse Source

修改测试文件

plg 5 months ago
parent
commit
7524fd3d0f

+ 11 - 2
src/stores/modules/userInfo.ts

@@ -14,7 +14,14 @@ const userInfoStore = defineStore(
     const userInfo = ref<any>({
       account: ''
     })
+    //信息--查看是否做过了练习测试
+    const isPass = ref<boolean>(false)
 
+
+    //将通过状态改变为通过false
+    const saveIspass = () => {
+      isPass.value = true;
+    }
     //保存正在进行中的计划的文本
     const savePlanCurrentNum = (val: number) => {
       planCurrentNum.value = val
@@ -24,6 +31,8 @@ const userInfoStore = defineStore(
       token.value = val
     }
 
+
+
     //保存用户信息
     const saveUserInfo = (val: any) => {
       //重置用户信息
@@ -33,10 +42,10 @@ const userInfoStore = defineStore(
     const clearUserInfo = () => {
       userInfo.value = { account: '' }
       token.value = ''
+      isPass.value = false
       planCurrentNum.value = 0
     }
-
-    return { planCurrentNum, clearUserInfo, savePlanCurrentNum, token, saveToken, userInfo, saveUserInfo }
+    return { planCurrentNum, clearUserInfo, savePlanCurrentNum, token, saveToken, userInfo, saveUserInfo, isPass, saveIspass }
   },
   { persist: true }
 )

+ 15 - 22
src/views/Cognize.vue

@@ -8,6 +8,9 @@ import pdf4 from '../assets/cognize/dtc.pdf'
 
 import { useRoute, useRouter } from 'vue-router';
 import { queryCognizeDetailApi } from '@/api/plan';
+import { userInfoStore } from '@/stores';
+
+const isPass = userInfoStore().isPass
 const router = useRouter()
 const route = useRoute()
 
@@ -135,16 +138,15 @@ onUnmounted(() => {
                         </video>
                     </div>
                     <div class="scale_button">
-                        <el-row>
-                            <el-col :span="12" class="scale_button_inner">
-                                <div class="scale_button_self" @click="startCog(0)">练习测试
-                                </div>
-                            </el-col>
-                            <el-col :span="12" class="scale_button_inner">
-
-                                <div class="scale_button_self" @click="startCog(1)">开始测试</div>
-                            </el-col>
-                        </el-row>
+
+                        <div class="scale_button_inner" v-show="!isPass">
+                            <div class="scale_button_self" @click="startCog(0)">练习测试
+                            </div>
+                        </div>
+                        <div :span="12" class="scale_button_inner" v-show="isPass">
+                            <div class="scale_button_self" @click="startCog(1)">开始测试</div>
+                        </div>
+
                     </div>
 
 
@@ -168,18 +170,7 @@ onUnmounted(() => {
                         </div>
                     </div>
 
-                    <!-- <div class="scale_button">
-                        <el-row>
-                            <el-col :span="12" class="scale_button_inner">
-                                <div class="scale_button_self" @click="startCog(0)">练习测试
-                                </div>
-                            </el-col>
-                            <el-col :span="12" class="scale_button_inner">
-
-                                <div class="scale_button_self" @click="startCog(1)">开始测试</div>
-                            </el-col>
-                        </el-row>
-                    </div> -->
+
                 </div>
             </div>
         </div>
@@ -371,6 +362,8 @@ onUnmounted(() => {
             .scale_button {
                 margin-top: 30px;
                 margin-bottom: 20px;
+                display: flex;
+                justify-content: space-around;
 
                 .scale_button_inner {
                     text-align: center;

+ 2 - 2
src/views/Plan.vue

@@ -268,10 +268,10 @@ onUnmounted(() => {
                             <img src="../assets/kepu/task_1.png" />
                             <span>{{ item.planName }}</span>
                         </div>
-                        <div class="test_time">
+                        <!-- <div class="test_time">
                             <span>请根据您最近一个月的实际情况,选择最符合自己的选项。所有陈述都无正确和错误之分。所以请您不要再三思考,要根据第一反应诚实作答。</span>
 
-                        </div>
+                        </div> -->
                         <div class="content_out">
                             <div class="content_inner">
                                 <div class="task_out">

+ 2 - 0
src/views/Register.vue

@@ -164,6 +164,8 @@ const registerFun = async () => {
             type: 'success'
 
         })
+        // 跳转到登录页面吧
+        router.push({ name: 'login' })
 
         //如果注册成功过得话
     } else {

+ 59 - 11
src/views/shapeIntuition_random.vue

@@ -17,16 +17,26 @@
           style="width:50%;margin-top:10px"></el-progress>
       </div>
       <div class="glass">
-        <p class="correct_txt" v-show="showCorrectTxt && testTypeCode == 0"><img v-show="showCorrectImg" src="../assets/cognize/correct.png" alt=""> <img v-show="showWrongImg" src="../assets/cognize/wrong.png" alt=""><span>{{ correctTxt
+        <p class="correct_txt" v-show="showCorrectTxt && testTypeCode == 0"><img v-show="showCorrectImg"
+            src="../assets/cognize/correct.png" alt=""> <img v-show="showWrongImg" src="../assets/cognize/wrong.png"
+            alt=""><span>{{ correctTxt
             }}</span></p>
         <p v-show="countDownShow" class="countdownStr">
           {{ countDownStr }}
         </p>
         <img v-show="showDuckEgg" :src="examImgUrl" alt="" class="shapeImg" />
         <div class="operate_demo" v-if="testTypeCode == 0">
-          <p v-show="showMouseLeft || showMouseRight">请点鼠标{{ showMouseLeft ? '左键' : '右键' }}</p>
-          <img v-show="showMouseLeft" src="../assets/cognize/mouseL.png" alt="">
-          <img v-show="showMouseRight" src="../assets/cognize/mouseR.png" alt="">
+          <p v-show="showMouseLeft || showMouseRight">
+            <span>当前鸭蛋尖朝<span class="sbclass" style="font-weight: 700;color: red;">
+                {{ showMouseLeft ? '左' :
+                  '右' }}</span></span>,请点你的鼠标
+            <span class="sbclass" style="font-weight: 700;color: red;">{{
+              showMouseLeft ? '左键' :
+                '右键'
+            }}</span>
+          </p>
+          <img v-show="showMouseLeft" src="../assets/cognize/mouseL.png" alt="" style="visibility: hidden;">
+          <img v-show="showMouseRight" src="../assets/cognize/mouseR.png" alt="" style="visibility: hidden;">
         </div>
       </div>
       <!-- <img v-show="showWhiteFlag" src='../../assets/congnitiveAblitity/whiteFlag.png' alt="" style="width: 50px; height: 50px; margin-top: 20%"> -->
@@ -265,17 +275,34 @@ export default {
         this.testState = false;
         //this.testTypeCode =1
         this.countDownStr = "练习马上开始!";
-        this.userRightResponseCount = 0;
-        this.imgIndex = 0;
+
         this.countDownTime = 6;
         this.testEndFlag = false;
         this.showDuckEgg = false;
-        this.userTestPicList = [];
+
         this.button1Show = true;
-        this.$message({
-          message: "练习测试结束!",
-          type: "success",
-        });
+        //计算一下正确率
+        // let userScore = (
+        //   (this.userRightResponseCount / this.userResponseRecords.length) *
+        //   100
+        // ).toFixed(2);
+
+        if (this.userRightResponseCount / this.userTestPicList.length >= 0.8) {
+          //设置状态为true
+          userInfo.saveIspass()
+          this.$message({
+            message: `练习测试通过!正确率为${this.userRightResponseCount / this.userTestPicList.length * 100}%`,
+            type: "success",
+          });
+        } else {
+          this.$message({
+            message: `练习测试未通过!正确率为${this.userRightResponseCount / this.userTestPicList.length * 100}%`,
+            type: "error",
+          });
+        }
+        this.userRightResponseCount = 0;
+        this.imgIndex = 0;
+        this.userTestPicList = [];
         //跳转到上一页
         this.$router.go(-1)
       } else {
@@ -442,6 +469,27 @@ export default {
 };
 </script>
 <style scoped>
+.sbclass {
+  animation-duration: 1s;
+  animation-name: slidein;
+  animation-iteration-count: infinite;
+  animation-direction: alternate;
+}
+
+@keyframes slidein {
+  from {
+    /* margin-left: 100%; */
+    /* width: 300%; */
+    font-size: 20px;
+  }
+
+  to {
+    /* margin-left: 0%;
+    width: 100%; */
+    font-size: 30px;
+  }
+}
+
 .testMainDiv {
   margin: 0 auto;
   margin-top: 10px;