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
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
179 additions
and
35 deletions
+179
-35
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
+12
-0
index.tsx
src/pages/accept-pk/index.tsx
+11
-5
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
+6
-1
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 {
...
@@ -15,6 +15,7 @@ export default {
'pages/game/play/index',
'pages/game/play/index',
'pages/game/wrong/index',
'pages/game/wrong/index',
'pages/game/complete/index',
'pages/game/complete/index',
'pages/game/battle/index',
],
],
subPackages: {
{
packages
}
},
subPackages: {
{
packages
}
},
resizable: true,
resizable: true,
...
...
src/api/pk.ts
View file @
7398ce0b
import
{
requestAfterSilentLogin
}
from
'@/utils/request'
import
{
requestAfterSilentLogin
}
from
'@/utils/request'
import
{
handleShare
}
from
'@/utils/share'
export
type
PkParams
=
{
export
type
PkParams
=
{
stageId
?:
number
,
stageId
?:
number
,
...
@@ -20,13 +21,14 @@ export type PkDetails = {
...
@@ -20,13 +21,14 @@ export type PkDetails = {
winPkNum
:
number
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
)
=>
({
return
requestAfterSilentLogin
<
PkDetails
,
PkParams
>
((
userInfo
)
=>
({
method
:
'GET'
,
method
:
'GET'
,
url
:
'/service-idea/pk/personal/stage/detail'
,
url
:
'/service-idea/pk/personal/stage/detail'
,
data
:
{
data
:
{
stageId
:
data
.
stageId
,
stageId
:
+
(
pp
.
stageId
??
'-1'
)
,
userId
:
data
.
userId
||
userInfo
?.
userId
,
userId
:
+
(
pp
.
initiator
??
userInfo
?.
userId
??
-
1
)
,
}
}
}))
}))
}
}
...
@@ -99,12 +101,20 @@ export type PkResult = SubmitPkResultParams & {
...
@@ -99,12 +101,20 @@ export type PkResult = SubmitPkResultParams & {
recipientStar
:
number
;
recipientStar
:
number
;
result
:
string
;
result
:
string
;
stageName
:
string
;
stageName
:
string
;
battleId
:
number
;
}
}
export
function
getPkResult
(
params
:
number
)
{
export
async
function
getPkShareResult
(
params
:
{
battleId
:
string
})
{
return
requestAfterSilentLogin
<
PkResult
,
{
id
:
number
}
>
(()
=>
({
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'
,
url
:
'/service-idea/pk/personal/pkDetail'
,
method
:
'GET'
,
method
:
'GET'
,
data
:
{
id
:
params
}
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
{
View
,
Image
}
from
'@tarojs/components'
import
{
getMenuButtonBoundingClientRect
,
navigateBack
}
from
'@tarojs/taro'
import
{
getMenuButtonBoundingClientRect
,
reLaunch
}
from
'@tarojs/taro'
import
{
useState
,
}
from
'react'
import
{
useState
,
}
from
'react'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
assetsPk
from
'@/assets/oss/assets-pk'
import
assetsPk
from
'@/assets/oss/assets-pk'
...
@@ -18,7 +18,7 @@ const TopHeader = () => {
...
@@ -18,7 +18,7 @@ const TopHeader = () => {
}
}
}
}
>
>
<
View
className=
{
styles
.
inner
}
style=
{
{
height
:
`${nav.height + 10}px`
}
}
>
<
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
>
</
View
>
</
View
>
</
View
>
...
...
src/pages/accept-pk/index.module.scss
View file @
7398ce0b
...
@@ -146,6 +146,18 @@
...
@@ -146,6 +146,18 @@
width
:
532px
;
width
:
532px
;
height
:
112px
;
height
:
112px
;
margin-bottom
:
50px
;
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'
...
@@ -4,7 +4,8 @@ import { useBoolean } from '@/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
assetsPk
from
'@/assets/oss/assets-pk'
import
assetsPk
from
'@/assets/oss/assets-pk'
import
assetsMainNext
from
'@/assets/oss/assets-main-next'
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
{
badgeImages
}
from
'../battles/const'
import
styles
from
'./index.module.scss'
import
styles
from
'./index.module.scss'
import
TopHeader
from
'./components/top-header'
import
TopHeader
from
'./components/top-header'
...
@@ -26,10 +27,7 @@ const AcceptPk = () => {
...
@@ -26,10 +27,7 @@ const AcceptPk = () => {
useDidShow
(
async
()
=>
{
useDidShow
(
async
()
=>
{
if
(
router
.
params
.
initiator
&&
router
.
params
.
stageId
)
{
if
(
router
.
params
.
initiator
&&
router
.
params
.
stageId
)
{
await
fetchUserDetails
({
await
fetchUserDetails
(
router
.
params
)
userId
:
+
router
.
params
.
initiator
,
stageId
:
+
router
.
params
.
stageId
,
})
}
}
})
})
...
@@ -59,6 +57,10 @@ const AcceptPk = () => {
...
@@ -59,6 +57,10 @@ const AcceptPk = () => {
}
}
}
}
const
canGoNext
=
useMemo
(()
=>
{
return
userInfo
.
userId
!==
details
?.
userId
},
[
userInfo
,
details
])
return
(
return
(
<
View
className=
{
styles
.
container
}
>
<
View
className=
{
styles
.
container
}
>
<
TopHeader
/>
<
TopHeader
/>
...
@@ -124,11 +126,15 @@ const AcceptPk = () => {
...
@@ -124,11 +126,15 @@ const AcceptPk = () => {
</
View
>
</
View
>
<
View
className=
{
styles
.
bottom
}
>
<
View
className=
{
styles
.
bottom
}
>
{
canGoNext
?
(
<
Image
<
Image
className=
{
styles
.
clickImage
}
className=
{
styles
.
clickImage
}
onClick=
{
handleClick
}
onClick=
{
handleClick
}
src=
{
assetsPk
[
'accept-click.png'
].
u
}
src=
{
assetsPk
[
'accept-click.png'
].
u
}
/>
/>
)
:
(
<
View
className=
{
classNames
(
styles
.
clickImage
,
styles
.
disabled
)
}
>
无法和自己PK哦~
</
View
>
)
}
</
View
>
</
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
{
View
,
Text
,
Image
,
ScrollView
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
Modal
from
'@/components/Modal'
import
Modal
from
'@/components/Modal'
...
@@ -13,15 +13,44 @@ import gameResultStyles from './game-result.module.scss'
...
@@ -13,15 +13,44 @@ import gameResultStyles from './game-result.module.scss'
import
{
rankTranslate
}
from
'../utils'
import
{
rankTranslate
}
from
'../utils'
const
BattlesModal
=
()
=>
{
const
BattlesModal
=
()
=>
{
const
pkDetails
=
useStoreState
((
state
)
=>
state
.
userModel
.
pkDetails
)
const
isVisible
=
useStoreState
(
state
=>
state
.
battlesModel
.
modalIsVisible
)
const
isVisible
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
modalIsVisible
)
const
setModalIsVisible
=
useStoreActions
(
actions
=>
actions
.
battlesModel
.
setModalIsVisible
)
const
setModalIsVisible
=
useStoreActions
(
const
summary
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
summary
)
(
actions
)
=>
actions
.
battlesModel
.
setModalIsVisible
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
(
return
(
<
Modal
<
Modal
isVisible=
{
isVisible
}
isVisible=
{
hasAreaAndGrad
&&
enable
&&
!
pkGuideActive
&&
!
groupGuideActive
&&
!
mainGuideActive
&&
isVisible
}
wrapClassName=
{
styles
.
modalWrap
}
wrapClassName=
{
styles
.
modalWrap
}
bodyClassName=
{
styles
.
modalBody
}
bodyClassName=
{
styles
.
modalBody
}
onClose=
{
()
=>
setModalIsVisible
(
false
)
}
onClose=
{
()
=>
setModalIsVisible
(
false
)
}
...
...
src/pages/battles/model.ts
View file @
7398ce0b
...
@@ -8,7 +8,7 @@ interface BattlesModel {
...
@@ -8,7 +8,7 @@ interface BattlesModel {
setModalIsVisible
:
Action
<
BattlesModel
,
boolean
>
;
setModalIsVisible
:
Action
<
BattlesModel
,
boolean
>
;
setUserDetails
:
Action
<
BattlesModel
,
PkDetails
>
;
setUserDetails
:
Action
<
BattlesModel
,
PkDetails
>
;
setUserSummary
:
Action
<
BattlesModel
,
PkSummary
>
;
setUserSummary
:
Action
<
BattlesModel
,
PkSummary
>
;
fetchUserDetails
:
Thunk
<
BattlesModel
,
PkParams
>
;
fetchUserDetails
:
Thunk
<
BattlesModel
,
{
initiator
?:
string
;
stageId
?:
string
}
>
;
fetchUserSummary
:
Thunk
<
BattlesModel
,
PkParams
>
;
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 @@
...
@@ -219,6 +219,7 @@
font-weight
:
500
;
font-weight
:
500
;
color
:
#FFFFFF
;
color
:
#FFFFFF
;
line-height
:
50px
;
line-height
:
50px
;
background-color
:
transparent
;
}
}
.back_main
{
.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
assetsGame
from
'@/assets/oss/assets-game'
import
assetsPrepare
from
'@/assets/oss/assets-prepare'
import
assetsPrepare
from
'@/assets/oss/assets-prepare'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
{
useMemo
}
from
'react'
import
{
useMemo
}
from
'react'
import
{
reLaunch
}
from
'@tarojs/taro'
import
{
reLaunch
}
from
'@tarojs/taro'
import
{
useStore
State
}
from
'@/store/hooks'
import
{
useStore
Actions
}
from
'@/store/hooks'
import
{
getUserRank
}
from
'@/utils'
import
{
getUserRank
}
from
'@/utils'
import
{
getUserLevelIcon
,
getUserLevelName
,
getUserLevelSubName
}
from
'@/constants'
import
{
getUserLevelIcon
,
getUserLevelName
,
getUserLevelSubName
}
from
'@/constants'
import
{
PkResult
}
from
'@/api'
import
styles
from
'./battle-complete.module.scss'
import
styles
from
'./battle-complete.module.scss'
const
BattleComplete
=
()
=>
{
type
BattleCompleteProps
=
{
const
pkResult
=
useStoreState
(
states
=>
states
.
gameModel
.
pkResult
)
pkResult
:
PkResult
|
null
}
const
BattleComplete
=
({
pkResult
}:
BattleCompleteProps
)
=>
{
const
updateState
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
updateState
)
const
upSelf
=
()
=>
{
const
upSelf
=
()
=>
{
updateState
({
isCreatePkShow
:
false
,
currentPkStage
:
null
})
reLaunch
({
reLaunch
({
url
:
'/pages/main/main'
url
:
'/pages/main/main'
})
})
...
@@ -73,7 +79,7 @@ const BattleComplete = () => {
...
@@ -73,7 +79,7 @@ const BattleComplete = () => {
<
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
>
<
Button
className=
{
styles
.
share
}
openType=
"share"
>
分享结果
</
Button
>
<
View
className=
{
styles
.
back_main
}
onClick=
{
upSelf
}
>
提升自己
</
View
>
<
View
className=
{
styles
.
back_main
}
onClick=
{
upSelf
}
>
提升自己
</
View
>
</
View
>
</
View
>
<
View
className=
{
styles
.
gap_3
}
></
View
>
<
View
className=
{
styles
.
gap_3
}
></
View
>
...
...
src/pages/game/play/index.config.ts
View file @
7398ce0b
export
default
definePageConfig
({
export
default
definePageConfig
({
navigationBarTitleText
:
'pk-math'
,
navigationBarTitleText
:
'pk-math'
,
navigationStyle
:
'custom'
,
navigationStyle
:
'custom'
,
enableShareAppMessage
:
true
,
// renderer: 'skyline',
// renderer: 'skyline',
usingComponents
:
{
usingComponents
:
{
'count-up-time'
:
'../../../native-components/count-up/index'
,
'count-up-time'
:
'../../../native-components/count-up/index'
,
...
...
src/pages/game/play/index.tsx
View file @
7398ce0b
import
{
ScrollView
,
Image
}
from
'@tarojs/components'
import
{
ScrollView
,
Image
}
from
'@tarojs/components'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
preloadImage
}
from
'@/utils/preload-image'
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
{
useDidShow
,
enableAlertBeforeUnload
,
disableAlertBeforeUnload
,
useRouter
}
from
'@tarojs/taro'
import
assets
from
'@/assets/oss/assets-complete'
import
assets
from
'@/assets/oss/assets-complete'
import
{
EyeProtectionView
}
from
'@/components'
import
{
EyeProtectionView
}
from
'@/components'
import
{
useShare
}
from
'@/hooks'
import
ModalContinue
from
'./components/modal-continue'
import
ModalContinue
from
'./components/modal-continue'
import
PageHead
from
'./components/page-head'
import
PageHead
from
'./components/page-head'
...
@@ -42,6 +43,7 @@ const GamePlay = () => {
...
@@ -42,6 +43,7 @@ const GamePlay = () => {
},
[
questionList
,
currentQuestionIndex
])
},
[
questionList
,
currentQuestionIndex
])
const
clearUserAnswer
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
clearUserAnswer
)
const
clearUserAnswer
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
clearUserAnswer
)
const
handleGoNext
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
handleGoNext
)
const
handleGoNext
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
handleGoNext
)
const
pkResult
=
useStoreState
(
states
=>
states
.
gameModel
.
pkResult
)
const
router
=
useRouter
()
const
router
=
useRouter
()
...
@@ -49,6 +51,26 @@ const GamePlay = () => {
...
@@ -49,6 +51,26 @@ const GamePlay = () => {
return
router
.
params
.
isBattle
===
'true'
return
router
.
params
.
isBattle
===
'true'
},
[
router
])
},
[
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
(()
=>
{
useEffect
(()
=>
{
enableAlertBeforeUnload
({
enableAlertBeforeUnload
({
message
:
'还没有答完哦,确定要离开吗?'
,
message
:
'还没有答完哦,确定要离开吗?'
,
...
@@ -97,7 +119,7 @@ const GamePlay = () => {
...
@@ -97,7 +119,7 @@ const GamePlay = () => {
)
}
)
}
</
EyeProtectionView
>
</
EyeProtectionView
>
<
ModalContinue
/>
<
ModalContinue
/>
<
BattleComplete
/>
<
BattleComplete
pkResult=
{
pkResult
}
/>
</>
</>
)
)
}
}
...
...
src/pages/main/main-underground/chapter.tsx
View file @
7398ce0b
import
{
View
,
Image
}
from
'@tarojs/components'
import
{
View
,
Image
}
from
'@tarojs/components'
import
assetsMainNext
from
'@/assets/oss/assets-main-next'
import
assetsMainNext
from
'@/assets/oss/assets-main-next'
import
{
getMenuButtonBoundingClientRect
,
getSystemInfoSync
,
navigateTo
}
from
'@tarojs/taro'
import
{
getMenuButtonBoundingClientRect
,
getSystemInfoSync
,
navigateTo
}
from
'@tarojs/taro'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
useMemo
}
from
'react'
import
{
useMemo
}
from
'react'
import
styles
from
'./chapter.module.scss'
import
styles
from
'./chapter.module.scss'
...
@@ -8,6 +9,8 @@ import styles from './chapter.module.scss'
...
@@ -8,6 +9,8 @@ import styles from './chapter.module.scss'
const
MainHeader
=
()
=>
{
const
MainHeader
=
()
=>
{
const
nav
=
useMemo
(
getMenuButtonBoundingClientRect
,
[])
const
nav
=
useMemo
(
getMenuButtonBoundingClientRect
,
[])
const
sys
=
useMemo
(
getSystemInfoSync
,
[])
const
sys
=
useMemo
(
getSystemInfoSync
,
[])
const
completeAddDeskGuide
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
completeAddDeskGuide
)
const
isAddDeskTopGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isAddDeskTopGuideComplete
)
const
guideStyle
=
useMemo
(()
=>
{
const
guideStyle
=
useMemo
(()
=>
{
return
{
return
{
...
@@ -33,14 +36,16 @@ const MainHeader = () => {
...
@@ -33,14 +36,16 @@ const MainHeader = () => {
地心历险记
地心历险记
</
View
>
</
View
>
</
View
>
</
View
>
{
!
isAddDeskTopGuideComplete
&&
(
<
View
className=
{
styles
.
guide
}
>
<
View
className=
{
styles
.
guide
}
>
<
View
className=
{
styles
.
dot
}
></
View
>
<
View
className=
{
styles
.
dot
}
></
View
>
<
View
className=
{
styles
.
guideText
}
>
保存【PKMath】到桌面,下次练习更方便。
</
View
>
<
View
className=
{
styles
.
guideText
}
>
保存【PKMath】到桌面,下次练习更方便。
</
View
>
<
View
className=
{
styles
.
guideRight
}
style=
{
guideStyle
}
>
<
View
className=
{
styles
.
guideRight
}
style=
{
guideStyle
}
>
<
Image
src=
{
assetsMainNext
[
'finger.png'
].
u
}
className=
{
styles
.
finger
}
style=
{
fingerStyle
}
></
Image
>
<
Image
src=
{
assetsMainNext
[
'finger.png'
].
u
}
className=
{
styles
.
finger
}
style=
{
fingerStyle
}
></
Image
>
<
Image
src=
{
assetsMainNext
[
'close.png'
].
u
}
className=
{
styles
.
close
}
></
Image
>
<
Image
src=
{
assetsMainNext
[
'close.png'
].
u
}
className=
{
styles
.
close
}
onClick=
{
()
=>
completeAddDeskGuide
()
}
></
Image
>
</
View
>
</
View
>
</
View
>
</
View
>
)
}
<
View
className=
{
styles
.
pk
}
onClick=
{
()
=>
navigateTo
({
url
:
'/pages/battles/index'
})
}
>
<
View
className=
{
styles
.
pk
}
onClick=
{
()
=>
navigateTo
({
url
:
'/pages/battles/index'
})
}
>
<
View
className=
{
styles
.
dot
}
></
View
>
<
View
className=
{
styles
.
dot
}
></
View
>
...
...
src/pages/main/main-underground/create-pk.tsx
View file @
7398ce0b
...
@@ -42,8 +42,8 @@ const CreatePk = (props: CreatePkProps) => {
...
@@ -42,8 +42,8 @@ const CreatePk = (props: CreatePkProps) => {
const
[
dataSource
,
loadData
]
=
useFetch
(
fetchUserDetails
,
useCallback
(()
=>
{
const
[
dataSource
,
loadData
]
=
useFetch
(
fetchUserDetails
,
useCallback
(()
=>
{
if
(
!
currentPkStage
)
return
null
if
(
!
currentPkStage
)
return
null
return
{
return
{
userId
:
userInfo
.
userId
,
initiator
:
`
${
userInfo
.
userId
}
`
,
stageId
:
currentPkStage
.
id
stageId
:
`
${
currentPkStage
.
id
}
`
}
}
},
[
currentPkStage
,
userInfo
]))
},
[
currentPkStage
,
userInfo
]))
...
...
src/pages/main/main-underground/main-component.tsx
View file @
7398ce0b
...
@@ -33,6 +33,7 @@ const MainPage = () => {
...
@@ -33,6 +33,7 @@ const MainPage = () => {
const
isReady
=
useStoreState
(
state
=>
state
.
mainModel
.
isReady
)
const
isReady
=
useStoreState
(
state
=>
state
.
mainModel
.
isReady
)
const
isGroupGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isGroupGuideComplete
)
const
isGroupGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isGroupGuideComplete
)
const
isMainGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isMainGuideComplete
)
const
isMainGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isMainGuideComplete
)
const
isPkGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isPkGuideComplete
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
updateGroupGuideActive
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
updateGroupGuideActive
)
const
updateGroupGuideActive
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
updateGroupGuideActive
)
const
fetchTribeInfo
=
useStoreActions
(
actions
=>
actions
.
groupModel
.
fetchTribeInfo
)
const
fetchTribeInfo
=
useStoreActions
(
actions
=>
actions
.
groupModel
.
fetchTribeInfo
)
...
@@ -66,8 +67,12 @@ const MainPage = () => {
...
@@ -66,8 +67,12 @@ const MainPage = () => {
}
}
const
currentIndex
=
stageList
.
findIndex
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
)
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
)
{
if
(
point
<
50
||
currentIndex
>=
3
)
{
const
res
=
await
fetchTribeInfo
()
const
res
=
await
fetchTribeInfo
()
if
(
!
res
?.
id
)
{
if
(
!
res
?.
id
)
{
...
@@ -76,7 +81,7 @@ const MainPage = () => {
...
@@ -76,7 +81,7 @@ const MainPage = () => {
}
}
}
}
fn
()
fn
()
},
[
fetchAccount
,
isGroupGuideComplete
,
stageList
,
updateGroupGuideActive
,
userInfo
,
fetchTribeInfo
,
isMainGuideComplete
,
isFocus
])
},
[
fetchAccount
,
is
PkGuideComplete
,
is
GroupGuideComplete
,
stageList
,
updateGroupGuideActive
,
userInfo
,
fetchTribeInfo
,
isMainGuideComplete
,
isFocus
])
onAppHide
(()
=>
{
onAppHide
(()
=>
{
player
.
pause
()
player
.
pause
()
...
...
src/pages/main/main-underground/pk-guide/pk.tsx
View file @
7398ce0b
...
@@ -13,8 +13,6 @@ const Scene = () => {
...
@@ -13,8 +13,6 @@ const Scene = () => {
nextPkGuide
()
nextPkGuide
()
}
}
console
.
log
(
pkGuideStep
,
11111111
)
if
(
!
pkGuideActive
||
pkGuideStep
!==
3
)
{
if
(
!
pkGuideActive
||
pkGuideStep
!==
3
)
{
return
null
return
null
}
}
...
...
src/store/modules/guide.ts
View file @
7398ce0b
...
@@ -128,12 +128,12 @@ const guideModel: GuideModel = {
...
@@ -128,12 +128,12 @@ const guideModel: GuideModel = {
}),
}),
completeStoreGuide
:
thunk
(
async
(
actions
)
=>
{
completeStoreGuide
:
thunk
(
async
(
actions
)
=>
{
actions
.
updateState
({
isStoreGuideComplete
:
true
,
storeGuideStep
:
-
1
})
actions
.
updateState
({
isStoreGuideComplete
:
true
,
storeGuideStep
:
-
1
,
storeGuideActive
:
false
})
updateStorage
(
StorageKeys
.
isStoreGuideComplete
,
true
)
updateStorage
(
StorageKeys
.
isStoreGuideComplete
,
true
)
}),
}),
completeGroupGuide
:
thunk
(
async
(
actions
)
=>
{
completeGroupGuide
:
thunk
(
async
(
actions
)
=>
{
actions
.
updateState
({
isGroupGuideComplete
:
true
,
groupGuideStep
:
-
1
})
actions
.
updateState
({
isGroupGuideComplete
:
true
,
groupGuideStep
:
-
1
,
groupGuideActive
:
false
})
updateStorage
(
StorageKeys
.
isGroupGuideComplete
,
true
)
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