Browse Source

日常开发

林旭祥 1 week ago
parent
commit
1ea751f670

+ 10 - 0
src/components/SquareGame/index.vue

@@ -302,6 +302,16 @@ function squaresToMy() {
   }
 }
 
+function jump() {
+  mySquare.value.jump();
+}
+
+//暴露给父组件用
+defineExpose({
+  loginGame,
+  jump
+});
+
 //背景
 class backgroundObj {
   constructor() {

+ 5 - 0
src/types/components.d.ts

@@ -8,11 +8,16 @@ export {}
 declare module 'vue' {
   export interface GlobalComponents {
     ChooseStudent: typeof import('./../components/ChooseStudent/index.vue')['default']
+    ElAvatar: typeof import('element-plus/es')['ElAvatar']
+    ElButton: typeof import('element-plus/es')['ElButton']
     ElIcon: typeof import('element-plus/es')['ElIcon']
     ElInput: typeof import('element-plus/es')['ElInput']
     ElOption: typeof import('element-plus/es')['ElOption']
+    ElPagination: typeof import('element-plus/es')['ElPagination']
     ElSelect: typeof import('element-plus/es')['ElSelect']
     ElSwitch: typeof import('element-plus/es')['ElSwitch']
+    ElTable: typeof import('element-plus/es')['ElTable']
+    ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
     FaceWindow: typeof import('./../components/FaceWindow/index.vue')['default']
     Header: typeof import('./../components/Header/index.vue')['default']
     JumpRopeGame: typeof import('./../components/JumpRopeGame/index.vue')['default']

+ 1 - 1
src/views/game/index.vue

@@ -44,7 +44,7 @@ const getJump = (data: any) => {
     path: `/game/${data.key}`, query: {
       project: 'jumprope',
       time: 60,
-      area: 11,
+      area: 29,
       gesture: 'true',
       classes: '1'
     }

+ 12 - 10
src/views/game/square.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="test">
-    <SquareGame></SquareGame>
+    <SquareGame ref="squareGameRef"></SquareGame>
     <Header @confirmExit="confirmExit" @setMusic="setMusic"></Header>
     <div class="main">
       <div class="main-left">
@@ -35,9 +35,11 @@
             <div class="complete" :class="{ 'complete2': needStart && [42].includes(examState) }"
               v-if="faceCheckStu.student_id && time.ready <= 0 && examState != 43 && examState != 41">
               <div class="scoreBox">
-                <div class="score" v-if="currentResultObj?.count && currentResultObj.count >= 0">{{ currentResultObj.count
+                <div class="score" v-if="currentResultObj?.count && currentResultObj.count >= 0">{{
+                  currentResultObj.count
                   }}</div>
-                <div class="prompt" v-if="currentResultObj?.count && currentResultObj.count == 0 && examState == 42">请开始测试
+                <div class="prompt" v-if="currentResultObj?.count && currentResultObj.count == 0 && examState == 42">
+                  请开始测试
                 </div>
                 <div class="unit"
                   v-if="!['basketballv1', 'footballv1'].includes(parameter.project) && currentResultObj.count && !needStart">
@@ -158,6 +160,7 @@ const reportListRef = ref();
 const gameContainer = ref();
 const myInfo: any = localStorage.getItem('userInfo');
 const dic: any = dataDictionary;
+const squareGameRef = ref();
 const data = reactive<any>({
   timerManager: {}, //计时器管理
   parameter: {}, //参数
@@ -354,10 +357,7 @@ const getFaceConfirmOnly = (data?: any) => {
     },
     () => {
       faceWindowRef.value?.close();
-      //不需要按钮的自动进入下一步
-      if (needStart.value == false) {
-        getStartOneTest();
-      }
+      getReady();
     }
   );
 };
@@ -729,7 +729,7 @@ const getAchievement = (data: any) => {
  * 准备开始
  */
 const getReady = () => {
-  if (needStart.value && examState.value == 43 && !time.value.ready && readyState.value) {
+  if (examState.value == 43 && !time.value.ready && readyState.value) {
     if (time.value.ready) {
       return false;
     }
@@ -741,6 +741,7 @@ const getReady = () => {
       if (time.value.ready <= 0) {
         getClearTimer('readyTimer');
         getStartOneTest();
+        squareGameRef.value.loginGame();
       } else {
         speckText(time.value.ready);
       }
@@ -1043,7 +1044,7 @@ watch(
 );
 
 /**
- * 播报时间
+ * 监听跳跃
  */
 watch(
   () => currentResultObj.value.count,
@@ -1051,6 +1052,7 @@ watch(
     if (newData > 0 && ['jumprope'].includes(parameter.value.project)) {
       //let frameRate = 12;
       //gameContainer.value.sports(frameRate);
+      squareGameRef.value.jump();
     }
   },
   { immediate: true }
@@ -1081,7 +1083,7 @@ onBeforeMount(() => {
     parameter.value.gesture = false;
   }
   //需要开始按钮的项目
-  let myList = ['situp', 'jumprope', 'jumpingjack', 'highknees', 'footballv1', 'basketballv1', 'pingpong'];
+  let myList: any = [];
   if (myList.includes(project)) {
     needStart.value = true;
   }

+ 7 - 1
src/views/home/index.vue

@@ -90,7 +90,7 @@ const getJump = (url: string, name: string) => {
       })
       .finally(() => { });
   } else if (url == '/game') {
-    proxy?.$modal.msgWarning('暂不开放使用,敬请期待!');
+    // proxy?.$modal.msgWarning('暂不开放使用,敬请期待!');
     // proxy?.$modal
     //   .prompt('请输入密码')
     //   .then((e: any) => {
@@ -99,6 +99,12 @@ const getJump = (url: string, name: string) => {
     //     }
     //   })
     //   .finally(() => { });
+    if (import.meta.env.DEV) {
+      proxy?.$modal.msgSuccess('测试环境直接进入');
+      router.push({ path: url });
+    } else {
+      proxy?.$modal.msgWarning('暂不开放使用,敬请期待!');
+    }
   }
   else {
     router.push({ path: url });