Преглед изворни кода

增加眼动训练两个游戏的支持

JutarryWu пре 1 недеља
родитељ
комит
7c37db91ba

+ 19 - 9
src/views/gameCenter/components/Introduction/index.vue

@@ -102,6 +102,7 @@
 import { useUserStore } from '@/store'
 import { GameManageVO } from '@/api/gameCenter/manage'
 import iconArrowRight from '@/assets/images/icon-arrow-right.png'
+import { getCurrentInstance } from 'vue'
 
 const props = defineProps({
   gameInfo: {
@@ -109,6 +110,8 @@ const props = defineProps({
     default: () => ({})
   }
 })
+
+const instance = getCurrentInstance()
 const userStore = useUserStore()
 const emits = defineEmits(['close'])
 const gameFlag = ref<StrKeyObj>({
@@ -141,19 +144,16 @@ const cocosType = ref('')
 const cocosUrl = ref('')
 const VoiceImpRef = ref()
 
+let tempPlanId = ''
+
 const beginGame = () => {
   for (const item in gameFlag.value) {
     gameFlag.value[item] = false
   }
-  if (props.gameInfo.code?.indexOf('Cocos-') !== -1) {
-    cocosType.value = <string>props.gameInfo.code?.split('-')[1]
-    let tempPlanId = ''
-    if (userStore.user.roles?.includes('Patient')) {
-      let currentPlanInfo = sessionStorage.getItem('currentPlanInfo')
-      if (currentPlanInfo) {
-        tempPlanId = JSON.parse(currentPlanInfo).id
-      }
-    }
+  // 如果是cocos游戏 或者是 眼动训练的游戏
+  if (props.gameInfo.code?.indexOf('Cocos-') !== -1 || props.gameInfo.typeId === '7') {
+    cocosType.value =
+      props.gameInfo.code?.indexOf('Cocos-') !== -1 ? <string>props.gameInfo.code?.split('-')[1] : props.gameInfo.code
     cocosUrl.value = `${window.location.origin}/cocos/${cocosType.value}/?userID=${userStore.user.id}&planID=${tempPlanId}`
     VoiceImpRef.value.pauseIntro()
     gameFlag.value.CocosDialog = true
@@ -165,10 +165,20 @@ const beginGame = () => {
 
 const gameOver = (key: string) => {
   gameFlag.value[key] = false
+  if (tempPlanId !== '') {
+    instance?.proxy?.$Bus.emit('trainList-refresh')
+  }
 }
 
 async function exec() {
   VoiceImpRef.value.videoPlay(props.gameInfo.id)
+
+  if (userStore.user.roles?.includes('Patient')) {
+    let currentPlanInfo = sessionStorage.getItem('currentPlanInfo')
+    if (currentPlanInfo) {
+      tempPlanId = JSON.parse(currentPlanInfo).id
+    }
+  }
 }
 
 onMounted(() => {

+ 0 - 1
src/views/tester/components/RehabilitationEvaluation/CognitiveAbilityTask/CognitiveAbilityTaskAuditoryTraining/index.vue

@@ -333,7 +333,6 @@ onMounted(() => {
 
       if (val.key === 'tow-win-auditory-change-status') {
         checkItems.value[modeCurrentIndex].isFinish = true
-        childTaskOver(JSON.parse(val.newValue!))
         localStorage.removeItem('tow-win-auditory-change-status')
       }
     } else {