Ver Fonte

feat(认知任务): 优化图片命名音效逻辑

JutarryWu há 6 meses atrás
pai
commit
e9babf5848
2 ficheiros alterados com 9 adições e 3 exclusões
  1. 2 0
      src/components.d.ts
  2. 7 3
      src/pages/cognitiveTasks/PictureNaming/index.vue

+ 2 - 0
src/components.d.ts

@@ -16,7 +16,9 @@ declare module 'vue' {
     RouterView: typeof import('vue-router')['RouterView']
     SvgIcon: typeof import('./components/SvgIcon.vue')['default']
     TabBar: typeof import('./components/TabBar.vue')['default']
+    VanButton: typeof import('vant/es')['Button']
     VanConfigProvider: typeof import('vant/es')['ConfigProvider']
+    VanImage: typeof import('vant/es')['Image']
     VanNavBar: typeof import('vant/es')['NavBar']
     VanTabbar: typeof import('vant/es')['Tabbar']
     VanTabbarItem: typeof import('vant/es')['TabbarItem']

+ 7 - 3
src/pages/cognitiveTasks/PictureNaming/index.vue

@@ -27,7 +27,7 @@ const subjectInfo = ref<GameVO>({})
 const showCountDown = ref(true) // 显示倒计时
 const showImg = ref(true) // 显示图片
 const showText = ref(false) // 显示文字
-const musicFlag = ref(false) // 页面音乐开关
+const musicFlag = ref(true) // 页面音乐开关
 const showDataArr = ref<IData[]>([])
 const seconds = [3000, 2000, 1500]
 const currentIndex = ref(0) // 当前索引
@@ -75,10 +75,14 @@ function choiceClick(item: string, index: number) {
       showDataArr.value[currentIndex.value].isRight = true
       showDataArr.value[currentIndex.value].score = 1
       showDataArr.value[currentIndex.value].reactionTime = Number((performance.now() - onceStart).toFixed(3))
-      VoiceImpRef.value.videoPlay('right')
+      if (musicFlag.value) {
+        VoiceImpRef.value.videoPlay('right')
+      }
     }
     else {
-      VoiceImpRef.value.videoPlay('error')
+      if (musicFlag.value) {
+        VoiceImpRef.value.videoPlay('error')
+      }
     }
 
     clearTimeout(textTimeout.value)