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
51164f53
Commit
51164f53
authored
Jun 19, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化pk结果弹窗弹出时机
parent
b9d7b729
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
+25
-2
battles-modal.tsx
src/pages/battles/components/battles-modal.tsx
+25
-2
No files found.
src/pages/battles/components/battles-modal.tsx
View file @
51164f53
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'
...
@@ -16,6 +16,27 @@ const BattlesModal = () => {
...
@@ -16,6 +16,27 @@ const BattlesModal = () => {
const
isVisible
=
useStoreState
(
state
=>
state
.
battlesModel
.
modalIsVisible
)
const
isVisible
=
useStoreState
(
state
=>
state
.
battlesModel
.
modalIsVisible
)
const
setModalIsVisible
=
useStoreActions
(
actions
=>
actions
.
battlesModel
.
setModalIsVisible
)
const
setModalIsVisible
=
useStoreActions
(
actions
=>
actions
.
battlesModel
.
setModalIsVisible
)
const
summary
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
summary
)
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
(
const
fetchUserSummary
=
useStoreActions
(
(
actions
)
=>
actions
.
battlesModel
.
fetchUserSummary
(
actions
)
=>
actions
.
battlesModel
.
fetchUserSummary
...
@@ -25,9 +46,11 @@ const BattlesModal = () => {
...
@@ -25,9 +46,11 @@ const BattlesModal = () => {
fetchUserSummary
({})
fetchUserSummary
({})
},
[
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
)
}
...
...
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