Commit e2208652 authored by hewenhao's avatar hewenhao

Merge branch 'feature/2023-04-19-iter' into 'master'

Feature/2023 04 19 iter See merge request hewenhao/GeekLearnMathWeapp!3
parents 2b89e214 f564bd79
......@@ -26,7 +26,10 @@ declare namespace JSX{
'count-up-time': CountUpTime;
'number-keyboard': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
onType?: (a: { detail: string }) => void;
}, HTMLElement>
}, HTMLElement>;
'game-rank': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
list: any[]
}, HTMLElement>;
}
}
......
{
"name": "learn-math-weapp",
"version": "1.0.9",
"version": "1.0.15",
"private": true,
"description": "",
"scripts": {
......
......@@ -2,7 +2,7 @@
"miniprogramRoot": "dist/",
"projectname": "GeekLearnMathWeapp",
"description": "",
"appid": "wx693fe3460124d84b",
"appid": "wx8f25def587982a19",
"setting": {
"urlCheck": false,
"es6": false,
......
......@@ -11,6 +11,7 @@ type UserGuideProps<T extends ComponentType<any>> = {
onFinish?: () => void;
isActive?: boolean;
compnent?: T;
guideViewId?: string;
onClickConent?: () => void;
verticalPadding?: number;
horizonPadding?: number;
......@@ -19,7 +20,7 @@ type UserGuideProps<T extends ComponentType<any>> = {
} & GetProps<T>
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 { isActive, wrapClass, guideViewId, 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)
......@@ -63,7 +64,7 @@ function UserGuideView<T extends ComponentType<any> = typeof View> (props: UserG
{_isActive && (
<RootPortal>
<View className={classNames(styles.contentWrap, wrapClass)} catchMove style={style}>
<View className={styles.content} onClick={onClickConent}>
<View className={styles.content} onClick={onClickConent} id={guideViewId}>
</View>
{guideContent}
</View>
......
......@@ -50,13 +50,13 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => {
<>
<View className={classNames(styles.wrap, isEyeProtectionMode && styles.eye_protection)}>
<View className={styles.inner}>
<View className={styles.left} onClick={() => _switchTab(0, '/pages/main/main')}>
<View className={styles.left} onClick={() => _switchTab(0, '/pages/main/main')} id="app_tab_1">
{selected === 0 && (
<Image src="/assets/tabbar/personal-bg.png" className={classNames(styles.bg, styles.left)}></Image>
)}
<Image src="/assets/tabbar/personal-on.png" className={styles.icon} />
</View>
<View className={styles.right} onClick={() => _switchTab(1, '/pages/group/index')}>
<View className={styles.right} onClick={() => _switchTab(1, '/pages/group/index')} id="app_tab_2">
{selected === 1 && (
<Image src="/assets/tabbar/group-bg.png" className={classNames(styles.bg, styles.right)}></Image>
)}
......@@ -64,7 +64,7 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => {
<Image src="/assets/tabbar/group-on.png" className={classNames(styles.icon, { [styles.hasPoint]: hasPoint })}>
</Image>
{isActiveGuide && (
<View className={styles.guide_content} onClick={handleClickGuide}>
<View className={styles.guide_content} onClick={handleClickGuide} id="app_tab_2_guide">
<Image src={tutorialAssets['guide-arrow-2.png'].u} className={styles.guide_arrow}></Image>
</View>
)}
......
@import '@/styles/mixins.scss';
.thead {
height: 40PX;
background: #F7F9FC;
display: flex;
align-items: center;
font-size: 12PX;
padding: 0 32px;
color: rgba(70,81,100,0.5);
&_index {
width: 80px;
text-align: center;
padding-left: 3PX;
margin-right: 23PX;
}
&_username {
flex: 1;
}
&_result {
display: flex;
align-items: center;
font-size: 12PX;
font-weight: 400;
gap: 6PX;
color: rgba(70,81,100,0.7);
&_best {
font-size: 32px;
font-weight: 600;
color: #FE9B45;
}
}
}
.empty {
color: #9999;
font-size: 14PX;
margin: 24PX 0;
text-align: center;
}
.spinWrap {
color: #9999;
padding: 12PX 0;
text-align: center;
}
.item {
display: flex;
padding: 30px 32px;
align-items: center;
&.active {
background-color: #E4F1FF;
}
&_rank {
margin-right: 20px;
@include flexLayout(row, center);
&_icon {
width: 80px;
height: 80px;
margin: -17px 0;
display: block;
}
&_index {
display: block;
text-align: center;
width: 80px;
font-size: 36px;
font-weight: 500;
color: rgba(70,81,100,0.5);
}
}
&_username {
display: flex;
flex: 1;
align-items: center;
padding-right: 4PX;
&_text {
font-size: 14PX;
font-weight: 600;
color: #465164;
}
&_crown {
width: 36px;
height: 36px;
position: relative;
top: -1PX;
}
}
&_result {
@include flexLayout(row, center, center);
font-size: 12PX;
font-weight: 400;
gap: 6PX;
color: rgba(70,81,100,0.7);
&_best {
font-size: 32px;
font-weight: 600;
color: #FE9B45;
}
}
}
.spin {
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.spinIcon {
border: 4px solid #1786F7;
border-top-color: inherit;
border-radius: 50%;
animation: spin 1s linear infinite;
width: 18PX;
height: 18PX;
}
.spinText {
font-size: 14PX;
margin-left: 12PX;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
import assets from '@/assets/oss/assets-group'
import styles from './index.module.scss'
const PageSize = 10
// @ts-ignore
Component({
properties: {
list: {
type: Array,
value: []
}
},
data: {
styles,
assets,
realList: [],
me: null,
loading: false
},
attached () {
this._hasNextPage = true
this._loading = false
this._currentPage = 0
this.loadMore()
const me = this.data.list?.find(c => c.me)
if (me && me.no > 3) {
this.setData({
me
})
}
},
methods: {
async loadMore () {
if (this._loading || !this._hasNextPage) return
this._loading = true
this.setData({ loading: true })
await new Promise(resolve => setTimeout(resolve, 300))
const { list } = this.data
const currentPage = this._currentPage
const nextPage = currentPage + 1
let max = nextPage * PageSize
let hasNextPage = true
if (max >= list.length) {
max = list.length
hasNextPage = false
}
const start = currentPage * PageSize
const newList = list.slice(start, max)
const opts = {} as any
newList.forEach((item, index) => {
opts[`realList[${index + start}]`] = item
})
opts.loading = false
this.setData(opts, () => {
this._loading = false
this._currentPage = nextPage
this._hasNextPage = hasNextPage
})
}
}
})
<template name="rankItem">
<view class="{{styles.item}} {{ item.me ? styles.active : '' }}">
<view class="{{styles.item_rank}}">
<image
wx:if="{{item.no === 1}}"
class="{{styles.item_rank_icon}}"
src="{{assets['rank-1.png'].u}}"
/>
<image
wx:elif="{{item.no === 2}}"
class="{{styles.item_rank_icon}}"
src="{{assets['rank-2.png'].u}}"
/>
<image
wx:elif="{{item.no === 3}}"
class="{{styles.item_rank_icon}}"
src="{{assets['rank-3.png'].u}}"
/>
<text wx:else class="{{styles.item_rank_index}}">{{item.no}}</text>
</view>
<view class="{{styles.item_username}}">
<view class="{{styles.item_username_text}}">
{{item.nickName || '-'}} <text wx:if="{{item.me}}">(你)</text>
</view>
<image
wx:if="{{item.identity === 'LEADER'}}"
class="{{styles.item_username_crown}}"
src="{{assets['crown-small.png'].u}}"
/>
</view>
<view class="{{styles.item_result}}">
<text class="{{styles.item_result_first}}">{{utils.format(item.firstResultTime)}}秒</text>
<text>|</text>
<text class="{{styles.item_result_best}}">{{utils.format(item.bestResultTime)}}秒</text>
</view>
</view>
</template>
<view class="{{styles.thead}}">
<text class="{{styles.thead_index}}">名次</text>
<text class="{{styles.thead_username}}">用户名</text>
<view class="{{styles.thead_result}}">
<text class="{{styles.thead_result_first}}">首次</text>
<text>|</text>
<text class="{{styles.thead_result_best}}">最佳</text>
</view>
</view>
<template is="rankItem" wx:if="{{me}}" data="{{ styles, item: me, assets }}"/>
<block wx:for="{{ realList }}" wx:key="userId">
<template is="rankItem" data="{{ styles, item, assets }}"/>
</block>
<view class="{{styles.spinWrap}}" wx:if="{{loading}}">
<view class="{{styles.spin}}">
<view class="{{styles.spinIcon}}"></view><View class="{{styles.spinText}}">加载中</View>
</view>
</view>
<view class="{{styles.empty}}" wx:if="{{list.length < 1}}">暂无数据</view>
<wxs module="utils">
module.exports = {
format : function (val) {
if (typeof val === 'number') {
return val.toFixed(1)
}
return '-'
},
}
</wxs>
......@@ -84,6 +84,7 @@ const GameCompleteAchieve = () => {
className={styles.btn_continue}
hoverClass={styles.is_active}
onClick={handleContinue}
id="game_complete_continue"
>
继续
</View>
......
......@@ -207,6 +207,7 @@ const GameCompleteHead = () => {
<UserGuideView
className={styles.item}
onClick={goWrong}
id="err_question"
isActive={isActive}
compnent={View}
wrapClass={styles.content_wrap}
......@@ -217,7 +218,7 @@ const GameCompleteHead = () => {
<View className={styles.guide}>
<View className={styles.guide_inner}>
<Image src={tutorialAssets['cat.png'].u} className={styles.guide_icon}></Image>
<View className={styles.guide_modal} onClick={completeGuide}>
<View className={styles.guide_modal} onClick={completeGuide} id="err_question_guide">
<View>
点击此处,可以查看<Text className={styles.em}>本次闯关的错题</Text>哦~
</View>
......
......@@ -51,6 +51,7 @@ const ModalContinue = () => {
className={styles.btn_left}
hoverClass={styles.is_active}
onClick={() => submit()}
id="fail_game_give_up"
>
放弃
</View>
......@@ -58,6 +59,7 @@ const ModalContinue = () => {
className={classNames(styles.btn_right, !canGoNext && styles.disabled)}
hoverClass={canGoNext ? styles.is_active : null}
onClick={handleReborn}
id="fail_game_reborn"
>
<Image src={require('@/pages/main/assets/ph.png')} className={styles.icon}></Image>
<Text>-1 继续</Text>
......
import { View, Image, CustomWrapper } from '@tarojs/components'
import { useMemo } from 'react'
import classNames from 'classnames'
import styles from './page-footer.module.scss'
......@@ -22,6 +21,7 @@ const PageFooter = (props: PageFooterProps) => {
<View
className={styles.btn_left}
hoverClass={styles.is_active}
id="question_clear_btn"
onClick={() => clearUserAnswer()}
>
<Image src={require('../assets/btn-clear-icon.png')} className={styles.icon}></Image>
......@@ -31,6 +31,7 @@ const PageFooter = (props: PageFooterProps) => {
className={classNames(styles.btn_right, !canGoNext && styles.disabled)}
hoverClass={canGoNext ? styles.is_active : null}
onClick={() => handleGoNext()}
id="question_continue_btn"
>{isLastQuestion ? confirmText : '下一题'}</View>
</View>
</View>
......
......@@ -30,12 +30,10 @@ const GuideModal = () => {
<View>部落PK大赛</View>
</View>
</View>
<View className={classNames(styles.dialog)} onClick={() => completeGroupGuide()}>
<View className={classNames(styles.dialog)} onClick={() => completeGroupGuide()} id="complete_group_guide">
<View>
让我们先从基本功开始。已经为你准备好了打好基本功所必须掌握的
<Text className={styles.em}>计算达标</Text>、
<Text className={styles.em}>常考的应用题</Text>、
以及<Text className={styles.em}>附加思维题</Text>哦。
除此之外,每个部落还有专属排行榜,后续还会有【部落PK大赛】等活动。
<Text className={styles.em}>期待你带领你的部落一起成长,获得更多奖励!</Text>
</View>
<View className={styles.continue}>
<View className={styles.continue_btn}>
......
......@@ -38,11 +38,11 @@ const TopHeader = () => {
<View className={styles.avatar}>
<Text className={styles.name}>{userInfo?.nickName ?? ''}</Text>
</View>
<View className={styles.score} onClick={goStore}>
<View className={styles.score} onClick={goStore} id="group_header_score">
<Image src={require('@/pages/main/assets/score.png')} className={styles.icon} />
<Text>{point}</Text>
</View>
<View className={styles.ph} onClick={goStore}>
<View className={styles.ph} onClick={goStore} id="group_header_ph">
<Image src={require('@/pages/main/assets/ph.png')} className={styles.icon} />
<Text>{cardNum}</Text>
</View>
......
......@@ -148,7 +148,7 @@ const Group = () => {
<Modal isVisible={isVisible} tilte="学习部落名" onClose={setFalse}>
<View className={styles.modal}>
<View className={styles.modal_body} onClick={_genGroundNo}>
<View className={styles.modal_body} onClick={_genGroundNo} id="group_gen_name">
<Input className={styles.modal_input} disabled value={groupNo} />
<Image className={styles.modal_refresh} mode="widthFix" src={assets['refresh.png'].u} />
</View>
......
......@@ -43,11 +43,11 @@ const MainHeader = () => {
<View className={styles.avatar}>
<Text className={styles.name}>{userInfo?.nickName ?? ''}</Text>
</View>
<View className={classNames(styles.score, cs.bounce_btn)} onClick={goStore} hoverClass={cs.bounce_btn_hover}>
<View className={classNames(styles.score, cs.bounce_btn)} onClick={goStore} hoverClass={cs.bounce_btn_hover} id="main_header_score">
<Image src={require('../assets/score.png')} className={styles.icon} />
<Text>{point}</Text>
</View>
<View className={classNames(styles.ph, cs.bounce_btn)} onClick={goStore} hoverClass={cs.bounce_btn_hover}>
<View className={classNames(styles.ph, cs.bounce_btn)} onClick={goStore} hoverClass={cs.bounce_btn_hover} id="main_header_ph">
<Image src={require('../assets/ph.png')} className={styles.icon} />
<Text>{cardNum}</Text>
</View>
......
......@@ -146,6 +146,7 @@ const StageComp = (props: StageProps) => {
horizonPadding={0}
wrapClass={styles.guide_wrap}
onClickConent={handleCompleteGuide}
guideViewId="firt_stage_guide"
guideContent={(
<View className={styles.tutorial}>
<Image src={tutorial['arrow.png'].u} className={styles.tutorial_arrow}></Image>
......
......@@ -170,8 +170,12 @@ export default function ShareModal () {
</View>
<View className={styles.footer}>
<Text className={styles.cancel} onClick={handleCancel}>暂不加入</Text>
<Text className={styles.confirm} onClick={() => run({ groupId: detail.groupId!, shareUserId: detail.shareUserId! })}>
<Text className={styles.cancel} onClick={handleCancel} id="join_group_cancel">暂不加入</Text>
<Text
className={styles.confirm}
onClick={() => run({ groupId: detail.groupId!, shareUserId: detail.shareUserId! })}
id="join_group_confirm"
>
确定加入
</Text>
</View>
......
......@@ -49,7 +49,7 @@ const ShortCut = (props: ShortCutProps) => {
return (
<EyeProtectionView className={styles.shortcut}>
<View className={classNames(styles.shortcutInner, isHide && styles.is_hide)} onClick={props.onClick}>
<View className={classNames(styles.shortcutInner, isHide && styles.is_hide)} onClick={props.onClick} id="main_shortcut">
<Image src={assets['short-cut-bg.png'].u} className={styles.bg}></Image>
<Image src={assets['short-cut-arrow.png'].u} className={classNames(styles.arrow, ((!isHide && isDown) || (isHide && !isDown)) && styles.isDown)}></Image>
</View>
......
......@@ -46,6 +46,7 @@ const ModalArea = (props: ModalAreaProps) => {
className={classNames(styles.btn, !current && styles.disabled)}
onClick={handleConfirm}
loading={loading}
id="main_confirm_area"
hoverClass={styles.btn_on}
>继续</Button>
</View>
......
......@@ -46,6 +46,7 @@ const ModalGrade = (props: ModalGradeProps) => {
loading={loading}
className={classNames(styles.btn, !current && styles.disabled)}
onClick={handleConfirm}
id="main_confirm_grade"
hoverClass={styles.btn_on}
>继续</Button>
</View>
......
......@@ -16,7 +16,7 @@ const ModalGroupGuide = (props: ModalGroupGuideProps) => {
<View className={styles.result_wrap} catchMove>
<Image src={tutorialAssets['cat.png'].u} className={styles.result_cat} />
<View className={styles.result_main}>
<View className={classNames(styles.dialog)} onClick={() => onConfirm()}>
<View className={classNames(styles.dialog)} onClick={() => onConfirm()} id="group_guide_1">
<View>
阿喵老师很高兴看到你在不断进步,接下来我要传授你一个
<Text className={styles.em}>得到大量水晶的好方法</Text>。
......
......@@ -57,7 +57,7 @@ const ModalResult = (props: ModalResultProps) => {
<View className={styles.result_wrap} catchMove>
<Image src={tutorialAssets['cat.png'].u} className={styles.result_cat} />
<View className={styles.result_main}>
<View className={classNames(styles.dialog, isLevel1 && styles.is_lower)} onClick={() => onConfirm()}>
<View className={classNames(styles.dialog, isLevel1 && styles.is_lower)} onClick={() => onConfirm()} id="main_confirm_info_result">
{renderContent()}
<View className={styles.continue}>
<View className={styles.continue_btn}>
......
......@@ -54,12 +54,12 @@ const Guide = (props: GuideProps) => {
return [
<Scene1 onNext={() => setStep(1)} key={1} />,
<Scene2 spriteTop={spriteTop} isCurrent={step === 1} onNext={() => setStep(2)} key={2} />,
<Scene3 spriteTop={spriteTop} isCurrent={step === 2} onNext={(val: number) => { setStep(3); setTime(val) }} key={3} />,
<Scene4 spriteTop={spriteTop} isCurrent={step === 3} onNext={() => setStep(4)} time={time} key={4} />,
<Scene5 spriteTop={spriteTop} isCurrent={step === 4} onNext={() => setStep(5)} key={5} />,
<Scene6 spriteTop={spriteTop} onNext={onDone} key={6} />
// <Scene3 spriteTop={spriteTop} isCurrent={step === 2} onNext={(val: number) => { setStep(3); setTime(val) }} key={3} />,
// <Scene4 spriteTop={spriteTop} isCurrent={step === 3} onNext={() => setStep(4)} time={time} key={4} />,
<Scene5 spriteTop={spriteTop} isCurrent={step === 2} onNext={() => setStep(3)} key={2} />,
<Scene6 spriteTop={spriteTop} onNext={onDone} key={3} />
]
}, [onDone, spriteTop, time, step])
}, [onDone, spriteTop, step])
return (
<View className={styles.scene_wrap}>
......
......@@ -45,10 +45,8 @@ const Scene1 = ({ onNext }: Scene1Props) => {
}, [])
const handleClick = useCallback(() => {
if (isActive) {
onNext && onNext()
}
}, [onNext, isActive])
onNext && onNext()
}, [onNext])
const fn = useCallback(() => {
setIsActive(true)
......@@ -109,9 +107,10 @@ const Scene1 = ({ onNext }: Scene1Props) => {
<View className={cs.footer}>
<View className={cs.footer_inner}>
<View
className={classNames(cs.btn, !isActive && cs.disabled)}
hoverClass={isActive ? cs.is_hover : ''}
className={classNames(cs.btn)}
hoverClass={cs.is_hover}
onClick={handleClick}
id="main_guide_1"
>继续</View>
</View>
</View>
......
......@@ -88,6 +88,7 @@ const Scene2 = (props: Scene2Props) => {
className={classNames(cs.btn, !isActive && cs.disabled)}
hoverClass={isActive ? cs.is_hover : ''}
onClick={onNext}
id="main_guide_2"
>继续</View>
</View>
</View>
......
......@@ -119,6 +119,7 @@ const Scene4 = (props: Scene4Props) => {
className={classNames(cs.btn, !isActive && cs.disabled)}
hoverClass={isActive ? cs.is_hover : ''}
onClick={onNext}
id="main_guide_4"
>继续</View>
</View>
</View>
......
......@@ -96,11 +96,25 @@ const Scene5 = (props: Scene5Props) => {
<View>练习是一件快乐的事,大家都动力满满哦</View>
</View>
)}
<View
className={classNames(cs.btn, !isActive && cs.disabled)}
hoverClass={isActive ? cs.is_hover : ''}
onClick={handleClick}
>{isSubmit ? '开启我的快乐提升之旅' : '继续'}</View>
{
isSubmit
? (
<View
className={classNames(cs.btn, !isActive && cs.disabled)}
hoverClass={isActive ? cs.is_hover : ''}
onClick={handleClick}
id="main_guide_5_2"
>开启我的快乐提升之旅</View>
)
: (
<View
className={classNames(cs.btn, !isActive && cs.disabled)}
hoverClass={isActive ? cs.is_hover : ''}
onClick={handleClick}
id="main_guide_5_1"
>继续</View>
)
}
</View>
</View>
</View>
......
......@@ -94,10 +94,15 @@ const Scene6 = (props: Scene6Props) => {
<View>
<View className={styles.input}>
<View className={styles.input_item}>{name}</View>
<Image src={assets['touzi.png'].u} className={classNames(styles.input_icon, isGenerating && styles.is_gen)} onClick={handleGen}></Image>
<Image
src={assets['touzi.png'].u}
className={classNames(styles.input_icon, isGenerating && styles.is_gen)}
onClick={handleGen}
id="main_guide_6_gen_name"
></Image>
</View>
<View className={styles.input_tip}>
{/* 确定后奖励<Image src={assets['score.png'].u} className={styles.score}></Image><Text className={styles.em}>+100</Text> */}
* 可点击右侧按钮随机生成昵称
</View>
</View>
<View className={styles.bottom}></View>
......@@ -119,6 +124,7 @@ const Scene6 = (props: Scene6Props) => {
onGetPhoneNumber={handleGetPhone}
className={cs.btn}
loading={loading}
id="main_guide_6"
hoverClass={cs.is_hover}
>确定</Button>
)}
......
......@@ -101,8 +101,8 @@ const ExchangeItem = (props: ExchangeItemProps) => {
<View>张</View>
</View>
<View className={styles.footer}>
<View className={styles.cancel} onClick={() => onCancel()}>取消</View>
<View className={classNames(styles.confirm, val < 1 && styles.disbaled)} onClick={handleConfirm}>
<View className={styles.cancel} onClick={() => onCancel()} id="market_exchange_cancel">取消</View>
<View className={classNames(styles.confirm, val < 1 && styles.disbaled)} onClick={handleConfirm} id="market_exchange_confirm">
确定
{isGuideActive && (
<View className={styles.guide}>
......
......@@ -22,7 +22,7 @@ const GuideFinish = (props: ModalAreaProps) => {
<Image src={tutorialAssets['guide-point.png'].u} className={styles.icon}></Image>
<View className={styles.count}>答题卡 +{pointToCardNum}</View>
<View className={styles.tips}>接下来开启你的闯关之旅吧!</View>
<Button className={styles.btn} onClick={handleConfirm}>好的</Button>
<Button className={styles.btn} onClick={handleConfirm} id="market_guide_finish">好的</Button>
</View>
</RootPortal>
)
......
......@@ -33,7 +33,7 @@ const ModalReceivePoint = (props: ReceivePointProps) => {
<Image src={giftAssets['point-receive.png'].u} className={styles.icon}></Image>
<View className={styles.count}>水晶 +100</View>
<View className={styles.tips}>阿喵老师的奖励,继续加油哦~</View>
<Button className={styles.btn} onClick={handleConfirm} loading={loading}>领取</Button>
<Button className={styles.btn} onClick={handleConfirm} loading={loading} id="market_guide_receive">领取</Button>
</View>
</RootPortal>
)
......
......@@ -157,7 +157,7 @@ const StudyMarket = () => {
<View className={styles.guide_content}>
<Image src={tutorialAssets['cat-2.png'].u} className={styles.guide_cat} />
<View className={styles.guide_main}>
<View className={classNames(styles.dialog)} onClick={() => nextStoreGuide()}>
<View className={classNames(styles.dialog)} onClick={() => nextStoreGuide()} id="market_guide_1">
<View>
在这里,可以兑换闯关消耗的<Text className={styles.em}>答题卡</Text>,以及
<Text className={styles.em}>成长奖励</Text>哦~
......
......@@ -58,13 +58,13 @@ const MainHeader = () => {
const renderAgain = useCallback(() => (
<View className={styles.againDetails}>
{stageDetail?.nextSteps?.map((item, index) => (
<GuideCompleteScene2 index={index + 2}>
<GuideCompleteScene2 key={index} index={index + 2}>
<View className={styles.content}>
<Image className={styles.badge} style={{ marginRight: 10 }} src={formatNextStep(item).u} mode="widthFix" />
<View className={styles.center}>
用时
<Image style={{ width: 14, height: 15 }} src={require('../assets/down-arrow.png')} mode="widthFix" />
{item.nextStepTime}秒,就能获得
{item.nextStepTime <= 0 ? 0.1 : item.nextStepTime}秒,就能获得
<Text style={{ color: '#FFCF83', fontWeight: 600 }}>
{formatNextStep(item).t}
</Text>
......
......@@ -45,7 +45,7 @@ export const Scene = ({ children }: { children: React.ReactNode }) => {
<View className={styles.inner} onClick={handleContinue}>
<Text>
哇,你通关了,表现不错哦;你的熟练度,
<Text className={styles.strong}>打败了{stageDetail?.gear || 0}%的同学</Text>
<Text className={styles.strong}>打败了{100 - (stageDetail?.gear || 0)}%的同学</Text>
,当然相信你还可以变得更好!
</Text>
<View className={styles.continue}>
......
......@@ -49,7 +49,7 @@ const MessageRenderer = ({ step, level, gear, upGear }) => {
const { detail } = detailIndexMap[targetStep]
if (detail.nextStepTime < 0) {
if (detail.nextStepTime <= 0) {
detail.nextStepTime = 0.1
}
......
export default definePageConfig({
enableShareAppMessage: true,
navigationBarTitleText: 'pk-math',
navigationStyle: 'custom'
navigationStyle: 'custom',
usingComponents: {
'game-rank': '@/native-components/rank/index'
}
})
......@@ -21,7 +21,7 @@ import Tabs, { type TabItem } from './components/tabs'
import TopBar from './components/top-bar'
import MainHeader from './components/main-header'
import AnswerCardModal from './components/answer-card-modal'
import { renderList, renderTribePage } from './render'
import { renderTribePage, RankList } from './render'
import styles from './index.module.scss'
......@@ -37,7 +37,7 @@ const Prepare = () => {
const cardNum = useStoreState(state => state.userModel.cardNum)
const point = useStoreState(state => state.userModel.point)
const userInfo = useStoreState(state => state.userModel.userInfo)
// const isSubmit = true
const isSubmit = useStoreState(state => state.gameModel.isSubmit)
const tribeInfo = useStoreState(state => state.groupModel.tribeInfo)
const stageList = useStoreState(state => state.mainModel.stageList)
......@@ -51,7 +51,9 @@ const Prepare = () => {
const tabs: TabItem[] = [
{
label: `${userInfo.city === '其他' ? '' : (userInfo.city ?? '')}排行榜`,
children: renderList(stageDetail?.ranks || [])
children: (
<RankList list={stageDetail?.ranks ?? []} />
)
},
{
label: '学习部落排行榜',
......
import { View, Text, Image } from '@tarojs/components'
import { switchTab } from '@tarojs/taro'
import classNames from 'classnames'
import { NextStep, type StageRank } from '@/api/game'
import { switchTab, useReachBottom, getCurrentInstance } from '@tarojs/taro'
import { useRef, useMemo } from 'react'
import { type StageRank } from '@/api/game'
import assets from '@/assets/oss/assets-prepare'
import assetsGroup from '@/assets/oss/assets-group'
import Thead from './components/thead'
import styles from './index.module.scss'
import { formatNextStep } from './format'
export const renderList = (list: StageRank[]) => {
const isEmpty = list.length < 1
const user = list.find(item => item.me)
return (
<>
<Thead />
{user && user.no > 3 && renderItem(user)}
{list.map(renderItem)}
{isEmpty && <View className={styles.empty}>暂无数据</View>}
</>
)
type RankListProps = {
list: StageRank[]
}
export const renderItem = (item: StageRank) => {
export function RankList (props: RankListProps) {
const { list } = props
const page = useMemo(() => getCurrentInstance()?.page, [])
const gameRank = useRef(null)
useReachBottom(() => {
if (gameRank.current) {
(page?.selectComponent?.(`#${(gameRank.current as any).uid}`) as any)?.loadMore()
}
})
return (
<View key={item.userId} className={classNames(styles.item, { [styles.active]: item.me })}>
<View className={styles.item_rank}>
{[1, 2, 3].includes(item.no)
? <Image className={styles.item_rank_icon} src={assetsGroup[`rank-${item.no}.png`].u} />
: <Text className={styles.item_rank_index}>{item.no}</Text>
}
</View>
<View className={styles.item_username}>
<Text className={styles.item_username_text}>
{item.nickName || '-'}
{item.me && <Text>(你)</Text>}
</Text>
{item.identity === 'LEADER' && <Image className={styles.item_username_crown} src={assetsGroup['crown-small.png'].u} />}
</View>
<View className={styles.item_result}>
<Text className={styles.item_result_first}>{item.firstResultTime?.toFixed(1) || '-'}秒</Text>
<Text>|</Text>
<Text className={styles.item_result_best}>{item.bestResultTime?.toFixed(1) || '-'}秒</Text>
</View>
</View>
<game-rank list={list} ref={gameRank} />
)
}
......@@ -61,7 +40,7 @@ const renderTribeList = (list: StageRank[], groupNo?: string) => {
return (
<View style={{ paddingBottom: 70 }}>
<Text className={styles.tribe_title}>{groupNo}部落</Text>
{renderList(list)}
<RankList list={list} />
</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