Commit 39726ce6 authored by hewenhao's avatar hewenhao

feat: update

parent e88426fd
.contentWrap {
border-radius: 16px;
position: absolute;
z-index: 9999998;
opacity: 1;
box-shadow: rgb(33 33 33 / 50%) 0px 0px 0px 5000PX;
box-shadow: rgba(0,0,0, .6) 0px 0px 0px 5000PX;
}
.content {
......
import { View, type ViewProps, RootPortal } from '@tarojs/components'
import { type PropsWithChildren, useState, useMemo, useRef, useEffect, type ReactNode } from 'react'
import { View, RootPortal } from '@tarojs/components'
import { useState, useMemo, useRef, useEffect, type ReactNode, type ComponentType } from 'react'
import { createSelectorQuery, usePageScroll } from '@tarojs/taro'
import classNames from 'classnames'
import styles from './index.module.scss'
type UserGuideProps = {
type GetProps<T> = T extends ComponentType<infer P> ? P : {}
type UserGuideProps<T extends ComponentType<any>> = {
onFinish?: () => void;
isActive?: boolean;
compnent?: T;
onClickConent?: () => void;
verticalPadding?: number;
horizonPadding?: number;
guideContent?: ReactNode;
}
wrapClass?: string;
} & GetProps<T>
const UserGuideView = (props: PropsWithChildren<UserGuideProps & ViewProps>) => {
const { isActive, children, guideContent, verticalPadding = 0, horizonPadding = 0, onClickConent, ...rest } = props
function UserGuideView<T extends ComponentType<any> = typeof View> (props: UserGuideProps<T>) {
const { isActive, wrapClass, guideContent, verticalPadding = 0, horizonPadding = 0, onFinish, onClickConent, compnent: Comp = View, ...rest } = props
const [rect, setRect] = useState({ width: 80, height: 80, top: 0, left: 0 })
const [_isActive, setIsActive] = useState(false)
const scrollRef = useRef(0)
......@@ -53,12 +58,10 @@ const UserGuideView = (props: PropsWithChildren<UserGuideProps & ViewProps>) =>
return (
<>
<View {...rest} ref={domRef}>
{children}
</View>
<Comp {...(rest as GetProps<T>)} ref={domRef} />
{_isActive && (
<RootPortal>
<View className={styles.contentWrap} catchMove style={style}>
<View className={classNames(styles.contentWrap, wrapClass)} catchMove style={style}>
<View className={styles.content} onClick={onClickConent}>
</View>
{guideContent}
......
import { View } from '@tarojs/components'
import styles from './index.module.scss'
const Wrong = () => {
return (
<View>123123</View>
)
}
export default Wrong
......@@ -7,6 +7,11 @@
}
}
.guide_wrap {
border-radius: 50%;
border: 2px dashed #fff;
}
.clear {
position: relative;
......
import { View, Image } from '@tarojs/components'
import { View, Image, ViewProps } from '@tarojs/components'
import assets from '@/assets/oss/assets-round'
import classNames from 'classnames'
import { cs } from '@/styles'
......@@ -118,7 +118,18 @@ const StageComp = (props: StageProps) => {
case StageStatus.CURRENT: {
return (
<Image src={getUnlockedIcon(stage.type).u} className={getIconClassNames(stage.type)} />
<UserGuideView
src={getUnlockedIcon(stage.type).u}
compnent={Image}
className={getIconClassNames(stage.type)}
isActive={stage.status === StageStatus.CURRENT}
verticalPadding={4}
horizonPadding={4}
wrapClass={styles.guide_wrap}
guideContent={(
<View style={{ color: '#ffffff' }}>123123123234234234sdfsdf sdfsdfsdf sdf sdf sdf sdf sdfsd fsd </View>
)}
></UserGuideView>
)
}
......@@ -155,21 +166,15 @@ const StageComp = (props: StageProps) => {
}
return (
<UserGuideView
<View
className={classNames(props.className, cs.bounce_btn)}
hoverClass={cs.bounce_btn_hover}
id={stage.status === StageStatus.CURRENT ? CurrentRoundId : undefined}
onClick={handleClick}
isActive={stage.status === StageStatus.CURRENT}
verticalPadding={15}
horizonPadding={15}
guideContent={(
<View style={{ color: '#ffffff' }}>123123123234234234sdfsdf sdfsdfsdf sdf sdf sdf sdf sdfsd fsd </View>
)}
>
{renderRound(isReady)}
<View className={styles.roundName}>{stage.name}</View>
</UserGuideView>
</View>
)
}
......
......@@ -43,24 +43,24 @@
padding: 28px;
}
.modal_2 {
position: absolute;
top: -260px;
width: 500px;
height: 260px;
background-image: url(https://cdn.jkwljy.com/pk-math/2tGxMZeki8g2zJdm36HkhuqnvpMS/500x260);
background-size: 100% 100%;
box-sizing: border-box;
padding: 32px 28px;
}
// .modal_2 {
// position: absolute;
// top: -260px;
// width: 500px;
// height: 260px;
// background-image: url(https://cdn.jkwljy.com/pk-math/2tGxMZeki8g2zJdm36HkhuqnvpMS/500x260);
// background-size: 100% 100%;
// box-sizing: border-box;
// padding: 32px 28px;
// }
.modal_1 {
position: absolute;
top: -180px;
width: 500px;
height: 180px;
background-image: url(https://cdn.jkwljy.com/pk-math/eFWwoxVC4mzX1hZZojv23VEh9hz/500x180);
background-size: 100% 100%;
box-sizing: border-box;
padding: 48px 28px;
}
// .modal_1 {
// position: absolute;
// top: -180px;
// width: 500px;
// height: 180px;
// background-image: url(https://cdn.jkwljy.com/pk-math/eFWwoxVC4mzX1hZZojv23VEh9hz/500x180);
// background-size: 100% 100%;
// box-sizing: border-box;
// padding: 48px 28px;
// }
......@@ -9,23 +9,22 @@ import styles from './scene-1.module.scss'
const Text1 = [
{ text: '嗨,' },
{ text: '你好!' },
{ text: '我是高斯。' },
{ text: '我是帮助很多同学们爱上数学的阿喵老师。' },
]
const Text2 = [
{ text: '别看我是一只猫,' },
{ text: '我可是一名远近闻名的数学大师呢。' },
]
// text="我已经帮助很多同学,喜欢上数学,提升数学能力了。"
const Text3 = [
{ text: '我已经帮助很多同学' },
{ text: '喜欢上数学,' },
{ text: '提升数学能力了。' },
]
// const Text2 = [
// { text: '别看我是一只猫,' },
// { text: '我可是一名远近闻名的数学大师呢。' },
// ]
// // text="我已经帮助很多同学,喜欢上数学,提升数学能力了。"
// const Text3 = [
// { text: '我已经帮助很多同学' },
// { text: '喜欢上数学,' },
// { text: '提升数学能力了。' },
// ]
// text="在开始前,我可以问几个问题互相了解一下吗?"
const Text4 = [
const Text2 = [
{ text: '在开始前,' },
{ text: '我可以问几个问题,' },
{ text: '互相了解一下吗?' },
......@@ -59,13 +58,13 @@ const Scene1 = ({ onNext }: Scene1Props) => {
handleEnd(1)
}, [handleEnd])
const fn2 = useCallback(() => {
handleEnd(2)
}, [handleEnd])
// const fn2 = useCallback(() => {
// handleEnd(2)
// }, [handleEnd])
const fn3 = useCallback(() => {
handleEnd(3)
}, [handleEnd])
// const fn3 = useCallback(() => {
// handleEnd(3)
// }, [handleEnd])
return (
<View className={cs.viewport}>
......@@ -80,11 +79,11 @@ const Scene1 = ({ onNext }: Scene1Props) => {
</View>
<View className={styles.dialog}>
{current === 0 && (
<View className={styles.modal_1}>
<View className={styles.modal_3}>
<TextPrinter textList={Text1} onEnd={fn1}></TextPrinter>
</View>
)}
{current === 1 && (
{/* {current === 1 && (
<View className={styles.modal_2}>
<TextPrinter textList={Text2} onEnd={fn2} />
</View>
......@@ -96,11 +95,11 @@ const Scene1 = ({ onNext }: Scene1Props) => {
onEnd={fn3}
/>
</View>
)}
{current === 3 && (
)} */}
{current === 1 && (
<View className={styles.modal_3}>
<TextPrinter
textList={Text4}
textList={Text2}
onEnd={fn}
/>
</View>
......
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