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{ ...@@ -26,7 +26,10 @@ declare namespace JSX{
'count-up-time': CountUpTime; 'count-up-time': CountUpTime;
'number-keyboard': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & { 'number-keyboard': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
onType?: (a: { detail: string }) => void; onType?: (a: { detail: string }) => void;
}, HTMLElement> }, HTMLElement>;
'game-rank': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
list: any[]
}, HTMLElement>;
} }
} }
......
{ {
"name": "learn-math-weapp", "name": "learn-math-weapp",
"version": "1.0.9", "version": "1.0.15",
"private": true, "private": true,
"description": "", "description": "",
"scripts": { "scripts": {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"miniprogramRoot": "dist/", "miniprogramRoot": "dist/",
"projectname": "GeekLearnMathWeapp", "projectname": "GeekLearnMathWeapp",
"description": "", "description": "",
"appid": "wx693fe3460124d84b", "appid": "wx8f25def587982a19",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"es6": false, "es6": false,
......
...@@ -11,6 +11,7 @@ type UserGuideProps<T extends ComponentType<any>> = { ...@@ -11,6 +11,7 @@ type UserGuideProps<T extends ComponentType<any>> = {
onFinish?: () => void; onFinish?: () => void;
isActive?: boolean; isActive?: boolean;
compnent?: T; compnent?: T;
guideViewId?: string;
onClickConent?: () => void; onClickConent?: () => void;
verticalPadding?: number; verticalPadding?: number;
horizonPadding?: number; horizonPadding?: number;
...@@ -19,7 +20,7 @@ type UserGuideProps<T extends ComponentType<any>> = { ...@@ -19,7 +20,7 @@ type UserGuideProps<T extends ComponentType<any>> = {
} & GetProps<T> } & GetProps<T>
function UserGuideView<T extends ComponentType<any> = typeof View> (props: UserGuideProps<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 [rect, setRect] = useState({ width: 80, height: 80, top: 0, left: 0 })
const [_isActive, setIsActive] = useState(false) const [_isActive, setIsActive] = useState(false)
const scrollRef = useRef(0) const scrollRef = useRef(0)
...@@ -63,7 +64,7 @@ function UserGuideView<T extends ComponentType<any> = typeof View> (props: UserG ...@@ -63,7 +64,7 @@ function UserGuideView<T extends ComponentType<any> = typeof View> (props: UserG
{_isActive && ( {_isActive && (
<RootPortal> <RootPortal>
<View className={classNames(styles.contentWrap, wrapClass)} catchMove style={style}> <View className={classNames(styles.contentWrap, wrapClass)} catchMove style={style}>
<View className={styles.content} onClick={onClickConent}> <View className={styles.content} onClick={onClickConent} id={guideViewId}>
</View> </View>
{guideContent} {guideContent}
</View> </View>
......
...@@ -50,13 +50,13 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => { ...@@ -50,13 +50,13 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => {
<> <>
<View className={classNames(styles.wrap, isEyeProtectionMode && styles.eye_protection)}> <View className={classNames(styles.wrap, isEyeProtectionMode && styles.eye_protection)}>
<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')} id="app_tab_1">
{selected === 0 && ( {selected === 0 && (
<Image src="/assets/tabbar/personal-bg.png" className={classNames(styles.bg, styles.left)}></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')} id="app_tab_2">
{selected === 1 && ( {selected === 1 && (
<Image src="/assets/tabbar/group-bg.png" className={classNames(styles.bg, styles.right)}></Image> <Image src="/assets/tabbar/group-bg.png" className={classNames(styles.bg, styles.right)}></Image>
)} )}
...@@ -64,7 +64,7 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => { ...@@ -64,7 +64,7 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => {
<Image src="/assets/tabbar/group-on.png" className={classNames(styles.icon, { [styles.hasPoint]: hasPoint })}> <Image src="/assets/tabbar/group-on.png" className={classNames(styles.icon, { [styles.hasPoint]: hasPoint })}>
</Image> </Image>
{isActiveGuide && ( {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> <Image src={tutorialAssets['guide-arrow-2.png'].u} className={styles.guide_arrow}></Image>
</View> </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 = () => { ...@@ -84,6 +84,7 @@ const GameCompleteAchieve = () => {
className={styles.btn_continue} className={styles.btn_continue}
hoverClass={styles.is_active} hoverClass={styles.is_active}
onClick={handleContinue} onClick={handleContinue}
id="game_complete_continue"
> >
继续 继续
</View> </View>
......
...@@ -207,6 +207,7 @@ const GameCompleteHead = () => { ...@@ -207,6 +207,7 @@ const GameCompleteHead = () => {
<UserGuideView <UserGuideView
className={styles.item} className={styles.item}
onClick={goWrong} onClick={goWrong}
id="err_question"
isActive={isActive} isActive={isActive}
compnent={View} compnent={View}
wrapClass={styles.content_wrap} wrapClass={styles.content_wrap}
...@@ -217,7 +218,7 @@ const GameCompleteHead = () => { ...@@ -217,7 +218,7 @@ const GameCompleteHead = () => {
<View className={styles.guide}> <View className={styles.guide}>
<View className={styles.guide_inner}> <View className={styles.guide_inner}>
<Image src={tutorialAssets['cat.png'].u} className={styles.guide_icon}></Image> <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> <View>
点击此处,可以查看<Text className={styles.em}>本次闯关的错题</Text>哦~ 点击此处,可以查看<Text className={styles.em}>本次闯关的错题</Text>哦~
</View> </View>
......
...@@ -51,6 +51,7 @@ const ModalContinue = () => { ...@@ -51,6 +51,7 @@ const ModalContinue = () => {
className={styles.btn_left} className={styles.btn_left}
hoverClass={styles.is_active} hoverClass={styles.is_active}
onClick={() => submit()} onClick={() => submit()}
id="fail_game_give_up"
> >
放弃 放弃
</View> </View>
...@@ -58,6 +59,7 @@ const ModalContinue = () => { ...@@ -58,6 +59,7 @@ const ModalContinue = () => {
className={classNames(styles.btn_right, !canGoNext && styles.disabled)} className={classNames(styles.btn_right, !canGoNext && styles.disabled)}
hoverClass={canGoNext ? styles.is_active : null} hoverClass={canGoNext ? styles.is_active : null}
onClick={handleReborn} onClick={handleReborn}
id="fail_game_reborn"
> >
<Image src={require('@/pages/main/assets/ph.png')} className={styles.icon}></Image> <Image src={require('@/pages/main/assets/ph.png')} className={styles.icon}></Image>
<Text>-1 继续</Text> <Text>-1 继续</Text>
......
import { View, Image, CustomWrapper } from '@tarojs/components' import { View, Image, CustomWrapper } from '@tarojs/components'
import { useMemo } from 'react'
import classNames from 'classnames' import classNames from 'classnames'
import styles from './page-footer.module.scss' import styles from './page-footer.module.scss'
...@@ -22,6 +21,7 @@ const PageFooter = (props: PageFooterProps) => { ...@@ -22,6 +21,7 @@ const PageFooter = (props: PageFooterProps) => {
<View <View
className={styles.btn_left} className={styles.btn_left}
hoverClass={styles.is_active} hoverClass={styles.is_active}
id="question_clear_btn"
onClick={() => clearUserAnswer()} onClick={() => clearUserAnswer()}
> >
<Image src={require('../assets/btn-clear-icon.png')} className={styles.icon}></Image> <Image src={require('../assets/btn-clear-icon.png')} className={styles.icon}></Image>
...@@ -31,6 +31,7 @@ const PageFooter = (props: PageFooterProps) => { ...@@ -31,6 +31,7 @@ const PageFooter = (props: PageFooterProps) => {
className={classNames(styles.btn_right, !canGoNext && styles.disabled)} className={classNames(styles.btn_right, !canGoNext && styles.disabled)}
hoverClass={canGoNext ? styles.is_active : null} hoverClass={canGoNext ? styles.is_active : null}
onClick={() => handleGoNext()} onClick={() => handleGoNext()}
id="question_continue_btn"
>{isLastQuestion ? confirmText : '下一题'}</View> >{isLastQuestion ? confirmText : '下一题'}</View>
</View> </View>
</View> </View>
......
...@@ -30,12 +30,10 @@ const GuideModal = () => { ...@@ -30,12 +30,10 @@ const GuideModal = () => {
<View>部落PK大赛</View> <View>部落PK大赛</View>
</View> </View>
</View> </View>
<View className={classNames(styles.dialog)} onClick={() => completeGroupGuide()}> <View className={classNames(styles.dialog)} onClick={() => completeGroupGuide()} id="complete_group_guide">
<View> <View>
让我们先从基本功开始。已经为你准备好了打好基本功所必须掌握的 除此之外,每个部落还有专属排行榜,后续还会有【部落PK大赛】等活动。
<Text className={styles.em}>计算达标</Text>、 <Text className={styles.em}>期待你带领你的部落一起成长,获得更多奖励!</Text>
<Text className={styles.em}>常考的应用题</Text>、
以及<Text className={styles.em}>附加思维题</Text>哦。
</View> </View>
<View className={styles.continue}> <View className={styles.continue}>
<View className={styles.continue_btn}> <View className={styles.continue_btn}>
......
...@@ -38,11 +38,11 @@ const TopHeader = () => { ...@@ -38,11 +38,11 @@ const TopHeader = () => {
<View className={styles.avatar}> <View className={styles.avatar}>
<Text className={styles.name}>{userInfo?.nickName ?? ''}</Text> <Text className={styles.name}>{userInfo?.nickName ?? ''}</Text>
</View> </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} /> <Image src={require('@/pages/main/assets/score.png')} className={styles.icon} />
<Text>{point}</Text> <Text>{point}</Text>
</View> </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} /> <Image src={require('@/pages/main/assets/ph.png')} className={styles.icon} />
<Text>{cardNum}</Text> <Text>{cardNum}</Text>
</View> </View>
......
...@@ -148,7 +148,7 @@ const Group = () => { ...@@ -148,7 +148,7 @@ const Group = () => {
<Modal isVisible={isVisible} tilte="学习部落名" onClose={setFalse}> <Modal isVisible={isVisible} tilte="学习部落名" onClose={setFalse}>
<View className={styles.modal}> <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} /> <Input className={styles.modal_input} disabled value={groupNo} />
<Image className={styles.modal_refresh} mode="widthFix" src={assets['refresh.png'].u} /> <Image className={styles.modal_refresh} mode="widthFix" src={assets['refresh.png'].u} />
</View> </View>
......
...@@ -43,11 +43,11 @@ const MainHeader = () => { ...@@ -43,11 +43,11 @@ const MainHeader = () => {
<View className={styles.avatar}> <View className={styles.avatar}>
<Text className={styles.name}>{userInfo?.nickName ?? ''}</Text> <Text className={styles.name}>{userInfo?.nickName ?? ''}</Text>
</View> </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} /> <Image src={require('../assets/score.png')} className={styles.icon} />
<Text>{point}</Text> <Text>{point}</Text>
</View> </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} /> <Image src={require('../assets/ph.png')} className={styles.icon} />
<Text>{cardNum}</Text> <Text>{cardNum}</Text>
</View> </View>
......
...@@ -146,6 +146,7 @@ const StageComp = (props: StageProps) => { ...@@ -146,6 +146,7 @@ const StageComp = (props: StageProps) => {
horizonPadding={0} horizonPadding={0}
wrapClass={styles.guide_wrap} wrapClass={styles.guide_wrap}
onClickConent={handleCompleteGuide} onClickConent={handleCompleteGuide}
guideViewId="firt_stage_guide"
guideContent={( guideContent={(
<View className={styles.tutorial}> <View className={styles.tutorial}>
<Image src={tutorial['arrow.png'].u} className={styles.tutorial_arrow}></Image> <Image src={tutorial['arrow.png'].u} className={styles.tutorial_arrow}></Image>
......
...@@ -170,8 +170,12 @@ export default function ShareModal () { ...@@ -170,8 +170,12 @@ export default function ShareModal () {
</View> </View>
<View className={styles.footer}> <View className={styles.footer}>
<Text className={styles.cancel} onClick={handleCancel}>暂不加入</Text> <Text className={styles.cancel} onClick={handleCancel} id="join_group_cancel">暂不加入</Text>
<Text className={styles.confirm} onClick={() => run({ groupId: detail.groupId!, shareUserId: detail.shareUserId! })}> <Text
className={styles.confirm}
onClick={() => run({ groupId: detail.groupId!, shareUserId: detail.shareUserId! })}
id="join_group_confirm"
>
确定加入 确定加入
</Text> </Text>
</View> </View>
......
...@@ -49,7 +49,7 @@ const ShortCut = (props: ShortCutProps) => { ...@@ -49,7 +49,7 @@ const ShortCut = (props: ShortCutProps) => {
return ( return (
<EyeProtectionView className={styles.shortcut}> <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-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> <Image src={assets['short-cut-arrow.png'].u} className={classNames(styles.arrow, ((!isHide && isDown) || (isHide && !isDown)) && styles.isDown)}></Image>
</View> </View>
......
...@@ -46,6 +46,7 @@ const ModalArea = (props: ModalAreaProps) => { ...@@ -46,6 +46,7 @@ const ModalArea = (props: ModalAreaProps) => {
className={classNames(styles.btn, !current && styles.disabled)} className={classNames(styles.btn, !current && styles.disabled)}
onClick={handleConfirm} onClick={handleConfirm}
loading={loading} loading={loading}
id="main_confirm_area"
hoverClass={styles.btn_on} hoverClass={styles.btn_on}
>继续</Button> >继续</Button>
</View> </View>
......
...@@ -46,6 +46,7 @@ const ModalGrade = (props: ModalGradeProps) => { ...@@ -46,6 +46,7 @@ const ModalGrade = (props: ModalGradeProps) => {
loading={loading} loading={loading}
className={classNames(styles.btn, !current && styles.disabled)} className={classNames(styles.btn, !current && styles.disabled)}
onClick={handleConfirm} onClick={handleConfirm}
id="main_confirm_grade"
hoverClass={styles.btn_on} hoverClass={styles.btn_on}
>继续</Button> >继续</Button>
</View> </View>
......
...@@ -16,7 +16,7 @@ const ModalGroupGuide = (props: ModalGroupGuideProps) => { ...@@ -16,7 +16,7 @@ const ModalGroupGuide = (props: ModalGroupGuideProps) => {
<View className={styles.result_wrap} catchMove> <View className={styles.result_wrap} catchMove>
<Image src={tutorialAssets['cat.png'].u} className={styles.result_cat} /> <Image src={tutorialAssets['cat.png'].u} className={styles.result_cat} />
<View className={styles.result_main}> <View className={styles.result_main}>
<View className={classNames(styles.dialog)} onClick={() => onConfirm()}> <View className={classNames(styles.dialog)} onClick={() => onConfirm()} id="group_guide_1">
<View> <View>
阿喵老师很高兴看到你在不断进步,接下来我要传授你一个 阿喵老师很高兴看到你在不断进步,接下来我要传授你一个
<Text className={styles.em}>得到大量水晶的好方法</Text>。 <Text className={styles.em}>得到大量水晶的好方法</Text>。
......
...@@ -57,7 +57,7 @@ const ModalResult = (props: ModalResultProps) => { ...@@ -57,7 +57,7 @@ const ModalResult = (props: ModalResultProps) => {
<View className={styles.result_wrap} catchMove> <View className={styles.result_wrap} catchMove>
<Image src={tutorialAssets['cat.png'].u} className={styles.result_cat} /> <Image src={tutorialAssets['cat.png'].u} className={styles.result_cat} />
<View className={styles.result_main}> <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()} {renderContent()}
<View className={styles.continue}> <View className={styles.continue}>
<View className={styles.continue_btn}> <View className={styles.continue_btn}>
......
...@@ -54,12 +54,12 @@ const Guide = (props: GuideProps) => { ...@@ -54,12 +54,12 @@ const Guide = (props: GuideProps) => {
return [ return [
<Scene1 onNext={() => setStep(1)} key={1} />, <Scene1 onNext={() => setStep(1)} key={1} />,
<Scene2 spriteTop={spriteTop} isCurrent={step === 1} onNext={() => setStep(2)} key={2} />, <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} />, // <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} />, // <Scene4 spriteTop={spriteTop} isCurrent={step === 3} onNext={() => setStep(4)} time={time} key={4} />,
<Scene5 spriteTop={spriteTop} isCurrent={step === 4} onNext={() => setStep(5)} key={5} />, <Scene5 spriteTop={spriteTop} isCurrent={step === 2} onNext={() => setStep(3)} key={2} />,
<Scene6 spriteTop={spriteTop} onNext={onDone} key={6} /> <Scene6 spriteTop={spriteTop} onNext={onDone} key={3} />
] ]
}, [onDone, spriteTop, time, step]) }, [onDone, spriteTop, step])
return ( return (
<View className={styles.scene_wrap}> <View className={styles.scene_wrap}>
......
...@@ -45,10 +45,8 @@ const Scene1 = ({ onNext }: Scene1Props) => { ...@@ -45,10 +45,8 @@ const Scene1 = ({ onNext }: Scene1Props) => {
}, []) }, [])
const handleClick = useCallback(() => { const handleClick = useCallback(() => {
if (isActive) {
onNext && onNext() onNext && onNext()
} }, [onNext])
}, [onNext, isActive])
const fn = useCallback(() => { const fn = useCallback(() => {
setIsActive(true) setIsActive(true)
...@@ -109,9 +107,10 @@ const Scene1 = ({ onNext }: Scene1Props) => { ...@@ -109,9 +107,10 @@ const Scene1 = ({ onNext }: Scene1Props) => {
<View className={cs.footer}> <View className={cs.footer}>
<View className={cs.footer_inner}> <View className={cs.footer_inner}>
<View <View
className={classNames(cs.btn, !isActive && cs.disabled)} className={classNames(cs.btn)}
hoverClass={isActive ? cs.is_hover : ''} hoverClass={cs.is_hover}
onClick={handleClick} onClick={handleClick}
id="main_guide_1"
>继续</View> >继续</View>
</View> </View>
</View> </View>
......
...@@ -88,6 +88,7 @@ const Scene2 = (props: Scene2Props) => { ...@@ -88,6 +88,7 @@ const Scene2 = (props: Scene2Props) => {
className={classNames(cs.btn, !isActive && cs.disabled)} className={classNames(cs.btn, !isActive && cs.disabled)}
hoverClass={isActive ? cs.is_hover : ''} hoverClass={isActive ? cs.is_hover : ''}
onClick={onNext} onClick={onNext}
id="main_guide_2"
>继续</View> >继续</View>
</View> </View>
</View> </View>
......
...@@ -119,6 +119,7 @@ const Scene4 = (props: Scene4Props) => { ...@@ -119,6 +119,7 @@ const Scene4 = (props: Scene4Props) => {
className={classNames(cs.btn, !isActive && cs.disabled)} className={classNames(cs.btn, !isActive && cs.disabled)}
hoverClass={isActive ? cs.is_hover : ''} hoverClass={isActive ? cs.is_hover : ''}
onClick={onNext} onClick={onNext}
id="main_guide_4"
>继续</View> >继续</View>
</View> </View>
</View> </View>
......
...@@ -96,11 +96,25 @@ const Scene5 = (props: Scene5Props) => { ...@@ -96,11 +96,25 @@ const Scene5 = (props: Scene5Props) => {
<View>练习是一件快乐的事,大家都动力满满哦</View> <View>练习是一件快乐的事,大家都动力满满哦</View>
</View> </View>
)} )}
{
isSubmit
? (
<View <View
className={classNames(cs.btn, !isActive && cs.disabled)} className={classNames(cs.btn, !isActive && cs.disabled)}
hoverClass={isActive ? cs.is_hover : ''} hoverClass={isActive ? cs.is_hover : ''}
onClick={handleClick} onClick={handleClick}
>{isSubmit ? '开启我的快乐提升之旅' : '继续'}</View> 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> </View>
</View> </View>
......
...@@ -94,10 +94,15 @@ const Scene6 = (props: Scene6Props) => { ...@@ -94,10 +94,15 @@ const Scene6 = (props: Scene6Props) => {
<View> <View>
<View className={styles.input}> <View className={styles.input}>
<View className={styles.input_item}>{name}</View> <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>
<View className={styles.input_tip}> <View className={styles.input_tip}>
{/* 确定后奖励<Image src={assets['score.png'].u} className={styles.score}></Image><Text className={styles.em}>+100</Text> */} * 可点击右侧按钮随机生成昵称
</View> </View>
</View> </View>
<View className={styles.bottom}></View> <View className={styles.bottom}></View>
...@@ -119,6 +124,7 @@ const Scene6 = (props: Scene6Props) => { ...@@ -119,6 +124,7 @@ const Scene6 = (props: Scene6Props) => {
onGetPhoneNumber={handleGetPhone} onGetPhoneNumber={handleGetPhone}
className={cs.btn} className={cs.btn}
loading={loading} loading={loading}
id="main_guide_6"
hoverClass={cs.is_hover} hoverClass={cs.is_hover}
>确定</Button> >确定</Button>
)} )}
......
...@@ -101,8 +101,8 @@ const ExchangeItem = (props: ExchangeItemProps) => { ...@@ -101,8 +101,8 @@ const ExchangeItem = (props: ExchangeItemProps) => {
<View>张</View> <View>张</View>
</View> </View>
<View className={styles.footer}> <View className={styles.footer}>
<View className={styles.cancel} onClick={() => onCancel()}>取消</View> <View className={styles.cancel} onClick={() => onCancel()} id="market_exchange_cancel">取消</View>
<View className={classNames(styles.confirm, val < 1 && styles.disbaled)} onClick={handleConfirm}> <View className={classNames(styles.confirm, val < 1 && styles.disbaled)} onClick={handleConfirm} id="market_exchange_confirm">
确定 确定
{isGuideActive && ( {isGuideActive && (
<View className={styles.guide}> <View className={styles.guide}>
......
...@@ -22,7 +22,7 @@ const GuideFinish = (props: ModalAreaProps) => { ...@@ -22,7 +22,7 @@ const GuideFinish = (props: ModalAreaProps) => {
<Image src={tutorialAssets['guide-point.png'].u} className={styles.icon}></Image> <Image src={tutorialAssets['guide-point.png'].u} className={styles.icon}></Image>
<View className={styles.count}>答题卡 +{pointToCardNum}</View> <View className={styles.count}>答题卡 +{pointToCardNum}</View>
<View className={styles.tips}>接下来开启你的闯关之旅吧!</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> </View>
</RootPortal> </RootPortal>
) )
......
...@@ -33,7 +33,7 @@ const ModalReceivePoint = (props: ReceivePointProps) => { ...@@ -33,7 +33,7 @@ const ModalReceivePoint = (props: ReceivePointProps) => {
<Image src={giftAssets['point-receive.png'].u} className={styles.icon}></Image> <Image src={giftAssets['point-receive.png'].u} className={styles.icon}></Image>
<View className={styles.count}>水晶 +100</View> <View className={styles.count}>水晶 +100</View>
<View className={styles.tips}>阿喵老师的奖励,继续加油哦~</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> </View>
</RootPortal> </RootPortal>
) )
......
...@@ -157,7 +157,7 @@ const StudyMarket = () => { ...@@ -157,7 +157,7 @@ const StudyMarket = () => {
<View className={styles.guide_content}> <View className={styles.guide_content}>
<Image src={tutorialAssets['cat-2.png'].u} className={styles.guide_cat} /> <Image src={tutorialAssets['cat-2.png'].u} className={styles.guide_cat} />
<View className={styles.guide_main}> <View className={styles.guide_main}>
<View className={classNames(styles.dialog)} onClick={() => nextStoreGuide()}> <View className={classNames(styles.dialog)} onClick={() => nextStoreGuide()} id="market_guide_1">
<View> <View>
在这里,可以兑换闯关消耗的<Text className={styles.em}>答题卡</Text>,以及 在这里,可以兑换闯关消耗的<Text className={styles.em}>答题卡</Text>,以及
<Text className={styles.em}>成长奖励</Text>哦~ <Text className={styles.em}>成长奖励</Text>哦~
......
...@@ -58,13 +58,13 @@ const MainHeader = () => { ...@@ -58,13 +58,13 @@ const MainHeader = () => {
const renderAgain = useCallback(() => ( const renderAgain = useCallback(() => (
<View className={styles.againDetails}> <View className={styles.againDetails}>
{stageDetail?.nextSteps?.map((item, index) => ( {stageDetail?.nextSteps?.map((item, index) => (
<GuideCompleteScene2 index={index + 2}> <GuideCompleteScene2 key={index} index={index + 2}>
<View className={styles.content}> <View className={styles.content}>
<Image className={styles.badge} style={{ marginRight: 10 }} src={formatNextStep(item).u} mode="widthFix" /> <Image className={styles.badge} style={{ marginRight: 10 }} src={formatNextStep(item).u} mode="widthFix" />
<View className={styles.center}> <View className={styles.center}>
用时 用时
<Image style={{ width: 14, height: 15 }} src={require('../assets/down-arrow.png')} mode="widthFix" /> <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 }}> <Text style={{ color: '#FFCF83', fontWeight: 600 }}>
{formatNextStep(item).t} {formatNextStep(item).t}
</Text> </Text>
......
...@@ -45,7 +45,7 @@ export const Scene = ({ children }: { children: React.ReactNode }) => { ...@@ -45,7 +45,7 @@ export const Scene = ({ children }: { children: React.ReactNode }) => {
<View className={styles.inner} onClick={handleContinue}> <View className={styles.inner} onClick={handleContinue}>
<Text> <Text>
哇,你通关了,表现不错哦;你的熟练度, 哇,你通关了,表现不错哦;你的熟练度,
<Text className={styles.strong}>打败了{stageDetail?.gear || 0}%的同学</Text> <Text className={styles.strong}>打败了{100 - (stageDetail?.gear || 0)}%的同学</Text>
,当然相信你还可以变得更好! ,当然相信你还可以变得更好!
</Text> </Text>
<View className={styles.continue}> <View className={styles.continue}>
......
...@@ -49,7 +49,7 @@ const MessageRenderer = ({ step, level, gear, upGear }) => { ...@@ -49,7 +49,7 @@ const MessageRenderer = ({ step, level, gear, upGear }) => {
const { detail } = detailIndexMap[targetStep] const { detail } = detailIndexMap[targetStep]
if (detail.nextStepTime < 0) { if (detail.nextStepTime <= 0) {
detail.nextStepTime = 0.1 detail.nextStepTime = 0.1
} }
......
export default definePageConfig({ export default definePageConfig({
enableShareAppMessage: true, enableShareAppMessage: true,
navigationBarTitleText: 'pk-math', 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' ...@@ -21,7 +21,7 @@ import Tabs, { type TabItem } from './components/tabs'
import TopBar from './components/top-bar' import TopBar from './components/top-bar'
import MainHeader from './components/main-header' import MainHeader from './components/main-header'
import AnswerCardModal from './components/answer-card-modal' import AnswerCardModal from './components/answer-card-modal'
import { renderList, renderTribePage } from './render' import { renderTribePage, RankList } from './render'
import styles from './index.module.scss' import styles from './index.module.scss'
...@@ -37,7 +37,7 @@ const Prepare = () => { ...@@ -37,7 +37,7 @@ const Prepare = () => {
const cardNum = useStoreState(state => state.userModel.cardNum) const cardNum = useStoreState(state => state.userModel.cardNum)
const point = useStoreState(state => state.userModel.point) const point = useStoreState(state => state.userModel.point)
const userInfo = useStoreState(state => state.userModel.userInfo) const userInfo = useStoreState(state => state.userModel.userInfo)
// const isSubmit = true
const isSubmit = useStoreState(state => state.gameModel.isSubmit) const isSubmit = useStoreState(state => state.gameModel.isSubmit)
const tribeInfo = useStoreState(state => state.groupModel.tribeInfo) const tribeInfo = useStoreState(state => state.groupModel.tribeInfo)
const stageList = useStoreState(state => state.mainModel.stageList) const stageList = useStoreState(state => state.mainModel.stageList)
...@@ -51,7 +51,9 @@ const Prepare = () => { ...@@ -51,7 +51,9 @@ const Prepare = () => {
const tabs: TabItem[] = [ const tabs: TabItem[] = [
{ {
label: `${userInfo.city === '其他' ? '' : (userInfo.city ?? '')}排行榜`, label: `${userInfo.city === '其他' ? '' : (userInfo.city ?? '')}排行榜`,
children: renderList(stageDetail?.ranks || []) children: (
<RankList list={stageDetail?.ranks ?? []} />
)
}, },
{ {
label: '学习部落排行榜', label: '学习部落排行榜',
......
import { View, Text, Image } from '@tarojs/components' import { View, Text, Image } from '@tarojs/components'
import { switchTab } from '@tarojs/taro' import { switchTab, useReachBottom, getCurrentInstance } from '@tarojs/taro'
import classNames from 'classnames' import { useRef, useMemo } from 'react'
import { NextStep, type StageRank } from '@/api/game' import { type StageRank } from '@/api/game'
import assets from '@/assets/oss/assets-prepare' 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 styles from './index.module.scss'
import { formatNextStep } from './format'
export const renderList = (list: StageRank[]) => { type RankListProps = {
const isEmpty = list.length < 1 list: StageRank[]
const user = list.find(item => item.me)
return (
<>
<Thead />
{user && user.no > 3 && renderItem(user)}
{list.map(renderItem)}
{isEmpty && <View className={styles.empty}>暂无数据</View>}
</>
)
} }
export const renderItem = (item: StageRank) => { export function RankList (props: RankListProps) {
return ( const { list } = props
<View key={item.userId} className={classNames(styles.item, { [styles.active]: item.me })}>
<View className={styles.item_rank}> const page = useMemo(() => getCurrentInstance()?.page, [])
{[1, 2, 3].includes(item.no)
? <Image className={styles.item_rank_icon} src={assetsGroup[`rank-${item.no}.png`].u} /> const gameRank = useRef(null)
: <Text className={styles.item_rank_index}>{item.no}</Text> useReachBottom(() => {
if (gameRank.current) {
(page?.selectComponent?.(`#${(gameRank.current as any).uid}`) as any)?.loadMore()
} }
</View> })
<View className={styles.item_username}>
<Text className={styles.item_username_text}> return (
{item.nickName || '-'} <game-rank list={list} ref={gameRank} />
{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>
) )
} }
...@@ -61,7 +40,7 @@ const renderTribeList = (list: StageRank[], groupNo?: string) => { ...@@ -61,7 +40,7 @@ const renderTribeList = (list: StageRank[], groupNo?: string) => {
return ( return (
<View style={{ paddingBottom: 70 }}> <View style={{ paddingBottom: 70 }}>
<Text className={styles.tribe_title}>{groupNo}部落</Text> <Text className={styles.tribe_title}>{groupNo}部落</Text>
{renderList(list)} <RankList list={list} />
</View> </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