Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeekLearnMathWeapp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
frontend
GeekLearnMathWeapp
Commits
7398ce0b
Commit
7398ce0b
authored
Jun 19, 2023
by
raca
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/2023-06-12-v1.1' of…
Merge branch 'feature/2023-06-12-v1.1' of
https://118.24.71.244/hewenhao/GeekLearnMathWeapp
into feature/2023-06-12-v1.1
parents
8988d1f8
0a16dc51
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
203 additions
and
59 deletions
+203
-59
app.config.ts.tpl
scripts/app.config.ts.tpl
+1
-0
pk.ts
src/api/pk.ts
+15
-5
top-header.tsx
src/pages/accept-pk/components/top-header.tsx
+2
-2
index.module.scss
src/pages/accept-pk/index.module.scss
+25
-13
index.tsx
src/pages/accept-pk/index.tsx
+16
-10
battles-modal.tsx
src/pages/battles/components/battles-modal.tsx
+35
-6
model.ts
src/pages/battles/model.ts
+1
-1
index.config.ts
src/pages/game/battle/index.config.ts
+5
-0
index.tsx
src/pages/game/battle/index.tsx
+43
-0
battle-complete.module.scss
src/pages/game/play/components/battle-complete.module.scss
+1
-0
battle-complete.tsx
src/pages/game/play/components/battle-complete.tsx
+11
-5
index.config.ts
src/pages/game/play/index.config.ts
+1
-0
index.tsx
src/pages/game/play/index.tsx
+24
-2
chapter.tsx
src/pages/main/main-underground/chapter.tsx
+12
-7
create-pk.tsx
src/pages/main/main-underground/create-pk.tsx
+2
-2
main-component.tsx
src/pages/main/main-underground/main-component.tsx
+7
-2
pk.tsx
src/pages/main/main-underground/pk-guide/pk.tsx
+0
-2
guide.ts
src/store/modules/guide.ts
+2
-2
No files found.
scripts/app.config.ts.tpl
View file @
7398ce0b
...
...
@@ -15,6 +15,7 @@ export default {
'pages/game/play/index',
'pages/game/wrong/index',
'pages/game/complete/index',
'pages/game/battle/index',
],
subPackages: {
{
packages
}
},
resizable: true,
...
...
src/api/pk.ts
View file @
7398ce0b
import
{
requestAfterSilentLogin
}
from
'@/utils/request'
import
{
handleShare
}
from
'@/utils/share'
export
type
PkParams
=
{
stageId
?:
number
,
...
...
@@ -20,13 +21,14 @@ export type PkDetails = {
winPkNum
:
number
}
export
function
fetchUserDetails
(
data
:
PkParams
)
{
export
async
function
fetchUserDetails
(
data
:
{
initiator
?:
string
;
stageId
?:
string
})
{
const
pp
=
await
handleShare
(
data
)
return
requestAfterSilentLogin
<
PkDetails
,
PkParams
>
((
userInfo
)
=>
({
method
:
'GET'
,
url
:
'/service-idea/pk/personal/stage/detail'
,
data
:
{
stageId
:
data
.
stageId
,
userId
:
data
.
userId
||
userInfo
?.
userId
,
stageId
:
+
(
pp
.
stageId
??
'-1'
)
,
userId
:
+
(
pp
.
initiator
??
userInfo
?.
userId
??
-
1
)
,
}
}))
}
...
...
@@ -99,12 +101,20 @@ export type PkResult = SubmitPkResultParams & {
recipientStar
:
number
;
result
:
string
;
stageName
:
string
;
battleId
:
number
;
}
export
function
getPkResult
(
params
:
number
)
{
return
requestAfterSilentLogin
<
PkResult
,
{
id
:
number
}
>
(()
=>
({
export
async
function
getPkShareResult
(
params
:
{
battleId
:
string
})
{
const
pp
=
await
handleShare
(
params
)
return
await
getPkResult
(
+
pp
.
battleId
)
}
export
async
function
getPkResult
(
params
:
number
)
{
const
r
=
await
requestAfterSilentLogin
<
PkResult
,
{
id
:
number
}
>
(()
=>
({
url
:
'/service-idea/pk/personal/pkDetail'
,
method
:
'GET'
,
data
:
{
id
:
params
}
}))
r
.
data
.
battleId
=
params
return
r
}
src/pages/accept-pk/components/top-header.tsx
View file @
7398ce0b
import
{
View
,
Image
}
from
'@tarojs/components'
import
{
getMenuButtonBoundingClientRect
,
navigateBack
}
from
'@tarojs/taro'
import
{
getMenuButtonBoundingClientRect
,
reLaunch
}
from
'@tarojs/taro'
import
{
useState
,
}
from
'react'
import
classNames
from
'classnames'
import
assetsPk
from
'@/assets/oss/assets-pk'
...
...
@@ -18,7 +18,7 @@ const TopHeader = () => {
}
}
>
<
View
className=
{
styles
.
inner
}
style=
{
{
height
:
`${nav.height + 10}px`
}
}
>
<
Image
src=
{
assetsPk
[
'accept-arrow.png'
].
u
}
className=
{
styles
.
arrow
}
onClick=
{
()
=>
navigateBack
(
)
}
></
Image
>
<
Image
src=
{
assetsPk
[
'accept-arrow.png'
].
u
}
className=
{
styles
.
arrow
}
onClick=
{
()
=>
reLaunch
({
url
:
'/pages/main/main'
}
)
}
></
Image
>
</
View
>
</
View
>
</
View
>
...
...
src/pages/accept-pk/index.module.scss
View file @
7398ce0b
...
...
@@ -6,7 +6,7 @@
display
:
flex
;
flex-direction
:
column
;
height
:
100vh
;
.wrapper
{
position
:
relative
;
z-index
:
10
;
...
...
@@ -15,7 +15,7 @@
background-size
:
100%
;
background-image
:
url(https://cdn.jkwljy.com/pk-math/4K3EkZMaNtrrAwyxpsqiLbV4GkNC/750x1648)
;
background-repeat
:
no-repeat
;
.pkFlash
{
position
:
relative
;
display
:
flex
;
...
...
@@ -50,7 +50,7 @@
opacity
:
1
;
}
}
.flash
{
position
:
absolute
;
width
:
360px
;
...
...
@@ -84,35 +84,35 @@
height
:
80px
;
}
}
.inner
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
.userSection
{
display
:
flex
;
gap
:
12px
;
font-weight
:
600
;
margin-bottom
:
12px
;
align-items
:
flex-end
;
.userName
{
font-size
:
48px
;
}
.challenge
{
font-size
:
40px
;
}
}
}
.avatar
{
width
:
248px
;
height
:
248px
;
margin
:
48px
0
30px
;
}
.record
{
width
:
440px
;
background
:
linear-gradient
(
270deg
,
rgba
(
83
,
55
,
170
,
0
)
0%
,
#5134A9
46%
,
rgba
(
82
,
53
,
169
,
0
)
100%
);
...
...
@@ -123,29 +123,41 @@
gap
:
8px
;
letter-spacing
:
2px
;
padding
:
12px
0
;
.rank
{
display
:
flex
;
align-items
:
center
;
gap
:
6px
;
.badgeIcon
{
width
:
60px
;
height
:
60px
;
}
}
}
.bottom
{
bottom
:
24px
;
position
:
fixed
;
left
:
50%
;
transform
:
translateX
(
-50%
);
.clickImage
{
width
:
532px
;
height
:
112px
;
margin-bottom
:
50px
;
&
.disabled
{
background
:
#E2E6ED
;
border-radius
:
56px
;
font-size
:
40px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
font-weight
:
600
;
color
:
#C2C8D1
;
line-height
:
56px
;
}
}
}
}
...
...
src/pages/accept-pk/index.tsx
View file @
7398ce0b
...
...
@@ -4,7 +4,8 @@ import { useBoolean } from '@/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
assetsPk
from
'@/assets/oss/assets-pk'
import
assetsMainNext
from
'@/assets/oss/assets-main-next'
import
{
useRef
}
from
'react'
import
classNames
from
'classnames'
import
{
useRef
,
useMemo
}
from
'react'
import
{
badgeImages
}
from
'../battles/const'
import
styles
from
'./index.module.scss'
import
TopHeader
from
'./components/top-header'
...
...
@@ -26,10 +27,7 @@ const AcceptPk = () => {
useDidShow
(
async
()
=>
{
if
(
router
.
params
.
initiator
&&
router
.
params
.
stageId
)
{
await
fetchUserDetails
({
userId
:
+
router
.
params
.
initiator
,
stageId
:
+
router
.
params
.
stageId
,
})
await
fetchUserDetails
(
router
.
params
)
}
})
...
...
@@ -59,6 +57,10 @@ const AcceptPk = () => {
}
}
const
canGoNext
=
useMemo
(()
=>
{
return
userInfo
.
userId
!==
details
?.
userId
},
[
userInfo
,
details
])
return
(
<
View
className=
{
styles
.
container
}
>
<
TopHeader
/>
...
...
@@ -124,11 +126,15 @@ const AcceptPk = () => {
</
View
>
<
View
className=
{
styles
.
bottom
}
>
<
Image
className=
{
styles
.
clickImage
}
onClick=
{
handleClick
}
src=
{
assetsPk
[
'accept-click.png'
].
u
}
/>
{
canGoNext
?
(
<
Image
className=
{
styles
.
clickImage
}
onClick=
{
handleClick
}
src=
{
assetsPk
[
'accept-click.png'
].
u
}
/>
)
:
(
<
View
className=
{
classNames
(
styles
.
clickImage
,
styles
.
disabled
)
}
>
无法和自己PK哦~
</
View
>
)
}
</
View
>
</
View
>
...
...
src/pages/battles/components/battles-modal.tsx
View file @
7398ce0b
import
{
useEffect
}
from
'react'
import
{
useEffect
,
useState
,
useMemo
}
from
'react'
import
{
View
,
Text
,
Image
,
ScrollView
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
Modal
from
'@/components/Modal'
...
...
@@ -13,15 +13,44 @@ import gameResultStyles from './game-result.module.scss'
import
{
rankTranslate
}
from
'../utils'
const
BattlesModal
=
()
=>
{
const
pkDetails
=
useStoreState
((
state
)
=>
state
.
userModel
.
pkDetails
)
const
isVisible
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
modalIsVisible
)
const
setModalIsVisible
=
useStoreActions
(
(
actions
)
=>
actions
.
battlesModel
.
setModalIsVisible
const
isVisible
=
useStoreState
(
state
=>
state
.
battlesModel
.
modalIsVisible
)
const
setModalIsVisible
=
useStoreActions
(
actions
=>
actions
.
battlesModel
.
setModalIsVisible
)
const
summary
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
summary
)
const
pkGuideActive
=
useStoreState
(
state
=>
state
.
guideModel
.
pkGuideActive
)
const
groupGuideActive
=
useStoreState
(
state
=>
state
.
guideModel
.
groupGuideActive
)
const
mainGuideActive
=
useStoreState
(
state
=>
state
.
guideModel
.
mainGuideActive
)
const
joinDeferred
=
useStoreState
(
state
=>
state
.
userModel
.
joinDefered
)
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
const
[
enable
,
setEnable
]
=
useState
(
false
)
useEffect
(()
=>
{
if
(
!
joinDeferred
)
{
setEnable
(
false
)
}
else
{
joinDeferred
.
getPromise
().
then
(()
=>
{
setEnable
(
true
)
})
}
return
()
=>
{
setEnable
(
false
)
}
},
[
joinDeferred
])
const
fetchUserSummary
=
useStoreActions
(
(
actions
)
=>
actions
.
battlesModel
.
fetchUserSummary
)
useEffect
(()
=>
{
fetchUserSummary
({})
},
[
fetchUserSummary
])
const
hasAreaAndGrad
=
useMemo
(()
=>
!!
userInfo
.
city
&&
!!
userInfo
.
grade
,
[
userInfo
])
return
(
<
Modal
isVisible=
{
isVisible
}
isVisible=
{
hasAreaAndGrad
&&
enable
&&
!
pkGuideActive
&&
!
groupGuideActive
&&
!
mainGuideActive
&&
isVisible
}
wrapClassName=
{
styles
.
modalWrap
}
bodyClassName=
{
styles
.
modalBody
}
onClose=
{
()
=>
setModalIsVisible
(
false
)
}
...
...
src/pages/battles/model.ts
View file @
7398ce0b
...
...
@@ -8,7 +8,7 @@ interface BattlesModel {
setModalIsVisible
:
Action
<
BattlesModel
,
boolean
>
;
setUserDetails
:
Action
<
BattlesModel
,
PkDetails
>
;
setUserSummary
:
Action
<
BattlesModel
,
PkSummary
>
;
fetchUserDetails
:
Thunk
<
BattlesModel
,
PkParams
>
;
fetchUserDetails
:
Thunk
<
BattlesModel
,
{
initiator
?:
string
;
stageId
?:
string
}
>
;
fetchUserSummary
:
Thunk
<
BattlesModel
,
PkParams
>
;
}
...
...
src/pages/game/battle/index.config.ts
0 → 100644
View file @
7398ce0b
export
default
definePageConfig
({
navigationBarTitleText
:
'pk-math'
,
navigationStyle
:
'custom'
,
enableShareAppMessage
:
true
,
})
src/pages/game/battle/index.tsx
0 → 100644
View file @
7398ce0b
import
{
useRouter
,
useDidShow
}
from
'@tarojs/taro'
import
{
useFetch
,
useShare
}
from
'@/hooks'
import
{
useCallback
,
}
from
'react'
import
{
getPkShareResult
}
from
'@/api'
import
BattleComplete
from
'../play/components/battle-complete'
const
BattleIndex
=
()
=>
{
const
router
=
useRouter
<
{
battleId
:
string
}
>
()
const
[
dataSource
,
loadData
]
=
useFetch
(
getPkShareResult
,
useCallback
(()
=>
{
return
router
.
params
},
[
router
.
params
]))
useDidShow
(()
=>
{
loadData
()
})
const
shareParams
=
useCallback
(()
=>
{
if
(
dataSource
.
detail
)
{
return
{
title
:
'听说你的能力不错,我们battle一下'
,
path
:
'/pages/game/battle/index'
,
pageParams
:
{
battleId
:
dataSource
.
detail
.
battleId
}
}
}
return
{
title
:
'邀请你来一起PKmath,快乐提升哦'
,
path
:
'pages/main/main'
,
imageUrl
:
'https://cdn.jkwljy.com/pk-math/4LHyu63hfeteRxAKNb2cj2uCrahf/420x336'
,
}
},
[
dataSource
.
detail
])
useShare
(
shareParams
)
return
(
<
BattleComplete
pkResult=
{
dataSource
.
detail
}
></
BattleComplete
>
)
}
export
default
BattleIndex
src/pages/game/play/components/battle-complete.module.scss
View file @
7398ce0b
...
...
@@ -219,6 +219,7 @@
font-weight
:
500
;
color
:
#FFFFFF
;
line-height
:
50px
;
background-color
:
transparent
;
}
.back_main
{
...
...
src/pages/game/play/components/battle-complete.tsx
View file @
7398ce0b
import
{
View
,
Image
}
from
'@tarojs/components'
import
{
View
,
Image
,
Button
}
from
'@tarojs/components'
import
assetsGame
from
'@/assets/oss/assets-game'
import
assetsPrepare
from
'@/assets/oss/assets-prepare'
import
classNames
from
'classnames'
import
{
useMemo
}
from
'react'
import
{
reLaunch
}
from
'@tarojs/taro'
import
{
useStore
State
}
from
'@/store/hooks'
import
{
useStore
Actions
}
from
'@/store/hooks'
import
{
getUserRank
}
from
'@/utils'
import
{
getUserLevelIcon
,
getUserLevelName
,
getUserLevelSubName
}
from
'@/constants'
import
{
PkResult
}
from
'@/api'
import
styles
from
'./battle-complete.module.scss'
const
BattleComplete
=
()
=>
{
const
pkResult
=
useStoreState
(
states
=>
states
.
gameModel
.
pkResult
)
type
BattleCompleteProps
=
{
pkResult
:
PkResult
|
null
}
const
BattleComplete
=
({
pkResult
}:
BattleCompleteProps
)
=>
{
const
updateState
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
updateState
)
const
upSelf
=
()
=>
{
updateState
({
isCreatePkShow
:
false
,
currentPkStage
:
null
})
reLaunch
({
url
:
'/pages/main/main'
})
...
...
@@ -73,7 +79,7 @@ const BattleComplete = () => {
<
View
className=
{
styles
.
gap_2
}
></
View
>
<
View
className=
{
styles
.
footer
}
>
<
View
className=
{
styles
.
share
}
>
分享结果
</
View
>
<
Button
className=
{
styles
.
share
}
openType=
"share"
>
分享结果
</
Button
>
<
View
className=
{
styles
.
back_main
}
onClick=
{
upSelf
}
>
提升自己
</
View
>
</
View
>
<
View
className=
{
styles
.
gap_3
}
></
View
>
...
...
src/pages/game/play/index.config.ts
View file @
7398ce0b
export
default
definePageConfig
({
navigationBarTitleText
:
'pk-math'
,
navigationStyle
:
'custom'
,
enableShareAppMessage
:
true
,
// renderer: 'skyline',
usingComponents
:
{
'count-up-time'
:
'../../../native-components/count-up/index'
,
...
...
src/pages/game/play/index.tsx
View file @
7398ce0b
import
{
ScrollView
,
Image
}
from
'@tarojs/components'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
preloadImage
}
from
'@/utils/preload-image'
import
{
useEffect
,
useMemo
}
from
'react'
import
{
useEffect
,
use
Callback
,
use
Memo
}
from
'react'
import
{
useDidShow
,
enableAlertBeforeUnload
,
disableAlertBeforeUnload
,
useRouter
}
from
'@tarojs/taro'
import
assets
from
'@/assets/oss/assets-complete'
import
{
EyeProtectionView
}
from
'@/components'
import
{
useShare
}
from
'@/hooks'
import
ModalContinue
from
'./components/modal-continue'
import
PageHead
from
'./components/page-head'
...
...
@@ -42,6 +43,7 @@ const GamePlay = () => {
},
[
questionList
,
currentQuestionIndex
])
const
clearUserAnswer
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
clearUserAnswer
)
const
handleGoNext
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
handleGoNext
)
const
pkResult
=
useStoreState
(
states
=>
states
.
gameModel
.
pkResult
)
const
router
=
useRouter
()
...
...
@@ -49,6 +51,26 @@ const GamePlay = () => {
return
router
.
params
.
isBattle
===
'true'
},
[
router
])
const
shareParams
=
useCallback
(()
=>
{
if
(
pkResult
)
{
return
{
title
:
'听说你的能力不错,我们battle一下'
,
path
:
'/pages/game/battle/index'
,
pageParams
:
{
battleId
:
pkResult
.
battleId
}
}
}
return
{
title
:
'邀请你来一起PKmath,快乐提升哦'
,
path
:
'pages/main/main'
,
imageUrl
:
'https://cdn.jkwljy.com/pk-math/4LHyu63hfeteRxAKNb2cj2uCrahf/420x336'
,
}
},
[
pkResult
])
useShare
(
shareParams
)
useEffect
(()
=>
{
enableAlertBeforeUnload
({
message
:
'还没有答完哦,确定要离开吗?'
,
...
...
@@ -97,7 +119,7 @@ const GamePlay = () => {
)
}
</
EyeProtectionView
>
<
ModalContinue
/>
<
BattleComplete
/>
<
BattleComplete
pkResult=
{
pkResult
}
/>
</>
)
}
...
...
src/pages/main/main-underground/chapter.tsx
View file @
7398ce0b
import
{
View
,
Image
}
from
'@tarojs/components'
import
assetsMainNext
from
'@/assets/oss/assets-main-next'
import
{
getMenuButtonBoundingClientRect
,
getSystemInfoSync
,
navigateTo
}
from
'@tarojs/taro'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
useMemo
}
from
'react'
import
styles
from
'./chapter.module.scss'
...
...
@@ -8,6 +9,8 @@ import styles from './chapter.module.scss'
const
MainHeader
=
()
=>
{
const
nav
=
useMemo
(
getMenuButtonBoundingClientRect
,
[])
const
sys
=
useMemo
(
getSystemInfoSync
,
[])
const
completeAddDeskGuide
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
completeAddDeskGuide
)
const
isAddDeskTopGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isAddDeskTopGuideComplete
)
const
guideStyle
=
useMemo
(()
=>
{
return
{
...
...
@@ -33,14 +36,16 @@ const MainHeader = () => {
地心历险记
</
View
>
</
View
>
<
View
className=
{
styles
.
guide
}
>
<
View
className=
{
styles
.
dot
}
></
View
>
<
View
className=
{
styles
.
guideText
}
>
保存【PKMath】到桌面,下次练习更方便。
</
View
>
<
View
className=
{
styles
.
guideRight
}
style=
{
guideStyle
}
>
<
Image
src=
{
assetsMainNext
[
'finger.png'
].
u
}
className=
{
styles
.
finger
}
style=
{
fingerStyle
}
></
Image
>
<
Image
src=
{
assetsMainNext
[
'close.png'
].
u
}
className=
{
styles
.
close
}
></
Image
>
{
!
isAddDeskTopGuideComplete
&&
(
<
View
className=
{
styles
.
guide
}
>
<
View
className=
{
styles
.
dot
}
></
View
>
<
View
className=
{
styles
.
guideText
}
>
保存【PKMath】到桌面,下次练习更方便。
</
View
>
<
View
className=
{
styles
.
guideRight
}
style=
{
guideStyle
}
>
<
Image
src=
{
assetsMainNext
[
'finger.png'
].
u
}
className=
{
styles
.
finger
}
style=
{
fingerStyle
}
></
Image
>
<
Image
src=
{
assetsMainNext
[
'close.png'
].
u
}
className=
{
styles
.
close
}
onClick=
{
()
=>
completeAddDeskGuide
()
}
></
Image
>
</
View
>
</
View
>
</
View
>
)
}
<
View
className=
{
styles
.
pk
}
onClick=
{
()
=>
navigateTo
({
url
:
'/pages/battles/index'
})
}
>
<
View
className=
{
styles
.
dot
}
></
View
>
...
...
src/pages/main/main-underground/create-pk.tsx
View file @
7398ce0b
...
...
@@ -42,8 +42,8 @@ const CreatePk = (props: CreatePkProps) => {
const
[
dataSource
,
loadData
]
=
useFetch
(
fetchUserDetails
,
useCallback
(()
=>
{
if
(
!
currentPkStage
)
return
null
return
{
userId
:
userInfo
.
userId
,
stageId
:
currentPkStage
.
id
initiator
:
`
${
userInfo
.
userId
}
`
,
stageId
:
`
${
currentPkStage
.
id
}
`
}
},
[
currentPkStage
,
userInfo
]))
...
...
src/pages/main/main-underground/main-component.tsx
View file @
7398ce0b
...
...
@@ -33,6 +33,7 @@ const MainPage = () => {
const
isReady
=
useStoreState
(
state
=>
state
.
mainModel
.
isReady
)
const
isGroupGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isGroupGuideComplete
)
const
isMainGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isMainGuideComplete
)
const
isPkGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isPkGuideComplete
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
updateGroupGuideActive
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
updateGroupGuideActive
)
const
fetchTribeInfo
=
useStoreActions
(
actions
=>
actions
.
groupModel
.
fetchTribeInfo
)
...
...
@@ -66,8 +67,12 @@ const MainPage = () => {
}
const
currentIndex
=
stageList
.
findIndex
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
)
const
point
=
await
fetchAccount
()
if
(
!
isPkGuideComplete
&&
currentIndex
<=
2
)
{
return
}
const
point
=
await
fetchAccount
()
if
(
point
<
50
||
currentIndex
>=
3
)
{
const
res
=
await
fetchTribeInfo
()
if
(
!
res
?.
id
)
{
...
...
@@ -76,7 +81,7 @@ const MainPage = () => {
}
}
fn
()
},
[
fetchAccount
,
isGroupGuideComplete
,
stageList
,
updateGroupGuideActive
,
userInfo
,
fetchTribeInfo
,
isMainGuideComplete
,
isFocus
])
},
[
fetchAccount
,
is
PkGuideComplete
,
is
GroupGuideComplete
,
stageList
,
updateGroupGuideActive
,
userInfo
,
fetchTribeInfo
,
isMainGuideComplete
,
isFocus
])
onAppHide
(()
=>
{
player
.
pause
()
...
...
src/pages/main/main-underground/pk-guide/pk.tsx
View file @
7398ce0b
...
...
@@ -13,8 +13,6 @@ const Scene = () => {
nextPkGuide
()
}
console
.
log
(
pkGuideStep
,
11111111
)
if
(
!
pkGuideActive
||
pkGuideStep
!==
3
)
{
return
null
}
...
...
src/store/modules/guide.ts
View file @
7398ce0b
...
...
@@ -128,12 +128,12 @@ const guideModel: GuideModel = {
}),
completeStoreGuide
:
thunk
(
async
(
actions
)
=>
{
actions
.
updateState
({
isStoreGuideComplete
:
true
,
storeGuideStep
:
-
1
})
actions
.
updateState
({
isStoreGuideComplete
:
true
,
storeGuideStep
:
-
1
,
storeGuideActive
:
false
})
updateStorage
(
StorageKeys
.
isStoreGuideComplete
,
true
)
}),
completeGroupGuide
:
thunk
(
async
(
actions
)
=>
{
actions
.
updateState
({
isGroupGuideComplete
:
true
,
groupGuideStep
:
-
1
})
actions
.
updateState
({
isGroupGuideComplete
:
true
,
groupGuideStep
:
-
1
,
groupGuideActive
:
false
})
updateStorage
(
StorageKeys
.
isGroupGuideComplete
,
true
)
}),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment