|
@@ -102,6 +102,7 @@
|
|
import { useUserStore } from '@/store'
|
|
import { useUserStore } from '@/store'
|
|
import { GameManageVO } from '@/api/gameCenter/manage'
|
|
import { GameManageVO } from '@/api/gameCenter/manage'
|
|
import iconArrowRight from '@/assets/images/icon-arrow-right.png'
|
|
import iconArrowRight from '@/assets/images/icon-arrow-right.png'
|
|
|
|
+import { getCurrentInstance } from 'vue'
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
gameInfo: {
|
|
gameInfo: {
|
|
@@ -109,6 +110,8 @@ const props = defineProps({
|
|
default: () => ({})
|
|
default: () => ({})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+const instance = getCurrentInstance()
|
|
const userStore = useUserStore()
|
|
const userStore = useUserStore()
|
|
const emits = defineEmits(['close'])
|
|
const emits = defineEmits(['close'])
|
|
const gameFlag = ref<StrKeyObj>({
|
|
const gameFlag = ref<StrKeyObj>({
|
|
@@ -141,19 +144,16 @@ const cocosType = ref('')
|
|
const cocosUrl = ref('')
|
|
const cocosUrl = ref('')
|
|
const VoiceImpRef = ref()
|
|
const VoiceImpRef = ref()
|
|
|
|
|
|
|
|
+let tempPlanId = ''
|
|
|
|
+
|
|
const beginGame = () => {
|
|
const beginGame = () => {
|
|
for (const item in gameFlag.value) {
|
|
for (const item in gameFlag.value) {
|
|
gameFlag.value[item] = false
|
|
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}`
|
|
cocosUrl.value = `${window.location.origin}/cocos/${cocosType.value}/?userID=${userStore.user.id}&planID=${tempPlanId}`
|
|
VoiceImpRef.value.pauseIntro()
|
|
VoiceImpRef.value.pauseIntro()
|
|
gameFlag.value.CocosDialog = true
|
|
gameFlag.value.CocosDialog = true
|
|
@@ -165,10 +165,20 @@ const beginGame = () => {
|
|
|
|
|
|
const gameOver = (key: string) => {
|
|
const gameOver = (key: string) => {
|
|
gameFlag.value[key] = false
|
|
gameFlag.value[key] = false
|
|
|
|
+ if (tempPlanId !== '') {
|
|
|
|
+ instance?.proxy?.$Bus.emit('trainList-refresh')
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
async function exec() {
|
|
async function exec() {
|
|
VoiceImpRef.value.videoPlay(props.gameInfo.id)
|
|
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(() => {
|
|
onMounted(() => {
|