Commit 081fab9a authored by hewenhao's avatar hewenhao

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

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