Commit 1b067c44 authored by hewenhao's avatar hewenhao

feat: 提交

parent bb78324f
...@@ -2,7 +2,7 @@ import { ScrollView, Image } from '@tarojs/components' ...@@ -2,7 +2,7 @@ import { ScrollView, Image } from '@tarojs/components'
import { useStoreState, useStoreActions } from '@/store/hooks' import { useStoreState, useStoreActions } from '@/store/hooks'
import { preloadImage } from '@/utils/preload-image' import { preloadImage } from '@/utils/preload-image'
import { useEffect, useMemo } from 'react' import { useEffect, useMemo } from 'react'
import { useDidShow } from '@tarojs/taro' import { useDidShow, enableAlertBeforeUnload, disableAlertBeforeUnload } from '@tarojs/taro'
import assets from '@/assets/oss/assets-complete' import assets from '@/assets/oss/assets-complete'
import { EyeProtectionView } from '@/components' import { EyeProtectionView } from '@/components'
...@@ -42,6 +42,14 @@ const GamePlay = () => { ...@@ -42,6 +42,14 @@ const GamePlay = () => {
const clearUserAnswer = useStoreActions(actions => actions.gameModel.clearUserAnswer) const clearUserAnswer = useStoreActions(actions => actions.gameModel.clearUserAnswer)
const handleGoNext = useStoreActions(actions => actions.gameModel.handleGoNext) const handleGoNext = useStoreActions(actions => actions.gameModel.handleGoNext)
useEffect(() => {
enableAlertBeforeUnload({
message: '还没有答完哦,确定离开吗?',
})
return disableAlertBeforeUnload
}, [])
useEffect(() => { useEffect(() => {
preloadCompleteImages() preloadCompleteImages()
}, []) }, [])
......
import { action, Action, computed, Computed, Thunk, thunk } from 'easy-peasy' import { action, Action, computed, Computed, Thunk, thunk } from 'easy-peasy'
import { AppStoreModel } from '@/store/store-model' import { AppStoreModel } from '@/store/store-model'
import { getQuestionList, type StageDetail, getStageDetail, completeStage, StageType, type CompleteStageOut, resumeGame } from '@/api' import { getQuestionList, type StageDetail, getStageDetail, completeStage, StageType, type CompleteStageOut, resumeGame } from '@/api'
import { showLoading, hideLoading, showModal, redirectTo, vibrateShort, getCurrentInstance } from '@tarojs/taro' import { showLoading, hideLoading, showModal, redirectTo, vibrateShort, getCurrentInstance, disableAlertBeforeUnload } from '@tarojs/taro'
import assets from '@/assets/oss/assets-complete' import assets from '@/assets/oss/assets-complete'
import { palyAudio } from '@/utils/play-audio' import { palyAudio } from '@/utils/play-audio'
import audio from '@/assets/oss/assets-audio' import audio from '@/assets/oss/assets-audio'
...@@ -298,6 +298,7 @@ const gameModel: GameModel = { ...@@ -298,6 +298,7 @@ const gameModel: GameModel = {
mask: true, mask: true,
title: '提交中' title: '提交中'
}) })
disableAlertBeforeUnload()
actions.updateState({ isSubmit: true }) actions.updateState({ isSubmit: true })
stopCounter() stopCounter()
const { questionList, stageDetail } = helpers.getState() const { questionList, stageDetail } = helpers.getState()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment