Commit 081fab9a authored by hewenhao's avatar hewenhao

feat: 全通关后pk引导不出现修复

parent ba9c5ef9
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"miniprogramRoot": "dist/", "miniprogramRoot": "dist/",
"projectname": "GeekLearnMathWeapp", "projectname": "GeekLearnMathWeapp",
"description": "", "description": "",
"appid": "wx8f25def587982a19", "appid": "wx693fe3460124d84b",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"es6": false, "es6": false,
......
...@@ -13,7 +13,7 @@ import BattlesModal from '@/pages/battles/components/battles-modal' ...@@ -13,7 +13,7 @@ import BattlesModal from '@/pages/battles/components/battles-modal'
import Tutorial from '../components/tutorial' import Tutorial from '../components/tutorial'
import type { TabbarRef } from '../../../custom-tab-bar/index' import type { TabbarRef } from '../../../custom-tab-bar/index'
import { CurrentRoundId, StageStatus } from '../components/scene/constants' import { CurrentRoundId, StageStatus, LastPassedStageId } from './scene/constants'
import MainHeader from './header' import MainHeader from './header'
import MainScene from './scene' import MainScene from './scene'
import MainShortCut from '../components/short-cut' import MainShortCut from '../components/short-cut'
...@@ -94,11 +94,20 @@ const MainPage = () => { ...@@ -94,11 +94,20 @@ const MainPage = () => {
} }
}, [player, isFocus]) }, [player, isFocus])
const scrollToLastPassed = useCallback(() => {
const height = getSystemInfoSync().windowHeight
pageScrollTo({
selector: `#${LastPassedStageId}`,
offsetTop: -height / 2,
complete: () => {}
})
}, [])
useEffect(() => { useEffect(() => {
if (showPkGuideFromHis) { if (showPkGuideFromHis) {
scrollToCurrent() scrollToLastPassed()
} }
}, [showPkGuideFromHis, scrollToCurrent]) }, [showPkGuideFromHis, scrollToLastPassed])
useEffect(() => { useEffect(() => {
if (isFocus && userInfo.city && userInfo.grade) { if (isFocus && userInfo.city && userInfo.grade) {
......
...@@ -26,6 +26,7 @@ export { StageStatus, StageLevel, Stage, StageType } ...@@ -26,6 +26,7 @@ export { StageStatus, StageLevel, Stage, StageType }
const isProduction = process.env.SERVER_ENDPOINT === 'https://geek.jkwljy.com' const isProduction = process.env.SERVER_ENDPOINT === 'https://geek.jkwljy.com'
export const CurrentRoundId = '__current_round__' export const CurrentRoundId = '__current_round__'
export const LastPassedStageId = '__last_pass__'
export type PartHead = { export type PartHead = {
partIndex: number; partIndex: number;
...@@ -58,8 +59,11 @@ function stageToStageNext (stageList: Stage[]): {nextList: StageNext[]; showList ...@@ -58,8 +59,11 @@ function stageToStageNext (stageList: Stage[]): {nextList: StageNext[]; showList
showList = newList.slice(0, Math.max(currentIndex + 3, 5)) showList = newList.slice(0, Math.max(currentIndex + 3, 5))
} }
/** 设置pk历史页面返回后引导 */ /** 设置pk历史页面返回后引导 */
if (currentIndex !== -1) {
let current = currentIndex let current = currentIndex
if (currentIndex === -1) {
current = newList.length - 1
}
while (current >= 0) { while (current >= 0) {
const currentItem = showList[current] const currentItem = showList[current]
if (currentItem && currentItem.status === StageStatus.PASSED && currentItem.type !== StageType.Special) { if (currentItem && currentItem.status === StageStatus.PASSED && currentItem.type !== StageType.Special) {
...@@ -69,7 +73,6 @@ function stageToStageNext (stageList: Stage[]): {nextList: StageNext[]; showList ...@@ -69,7 +73,6 @@ function stageToStageNext (stageList: Stage[]): {nextList: StageNext[]; showList
current -= 1 current -= 1
} }
}
let currentPart let currentPart
let index = -1 let index = -1
......
...@@ -11,7 +11,7 @@ import { UserGuideView } from '@/components' ...@@ -11,7 +11,7 @@ import { UserGuideView } from '@/components'
import tutorial from '@/assets/oss/assets-tutorial' import tutorial from '@/assets/oss/assets-tutorial'
import assetsGuide from '@/assets/oss/assets-guide' import assetsGuide from '@/assets/oss/assets-guide'
import assetsMainNext from '@/assets/oss/assets-main-next' import assetsMainNext from '@/assets/oss/assets-main-next'
import { type Stage, StageType, StageStatus, StageLevel, CurrentRoundId } from './constants' import { type Stage, StageType, StageStatus, StageLevel, CurrentRoundId, LastPassedStageId } from './constants'
import StageTag from './stage-tag' import StageTag from './stage-tag'
import styles from './stage.module.scss' import styles from './stage.module.scss'
...@@ -286,11 +286,21 @@ const StageComp = (props: StageProps) => { ...@@ -286,11 +286,21 @@ const StageComp = (props: StageProps) => {
) )
} }
const stageId = useMemo(() => {
if (stage.status === StageStatus.CURRENT) {
return CurrentRoundId
}
if (stage.$lastPassedStage) {
return LastPassedStageId
}
return undefined
}, [stage])
return ( return (
<View <View
className={classNames(props.className, cs.bounce_btn)} className={classNames(props.className, cs.bounce_btn)}
hoverClass={cs.bounce_btn_hover} hoverClass={cs.bounce_btn_hover}
id={stage.status === StageStatus.CURRENT ? CurrentRoundId : undefined} id={stageId}
onClick={handleClick} onClick={handleClick}
data-name={`关卡-${stage.id}`} data-name={`关卡-${stage.id}`}
onLongPress={!isPkGuideShow ? handleLongPress : undefined} onLongPress={!isPkGuideShow ? handleLongPress : undefined}
......
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