chenlei 3 kuukautta sitten
vanhempi
commit
c6e089b007

+ 1 - 0
package.json

@@ -31,6 +31,7 @@
   },
   "devDependencies": {
     "@tsconfig/node22": "^22.0.0",
+    "@types/jquery": "^3.5.33",
     "@types/node": "^22.9.0",
     "@vitejs/plugin-vue": "^5.1.4",
     "@vitejs/plugin-vue-jsx": "^4.0.1",

+ 15 - 0
pnpm-lock.yaml

@@ -57,6 +57,9 @@ importers:
       '@tsconfig/node22':
         specifier: ^22.0.0
         version: 22.0.0
+      '@types/jquery':
+        specifier: ^3.5.33
+        version: 3.5.33
       '@types/node':
         specifier: ^22.9.0
         version: 22.9.0
@@ -671,6 +674,9 @@ packages:
   '@types/estree@1.0.8':
     resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
 
+  '@types/jquery@3.5.33':
+    resolution: {integrity: sha512-SeyVJXlCZpEki5F0ghuYe+L+PprQta6nRZqhONt9F13dWBtR/ftoaIbdRQ7cis7womE+X2LKhsDdDtkkDhJS6g==}
+
   '@types/lodash-es@4.17.12':
     resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
 
@@ -680,6 +686,9 @@ packages:
   '@types/node@22.9.0':
     resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==}
 
+  '@types/sizzle@2.3.10':
+    resolution: {integrity: sha512-TC0dmN0K8YcWEAEfiPi5gJP14eJe30TTGjkvek3iM/1NdHHsdCA/Td6GvNndMOo/iSnIsZ4HuuhrYPDAmbxzww==}
+
   '@types/web-bluetooth@0.0.16':
     resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==}
 
@@ -2537,6 +2546,10 @@ snapshots:
 
   '@types/estree@1.0.8': {}
 
+  '@types/jquery@3.5.33':
+    dependencies:
+      '@types/sizzle': 2.3.10
+
   '@types/lodash-es@4.17.12':
     dependencies:
       '@types/lodash': 4.17.20
@@ -2547,6 +2560,8 @@ snapshots:
     dependencies:
       undici-types: 6.19.8
 
+  '@types/sizzle@2.3.10': {}
+
   '@types/web-bluetooth@0.0.16': {}
 
   '@types/web-bluetooth@0.0.21': {}

+ 4 - 0
src/index/types/index.ts

@@ -30,3 +30,7 @@ export interface IRulesMethods {
   showRuleBox: Ref<boolean, boolean>;
   startMeasure: () => void;
 }
+
+export interface IGuideMethods {
+  resetGuide: (isEnd?: boolean) => void;
+}

+ 2 - 1
src/index/views/home/components/guide/index.tsx

@@ -1,4 +1,4 @@
-import { defineComponent, ref, watch, defineEmits } from 'vue';
+import { defineComponent, ref, watch } from 'vue';
 import { Swiper, SwiperSlide } from 'swiper/vue';
 import { FreeMode } from 'swiper/modules';
 import { useRoute } from 'vue-router';
@@ -134,6 +134,7 @@ export default defineComponent({
       playingPartId,
       baseUrl: import.meta.env.VITE_APP_BACKEND_URL,
       handlePlayGuide,
+      resetGuide,
     };
   },
   render() {

+ 11 - 2
src/index/views/home/components/menu/index.tsx

@@ -7,7 +7,7 @@ import Guide from '../guide';
 import { useFullscreen } from '@vueuse/core';
 import { CAMERA_TYPE_ENUM } from '@/types/home';
 import Rules from '../rules/index.vue';
-import type { IRulesMethods } from '@/types';
+import type { IGuideMethods, IRulesMethods } from '@/types';
 import './index.scss';
 
 export default defineComponent({
@@ -27,6 +27,7 @@ export default defineComponent({
     const guideVisible = ref(false);
     const guideToolsVisible = ref(false);
     const rulesRef = ref<IRulesMethods>();
+    const guideRef = ref<IGuideMethods>();
 
     const handlePlayGuide = async () => {
       const player = await window.kankan.TourManager.player;
@@ -96,6 +97,7 @@ export default defineComponent({
       bgMusicPlaying,
       guideToolsVisible,
       rulesRef,
+      guideRef,
       toggle,
       openHotList,
       startMeasure,
@@ -196,11 +198,18 @@ export default defineComponent({
         )}
 
         <Guide
+          ref="guideRef"
           open={this.guideVisible}
           playing={this.guidePlaying}
           onShowTools={() => (this.guideToolsVisible = true)}
         />
-        <Rules ref="rulesRef" />
+        <Rules
+          ref="rulesRef"
+          onStart={() => {
+            this.guideRef?.resetGuide();
+            this.guideVisible = false;
+          }}
+        />
       </>
     );
   },

+ 2 - 9
src/index/views/home/components/rules/index.vue

@@ -20,6 +20,7 @@
   let checkedToNext = false;
   const baseStore = useBaseStore();
   const { kankanInited } = storeToRefs(baseStore);
+  const emits = defineEmits(['start']);
   const showRuleBox = ref(false);
   const ruleStep = ref(0);
 
@@ -40,7 +41,7 @@
     showRuleBox.value = true;
     window.kankan.TagManager.startMeasure();
 
-    resetGuide();
+    emits('start');
   };
 
   const cancelMeasure = () => {
@@ -49,14 +50,6 @@
     ruleStep.value = 0;
   };
 
-  const resetGuide = () => {
-    baseStore.setState('guidePlaying', false);
-    baseStore.setState('progress', 0);
-    baseStore.setState('progressPart', 0);
-    baseStore.setState('playingPartId', 0);
-    baseStore.setState('checkedGuide', false);
-  };
-
   defineExpose<IRulesMethods>({
     showRuleBox,
     startMeasure,

+ 3 - 12
src/index/views/home/components/share-popup/index.vue

@@ -18,16 +18,13 @@
 </template>
 
 <script setup lang="ts">
-  import { computed, ref, watch } from 'vue';
+  import { computed, ref } from 'vue';
   import VueQrcode from 'vue-qrcode';
   import clipboard from 'clipboard';
-  import { storeToRefs } from 'pinia';
-  import useBaseStore from '@/store/module/base';
+  import { judgeIsMobile } from '@/utils';
 
-  const baseStore = useBaseStore();
-  const { manageJsLoaded } = storeToRefs(baseStore);
   const url = window.location.href;
-  const isMobile = ref(false);
+  const isMobile = ref(judgeIsMobile());
   const props = defineProps<{
     visible: boolean;
   }>();
@@ -63,12 +60,6 @@
       a.click();
     }
   };
-
-  watch(manageJsLoaded, (v) => {
-    if (v) {
-      isMobile.value = window.browser.isMobile();
-    }
-  });
 </script>
 
 <style lang="scss">

+ 1 - 0
tsconfig.app.json

@@ -6,6 +6,7 @@
     "composite": true,
     "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
     "noImplicitAny": false,
+    "types": ["jquery"],
 
     "baseUrl": ".",
     "paths": {