Commit 322867c2 authored by hewenhao's avatar hewenhao

feat: update

parent 91b790cb
...@@ -3,16 +3,20 @@ import assetsGame from '@/assets/oss/assets-game' ...@@ -3,16 +3,20 @@ import assetsGame from '@/assets/oss/assets-game'
import assetsPrepare from '@/assets/oss/assets-prepare' import assetsPrepare from '@/assets/oss/assets-prepare'
import assetsPk from '@/assets/oss/assets-pk' import assetsPk from '@/assets/oss/assets-pk'
import classNames from 'classnames' import classNames from 'classnames'
import { reLaunch } from '@tarojs/taro'
import { useStoreState } from '@/store/hooks' import { useStoreState } from '@/store/hooks'
import styles from './battle-complete.module.scss' import styles from './battle-complete.module.scss'
type BattleCompleteProps = { const BattleComplete = () => {
}
const BattleComplete = (props: BattleCompleteProps) => {
const pkResult = useStoreState(states => states.gameModel.pkResult) const pkResult = useStoreState(states => states.gameModel.pkResult)
const upSelf = () => {
reLaunch({
url: '/pages/main/main'
})
}
if (!pkResult) { if (!pkResult) {
return null return null
} }
...@@ -27,30 +31,30 @@ const BattleComplete = (props: BattleCompleteProps) => { ...@@ -27,30 +31,30 @@ const BattleComplete = (props: BattleCompleteProps) => {
</View> </View>
<View className={styles.game_role}> <View className={styles.game_role}>
<View className={styles.game_role_left}> <View className={styles.game_role_left}>
<View className={styles.user_name}>用户名称用户名</View> <View className={styles.user_name}>{pkResult.initiatorName}</View>
<View className={styles.user_level}> <View className={styles.user_level}>
<Image src={assetsPk['bronze.png'].u} className={styles.level_icon}></Image>青铜Ⅰ <Image src={assetsPk['bronze.png'].u} className={styles.level_icon}></Image>青铜Ⅰ
</View> </View>
<View className={styles.info}>答题对错:全对</View> <View className={styles.info}>答题对错:全对</View>
<View className={classNames(styles.info, styles.is_info_2)}>答题用时:21.3s</View> <View className={classNames(styles.info, styles.is_info_2)}>答题用时:{pkResult.initiatorResultTime}s</View>
</View> </View>
<View className={classNames(styles.game_role_right, styles.is_fail)}> <View className={classNames(styles.game_role_right, styles.is_fail)}>
<View className={styles.user_name}>用户名称用户名</View> <View className={styles.user_name}>{pkResult.recipientName}</View>
<View className={styles.user_level}> <View className={styles.user_level}>
<Image src={assetsPk['bronze.png'].u} className={styles.level_icon}></Image>青铜Ⅰ <Image src={assetsPk['bronze.png'].u} className={styles.level_icon}></Image>青铜Ⅰ
</View> </View>
<View className={styles.info}>答题对错:全对</View> <View className={styles.info}>答题对错:{pkResult.recipientErrNum > 0 ? `错${pkResult.recipientErrNum}题` : '全对'}</View>
<View className={classNames(styles.info, styles.is_info_2)}>答题用时:21.3s</View> <View className={classNames(styles.info, styles.is_info_2)}>答题用时:{pkResult.recipientResultTime}s</View>
</View> </View>
</View> </View>
<View className={styles.gap_2}></View> <View className={styles.gap_2}></View>
<View className={styles.footer}> <View className={styles.footer}>
<View className={styles.share}>分享结果</View> <View className={styles.share}>分享结果</View>
<View className={styles.back_main}>提升自己</View> <View className={styles.back_main} onClick={upSelf}>提升自己</View>
</View> </View>
<View className={styles.gap_3}></View> <View className={styles.gap_3}></View>
</View> </View>
......
...@@ -2,7 +2,8 @@ import { Action, Computed, Thunk } from 'easy-peasy' ...@@ -2,7 +2,8 @@ import { Action, Computed, Thunk } from 'easy-peasy'
import { AppStoreModel } from '@/store/store-model' import { AppStoreModel } from '@/store/store-model'
import { import {
type StageDetail, type StageDetail,
type CompleteStageOut type CompleteStageOut,
type PkResult
} from '@/api' } from '@/api'
import { import {
QuestionType, QuestionType,
...@@ -41,6 +42,8 @@ export interface GameModelState { ...@@ -41,6 +42,8 @@ export interface GameModelState {
rightIcon: string | null; rightIcon: string | null;
isBattle: boolean; isBattle: boolean;
pkResult: PkResult | null;
} }
export interface GameModel extends GameModelState { export interface GameModel extends GameModelState {
......
...@@ -103,7 +103,7 @@ const Tutorial = () => { ...@@ -103,7 +103,7 @@ const Tutorial = () => {
loadData() loadData()
preloadGuideImages() preloadGuideImages()
} }
if (isLoadRef.current || stageList.length < 1) { if (isLoadRef.current) {
return return
} }
isLoadRef.current = true isLoadRef.current = true
...@@ -115,6 +115,9 @@ const Tutorial = () => { ...@@ -115,6 +115,9 @@ const Tutorial = () => {
} else { } else {
setStep(0) setStep(0)
// 只有第一关才有 // 只有第一关才有
if (stageList.length < 1) {
return
}
const index = stageList.findIndex(c => c.status === StageStatus.CURRENT) const index = stageList.findIndex(c => c.status === StageStatus.CURRENT)
if (!isMainGuideComplete && index === 0) { if (!isMainGuideComplete && index === 0) {
updateGuideActive(true) updateGuideActive(true)
......
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