Commit adedecb8 authored by hewenhao's avatar hewenhao

feat: update

parent c5bdbe7b
...@@ -30,14 +30,22 @@ ...@@ -30,14 +30,22 @@
} }
.bg { .bg {
width: 100%;
height: 100%; height: 100%;
width: calc(100% + 48px);
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
z-index: 1; z-index: 1;
&.left {
right: -48px;
}
&.right {
left: -48px;
}
} }
.icon { .icon {
......
import { useState, useImperativeHandle, forwardRef, useCallback, type ForwardRefRenderFunction } from 'react' import { useState, useImperativeHandle, forwardRef, useCallback, type ForwardRefRenderFunction } from 'react'
import { View, Image } from '@tarojs/components' import { View, Image } from '@tarojs/components'
import { switchTab } from '@tarojs/taro' import { switchTab } from '@tarojs/taro'
import classNames from 'classnames'
import styles from './index.module.scss' import styles from './index.module.scss'
type TabbarRef = { type TabbarRef = {
...@@ -28,13 +29,13 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => { ...@@ -28,13 +29,13 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => {
<View className={styles.inner}> <View className={styles.inner}>
<View className={styles.left} onClick={() => _switchTab(0, '/pages/main/main')}> <View className={styles.left} onClick={() => _switchTab(0, '/pages/main/main')}>
{selected === 0 && ( {selected === 0 && (
<Image src="/assets/tabbar/personal-bg.png" className={styles.bg}></Image> <Image src="/assets/tabbar/personal-bg.png" className={classNames(styles.bg, styles.left)}></Image>
)} )}
<Image src="/assets/tabbar/personal-on.png" className={styles.icon} /> <Image src="/assets/tabbar/personal-on.png" className={styles.icon} />
</View> </View>
<View className={styles.right} onClick={() => _switchTab(1, '/pages/group/index')}> <View className={styles.right} onClick={() => _switchTab(1, '/pages/group/index')}>
{selected === 1 && ( {selected === 1 && (
<Image src="/assets/tabbar/group-bg.png" className={styles.bg}></Image> <Image src="/assets/tabbar/group-bg.png" className={classNames(styles.bg, styles.right)}></Image>
)} )}
<Image src="/assets/tabbar/group-on.png" className={styles.icon} /> <Image src="/assets/tabbar/group-on.png" className={styles.icon} />
</View> </View>
......
...@@ -6,8 +6,10 @@ ...@@ -6,8 +6,10 @@
color: #FFFFFF; color: #FFFFFF;
display: flex; display: flex;
align-items: center; align-items: center;
width: 750px;
box-sizing: border-box; box-sizing: border-box;
position: relative;
z-index: 1;
box-shadow: 0 1px 14px rgba(0, 81, 231, 0.1);
} }
.chapterContent { .chapterContent {
......
...@@ -54,12 +54,12 @@ export function stageToParts (stageList: Stage[]): Part[] { ...@@ -54,12 +54,12 @@ export function stageToParts (stageList: Stage[]): Part[] {
const ret: Part[] = [] const ret: Part[] = []
stageList.forEach(item => { stageList.forEach(item => {
const last = ret.find(c => c.number === (item.part || 0)) const last = ret.find(c => c.number === (item.part ?? 1) - 1)
if (last) { if (last) {
last.stages.push(item) last.stages.push(item)
} else { } else {
ret.push({ ret.push({
number: item.part ?? 0, number: (item.part ?? 1) - 1,
stages: [item] stages: [item]
}) })
} }
......
...@@ -3,7 +3,8 @@ import assets from '@/assets/oss/assets-main' ...@@ -3,7 +3,8 @@ import assets from '@/assets/oss/assets-main'
import { useEffect, useState, useRef } from 'react' import { useEffect, useState, useRef } from 'react'
import { usePageScroll, createIntersectionObserver } from '@tarojs/taro' import { usePageScroll, createIntersectionObserver } from '@tarojs/taro'
import classNames from 'classnames' import classNames from 'classnames'
import { CurrentRoundId } from './scene/constants' import { useStoreState } from '@/store/hooks'
import { CurrentRoundId, StageStatus } from './scene/constants'
import styles from './short-cut.module.scss' import styles from './short-cut.module.scss'
...@@ -16,12 +17,16 @@ const ShortCut = (props: ShortCutProps) => { ...@@ -16,12 +17,16 @@ const ShortCut = (props: ShortCutProps) => {
const [isDown, setIsDown] = useState(false) const [isDown, setIsDown] = useState(false)
const scrollRef = useRef(0) const scrollRef = useRef(0)
const lastEffectedScroll = useRef(0) const lastEffectedScroll = useRef(0)
const stageList = useStoreState(state => state.mainModel.stageList)
usePageScroll((payload) => { usePageScroll((payload) => {
scrollRef.current = payload.scrollTop scrollRef.current = payload.scrollTop
}) })
useEffect(() => { useEffect(() => {
if (!stageList.some(c => c.status === StageStatus.CURRENT)) {
return
}
lastEffectedScroll.current = scrollRef.current lastEffectedScroll.current = scrollRef.current
// @ts-ignore // @ts-ignore
let observer = createIntersectionObserver() let observer = createIntersectionObserver()
...@@ -42,7 +47,7 @@ const ShortCut = (props: ShortCutProps) => { ...@@ -42,7 +47,7 @@ const ShortCut = (props: ShortCutProps) => {
observer = null! observer = null!
} }
} }
}, []) }, [stageList])
return ( return (
<View className={styles.shortcut}> <View className={styles.shortcut}>
......
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