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
83767671
Commit
83767671
authored
Jun 15, 2023
by
raca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: pk接受挑战
parent
133a00b1
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
327 additions
and
107 deletions
+327
-107
.oss
assets/pk/.oss
+36
-0
accept-arrow.png
assets/pk/accept-arrow.png
+0
-0
accept-click.png
assets/pk/accept-click.png
+0
-0
accept-close.png
assets/pk/accept-close.png
+0
-0
accept-main-bg.png
assets/pk/accept-main-bg.png
+0
-0
accept-slogan.png
assets/pk/accept-slogan.png
+0
-0
accept-top-bg.png
assets/pk/accept-top-bg.png
+0
-0
app.config.ts.tpl
scripts/app.config.ts.tpl
+1
-1
assets-pk.ts
src/assets/oss/assets-pk.ts
+30
-0
modal-name.module.scss
src/pages/accept-pk/components/modal-name.module.scss
+132
-0
modal-name.tsx
src/pages/accept-pk/components/modal-name.tsx
+102
-0
top-header.module.scss
src/pages/accept-pk/components/top-header.module.scss
+1
-1
top-header.tsx
src/pages/accept-pk/components/top-header.tsx
+3
-2
index.config.ts
src/pages/accept-pk/index.config.ts
+0
-0
index.module.scss
src/pages/accept-pk/index.module.scss
+3
-12
index.tsx
src/pages/accept-pk/index.tsx
+19
-16
avatar.png
src/pages/accept/assets/avatar.png
+0
-0
lightning-1.png
src/pages/accept/assets/lightning-1.png
+0
-0
lightning-2.png
src/pages/accept/assets/lightning-2.png
+0
-0
pk.png
src/pages/accept/assets/pk.png
+0
-0
modal-name.module.scss
src/pages/accept/components/modal-name.module.scss
+0
-0
modal-name.tsx
src/pages/accept/components/modal-name.tsx
+0
-75
No files found.
assets/pk/.oss
View file @
83767671
...
@@ -106,5 +106,41 @@
...
@@ -106,5 +106,41 @@
"w": 160,
"w": 160,
"h": 60,
"h": 60,
"ossName": "/pk-math/3wURfnV9P5Mv32TJwExNSpc9Jep5/160x60"
"ossName": "/pk-math/3wURfnV9P5Mv32TJwExNSpc9Jep5/160x60"
},
"accept-arrow.png": {
"u": "https://cdn.jkwljy.com/pk-math/3VVUaB5vdyH8b6HMdtJ3cCdQ9g8z/60x60",
"w": 60,
"h": 60,
"ossName": "/pk-math/3VVUaB5vdyH8b6HMdtJ3cCdQ9g8z/60x60"
},
"accept-click.png": {
"u": "https://cdn.jkwljy.com/pk-math/7s664HQwbfVia2595pL2TJF5epQ/532x112",
"w": 532,
"h": 112,
"ossName": "/pk-math/7s664HQwbfVia2595pL2TJF5epQ/532x112"
},
"accept-main-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/4K3EkZMaNtrrAwyxpsqiLbV4GkNC/750x1648",
"w": 750,
"h": 1648,
"ossName": "/pk-math/4K3EkZMaNtrrAwyxpsqiLbV4GkNC/750x1648"
},
"accept-slogan.png": {
"u": "https://cdn.jkwljy.com/pk-math/2Szvn4eZQTRfPBjJPFz41jt78dHG/520x80",
"w": 520,
"h": 80,
"ossName": "/pk-math/2Szvn4eZQTRfPBjJPFz41jt78dHG/520x80"
},
"accept-top-bg.png": {
"u": "https://cdn.jkwljy.com/pk-math/2V8Exm4jeQciyqRSkvhMF7qFegqB/750x376",
"w": 750,
"h": 376,
"ossName": "/pk-math/2V8Exm4jeQciyqRSkvhMF7qFegqB/750x376"
},
"accept-close.png": {
"u": "https://cdn.jkwljy.com/pk-math/dxRw8aoLKBQ7wP2aPpUVWMeWLLu/40x40",
"w": 40,
"h": 40,
"ossName": "/pk-math/dxRw8aoLKBQ7wP2aPpUVWMeWLLu/40x40"
}
}
}
}
src/pages/accept/assets/
arrow.png
→
assets/pk/accept-
arrow.png
View file @
83767671
File moved
src/pages/accept/assets/
click.png
→
assets/pk/accept-
click.png
View file @
83767671
File moved
assets/pk/accept-close.png
0 → 100644
View file @
83767671
599 Bytes
src/pages/accept/assets/
main-bg.png
→
assets/pk/accept-
main-bg.png
View file @
83767671
File moved
src/pages/accept/assets/
slogan.png
→
assets/pk/accept-
slogan.png
View file @
83767671
File moved
src/pages/accept/assets/
top-bg.png
→
assets/pk/accept-
top-bg.png
View file @
83767671
File moved
scripts/app.config.ts.tpl
View file @
83767671
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
export default {
export default {
pages: [
pages: [
'pages/accept/index',
'pages/accept
-pk
/index',
'pages/main/main',
'pages/main/main',
'pages/battles/index',
'pages/battles/index',
'pages/prepare/index',
'pages/prepare/index',
...
...
src/assets/oss/assets-pk.ts
View file @
83767671
...
@@ -90,5 +90,35 @@ export default {
...
@@ -90,5 +90,35 @@ export default {
"u"
:
"https://cdn.jkwljy.com/pk-math/3wURfnV9P5Mv32TJwExNSpc9Jep5/160x60"
,
"u"
:
"https://cdn.jkwljy.com/pk-math/3wURfnV9P5Mv32TJwExNSpc9Jep5/160x60"
,
"w"
:
160
,
"w"
:
160
,
"h"
:
60
"h"
:
60
},
"accept-arrow.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/3VVUaB5vdyH8b6HMdtJ3cCdQ9g8z/60x60"
,
"w"
:
60
,
"h"
:
60
},
"accept-click.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/7s664HQwbfVia2595pL2TJF5epQ/532x112"
,
"w"
:
532
,
"h"
:
112
},
"accept-main-bg.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/4K3EkZMaNtrrAwyxpsqiLbV4GkNC/750x1648"
,
"w"
:
750
,
"h"
:
1648
},
"accept-slogan.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/2Szvn4eZQTRfPBjJPFz41jt78dHG/520x80"
,
"w"
:
520
,
"h"
:
80
},
"accept-top-bg.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/2V8Exm4jeQciyqRSkvhMF7qFegqB/750x376"
,
"w"
:
750
,
"h"
:
376
},
"accept-close.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/dxRw8aoLKBQ7wP2aPpUVWMeWLLu/40x40"
,
"w"
:
40
,
"h"
:
40
}
}
}
as
const
}
as
const
src/pages/accept-pk/components/modal-name.module.scss
0 → 100644
View file @
83767671
.mask
{
position
:
fixed
;
left
:
0
;
top
:
0
;
bottom
:
0
;
right
:
0
;
background
:
rgba
(
0
,
0
,
0
,
0
.5
);
z-index
:
2000
;
opacity
:
0
;
pointer-events
:
none
;
transition
:
opacity
.5s
cubic-bezier
(
0
.175
,
0
.885
,
0
.32
,
1
.0
);
&
.is_show
{
opacity
:
1
;
pointer-events
:
all
;
}
}
.modal
{
position
:
fixed
;
bottom
:
0
;
left
:
0
;
right
:
0
;
z-index
:
2001
;
background-color
:
#fff
;
transform
:
translateY
(
100%
);
transition
:
transform
.5s
cubic-bezier
(
0
.175
,
0
.885
,
0
.32
,
1
.0
);
border-radius
:
32px
32px
0px
0px
;
&
.is_show
{
transform
:
translateY
(
0
);
}
}
.close
{
width
:
40px
;
height
:
40px
;
position
:
absolute
;
right
:
32px
;
top
:
32px
;
}
.tips
{
font-size
:
28px
;
font-weight
:
400
;
color
:
#586170
;
line-height
:
50px
;
text-align
:
center
;
}
.title
{
padding
:
64px
0
32px
0
;
text-align
:
center
;
font-size
:
48px
;
font-weight
:
600
;
color
:
#586170
;
line-height
:
66px
;
}
.input
{
display
:
flex
;
align-items
:
center
;
padding
:
24px
28px
24px
48px
;
margin
:
12px
120px
0
;
background
:
#F4F6F8
;
border-radius
:
56px
;
}
.inputName
{
flex
:
1
;
font-size
:
36px
;
font-weight
:
600
;
color
:
#465164
;
line-height
:
50px
;
}
.inputIcon
{
width
:
64px
;
height
:
64px
;
display
:
block
;
}
.generating
{
animation-name
:
rotate_3d
;
animation-duration
:
.3s
;
animation-timing-function
:
ease-in-out
;
animation-iteration-count
:
infinite
;
}
@keyframes
rotate_3d
{
0
%
{
transform
:
rotate
(
0deg
);
}
25
%
{
transform
:
rotate
(
90deg
);
}
50
%
{
transform
:
rotate
(
180deg
);
}
75
%
{
transform
:
rotate
(
270deg
);
}
100
%
{
transform
:
rotate
(
360deg
);
}
}
@supports
(
padding-bottom
:
constant
(
safe-area-inset-bottom
))
or
(
padding-bottom
:
env
(
safe-area-inset-bottom
))
{
.modal
{
padding-bottom
:
constant
(
safe-area-inset-bottom
);
padding-bottom
:
env
(
safe-area-inset-bottom
);
}
}
.footer
{
display
:
flex
;
align-items
:
center
;
padding
:
32px
34px
80px
34px
;
}
.footerButton
{
flex
:
1
;
background-image
:
url('https://cdn.jkwljy.com/pk-math/gMAFXFRRH3frGsM2wCpyLUCdiNT/343x56')
;
}
.footerHoverButton
{
background-image
:
url('https://cdn.jkwljy.com/pk-math/3UiwFgrVHVQEcaPdxdf1XinBb64o/343x56')
;
}
\ No newline at end of file
src/pages/accept-pk/components/modal-name.tsx
0 → 100644
View file @
83767671
import
{
View
,
RootPortal
,
Image
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
{
useCallback
,
useRef
,
useState
}
from
'react'
import
{
EyeProtectionView
}
from
'@/components'
import
Button
from
'@/components/Button'
import
{
useBoolean
}
from
'@/hooks'
import
{
getNickNameWords
,
type
NickNameWord
}
from
'@/api'
import
assetsPk
from
'@/assets/oss/assets-pk'
import
assetsGuide
from
'@/assets/oss/assets-guide'
import
styles
from
'./modal-name.module.scss'
const
randomPick
=
(
arr
:
string
[])
=>
{
const
len
=
arr
.
length
const
randomIndex
=
Math
.
floor
(
Math
.
random
()
*
len
)
return
arr
[
randomIndex
]
}
const
ModalName
=
({
isVisible
,
onClose
,
}:
{
isVisible
:
boolean
onClose
:
()
=>
void
})
=>
{
const
[
name
,
setName
]
=
useState
(
'小明'
)
const
[
generating
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
dataRef
=
useRef
<
NickNameWord
>
({
noun
:
[],
adj
:
[]
})
const
timerRef
=
useRef
<
NodeJS
.
Timer
|
null
>
(
null
)
const
generateName
=
useCallback
(()
=>
{
const
{
noun
,
adj
}
=
dataRef
.
current
const
nam
=
[
randomPick
(
adj
),
randomPick
(
noun
)].
filter
(
Boolean
).
join
(
''
)
setName
(
nam
)
},
[])
const
getNameWords
=
useCallback
(
async
()
=>
{
const
words
=
await
getNickNameWords
()
dataRef
.
current
=
words
generateName
()
},
[
generateName
])
const
handleGenerate
=
useCallback
(()
=>
{
setTrue
()
if
(
dataRef
.
current
.
adj
.
length
<
1
)
{
getNameWords
()
}
else
{
generateName
()
}
if
(
timerRef
.
current
)
{
clearTimeout
(
timerRef
.
current
)
}
timerRef
.
current
=
setTimeout
(()
=>
{
setFalse
()
timerRef
.
current
=
null
},
1000
)
},
[
generateName
,
setTrue
,
setFalse
,
getNameWords
])
return
(
<
RootPortal
>
<
View
className=
{
classNames
(
styles
.
mask
,
isVisible
&&
styles
.
is_show
)
}
></
View
>
<
EyeProtectionView
className=
{
classNames
(
styles
.
modal
,
isVisible
&&
styles
.
is_show
)
}
>
<
Image
className=
{
styles
.
close
}
src=
{
assetsPk
[
'accept-close.png'
].
u
}
onClick=
{
onClose
}
/>
<
View
className=
{
styles
.
title
}
>
请问大侠,尊姓大名
</
View
>
<
View
className=
{
styles
.
tips
}
>
请输入您的角色名(7字以内)或随机生成
</
View
>
<
View
className=
{
styles
.
input
}
>
<
View
className=
{
styles
.
inputName
}
>
{
name
}
</
View
>
<
Image
src=
{
assetsGuide
[
'touzi.png'
].
u
}
className=
{
classNames
(
styles
.
inputIcon
,
generating
&&
styles
.
generating
)
}
onClick=
{
handleGenerate
}
data
-
name=
""
></
Image
>
</
View
>
<
View
className=
{
styles
.
footer
}
>
<
Button
size=
"large"
image=
{
styles
.
footerButton
}
hoverImage=
{
styles
.
footerHoverButton
}
>
确定
</
Button
>
</
View
>
</
EyeProtectionView
>
</
RootPortal
>
)
}
export
default
ModalName
src/pages/accept/components/top-header.module.scss
→
src/pages/accept
-pk
/components/top-header.module.scss
View file @
83767671
.header
{
.header
{
background-size
:
100%
;
background-size
:
100%
;
background-image
:
url(
../assets/top-bg.png
)
;
background-image
:
url(
https://cdn.jkwljy.com/pk-math/2V8Exm4jeQciyqRSkvhMF7qFegqB/750x376
)
;
}
}
.inner
{
.inner
{
...
...
src/pages/accept/components/top-header.tsx
→
src/pages/accept
-pk
/components/top-header.tsx
View file @
83767671
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
import
{
View
,
Image
}
from
'@tarojs/components'
import
{
getMenuButtonBoundingClientRect
,
navigateBack
}
from
'@tarojs/taro'
import
{
getMenuButtonBoundingClientRect
,
navigateBack
}
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
styles
from
'./top-header.module.scss'
import
styles
from
'./top-header.module.scss'
...
@@ -17,7 +18,7 @@ const TopHeader = () => {
...
@@ -17,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=
{
require
(
'../assets/arrow.png'
)
}
className=
{
styles
.
arrow
}
onClick=
{
()
=>
navigateBack
()
}
></
Image
>
<
Image
src=
{
assetsPk
[
'accept-arrow.png'
].
u
}
className=
{
styles
.
arrow
}
onClick=
{
()
=>
navigateBack
()
}
></
Image
>
</
View
>
</
View
>
</
View
>
</
View
>
</
View
>
</
View
>
...
...
src/pages/accept/index.config.ts
→
src/pages/accept
-pk
/index.config.ts
View file @
83767671
File moved
src/pages/accept/index.module.scss
→
src/pages/accept
-pk
/index.module.scss
View file @
83767671
...
@@ -13,15 +13,15 @@
...
@@ -13,15 +13,15 @@
height
:
100%
;
height
:
100%
;
background-size
:
100%
;
background-size
:
100%
;
background-image
:
url(
./assets/main-bg.png
)
;
background-image
:
url(
https://cdn.jkwljy.com/pk-math/4K3EkZMaNtrrAwyxpsqiLbV4GkNC/750x1648
)
;
background-repeat
:
no-repeat
;
background-repeat
:
no-repeat
;
.pk
Lightning
{
.pk
Flash
{
position
:
relative
;
position
:
relative
;
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
.
lightning
{
.
flash
{
position
:
absolute
;
position
:
absolute
;
width
:
360px
;
width
:
360px
;
height
:
200px
;
height
:
200px
;
...
@@ -107,14 +107,6 @@
...
@@ -107,14 +107,6 @@
height
:
112px
;
height
:
112px
;
margin-bottom
:
50px
;
margin-bottom
:
50px
;
}
}
.line
{
margin
:
0
auto
;
width
:
238px
;
height
:
12px
;
background
:
#FFFFFF
;
border-radius
:
6px
;
}
}
}
}
}
}
}
\ No newline at end of file
src/pages/accept/index.tsx
→
src/pages/accept
-pk
/index.tsx
View file @
83767671
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
import
assets
from
'@/assets/oss/assets-pk'
import
{
useBoolean
}
from
'@/hooks'
import
assetsPk
from
'@/assets/oss/assets-pk'
import
assetsMainNext
from
'@/assets/oss/assets-main-next'
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'
import
ModalName
from
'./components/modal-name'
import
ModalName
from
'./components/modal-name'
const
Accept
=
()
=>
{
const
AcceptPk
=
()
=>
{
const
[
isVisible
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
return
(
return
(
<
View
className=
{
styles
.
container
}
>
<
View
className=
{
styles
.
container
}
>
<
TopHeader
/>
<
TopHeader
/>
<
View
className=
{
styles
.
wrapper
}
>
<
View
className=
{
styles
.
wrapper
}
>
<
View
style=
{
{
position
:
'relative'
,
top
:
-
20
}
}
>
<
View
style=
{
{
position
:
'relative'
,
top
:
-
20
}
}
>
<
View
className=
{
styles
.
pk
Lightning
}
>
<
View
className=
{
styles
.
pk
Flash
}
>
<
Image
<
Image
className=
{
styles
.
lightning
}
className=
{
styles
.
flash
}
style=
{
{
left
:
0
}
}
style=
{
{
left
:
0
}
}
src=
{
require
(
'./assets/lightning-1.png'
)
}
src=
{
assetsMainNext
[
'pk-flash.png'
].
u
}
/>
/>
<
Image
className=
{
styles
.
pk
}
src=
{
require
(
'./assets/pk.png'
)
}
/>
<
Image
className=
{
styles
.
pk
}
src=
{
assetsMainNext
[
'pk-logo.png'
].
u
}
/>
<
Image
<
Image
className=
{
styles
.
lightning
}
className=
{
styles
.
flash
}
style=
{
{
right
:
0
}
}
style=
{
{
right
:
0
}
}
src=
{
require
(
'./assets/lightning-2.png'
)
}
src=
{
assetsMainNext
[
'pk-flash-right.png'
].
u
}
/>
/>
</
View
>
</
View
>
<
View
className=
{
styles
.
slogan
}
>
<
View
className=
{
styles
.
slogan
}
>
<
Image
<
Image
className=
{
styles
.
sloganImage
}
className=
{
styles
.
sloganImage
}
src=
{
require
(
'./assets/slogan.png'
)
}
src=
{
assetsPk
[
'accept-slogan.png'
].
u
}
/>
/>
</
View
>
</
View
>
...
@@ -43,13 +47,13 @@ const Accept = () => {
...
@@ -43,13 +47,13 @@ const Accept = () => {
<
Image
<
Image
className=
{
styles
.
avatar
}
className=
{
styles
.
avatar
}
src=
{
require
(
'./assets/avatar.png'
)
}
src=
{
assetsMainNext
[
'challenge-avatar.png'
].
u
}
/>
/>
<
View
className=
{
styles
.
record
}
>
<
View
className=
{
styles
.
record
}
>
<
View
className=
{
styles
.
rank
}
>
<
View
className=
{
styles
.
rank
}
>
<
Image
<
Image
src=
{
assets
[
badgeImages
.
bronze
.
default
].
u
}
src=
{
assets
Pk
[
badgeImages
.
bronze
.
default
].
u
}
className=
{
styles
.
badgeIcon
}
className=
{
styles
.
badgeIcon
}
/>
/>
<
Text
className=
{
styles
.
rankText
}
>
青铜
</
Text
>
<
Text
className=
{
styles
.
rankText
}
>
青铜
</
Text
>
...
@@ -63,16 +67,15 @@ const Accept = () => {
...
@@ -63,16 +67,15 @@ const Accept = () => {
<
View
className=
{
styles
.
bottom
}
>
<
View
className=
{
styles
.
bottom
}
>
<
Image
<
Image
className=
{
styles
.
clickImage
}
className=
{
styles
.
clickImage
}
onClick=
{
()
=>
{}
}
onClick=
{
setTrue
}
src=
{
require
(
'./assets/click.png'
)
}
src=
{
assetsPk
[
'accept-click.png'
].
u
}
/>
/>
<
View
className=
{
styles
.
line
}
/>
</
View
>
</
View
>
</
View
>
</
View
>
<
ModalName
/>
<
ModalName
isVisible=
{
isVisible
}
onClose=
{
setFalse
}
/>
</
View
>
</
View
>
)
)
}
}
export
default
Accept
export
default
Accept
Pk
src/pages/accept/assets/avatar.png
deleted
100644 → 0
View file @
133a00b1
24.4 KB
src/pages/accept/assets/lightning-1.png
deleted
100644 → 0
View file @
133a00b1
7.8 KB
src/pages/accept/assets/lightning-2.png
deleted
100644 → 0
View file @
133a00b1
7.92 KB
src/pages/accept/assets/pk.png
deleted
100644 → 0
View file @
133a00b1
37.5 KB
src/pages/accept/components/modal-name.module.scss
deleted
100644 → 0
View file @
133a00b1
src/pages/accept/components/modal-name.tsx
deleted
100644 → 0
View file @
133a00b1
import
{
View
,
RootPortal
,
Image
,
Text
}
from
'@tarojs/components'
import
{
useCallback
,
useEffect
,
useRef
}
from
'react'
import
classNames
from
'classnames'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
assets
from
'@/assets/oss/assets-complete'
import
{
EyeProtectionView
}
from
'@/components'
import
styles
from
'./modal-name.module.scss'
const
canGoNext
=
true
const
ModalName
=
()
=>
{
const
modalContinueVisible
=
useStoreState
(
state
=>
state
.
gameModel
.
modalContinueVisible
)
const
cardNum
=
useStoreState
(
state
=>
state
.
userModel
.
cardNum
)
const
bornTimes
=
useStoreState
(
state
=>
state
.
gameModel
.
bornTimes
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
submit
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
submit
)
const
reborn
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
reborn
)
const
isClickRef
=
useRef
(
false
)
useEffect
(()
=>
{
if
(
modalContinueVisible
)
{
fetchAccount
()
}
},
[
fetchAccount
,
modalContinueVisible
])
const
handleReborn
=
useCallback
(
async
()
=>
{
if
(
isClickRef
.
current
)
return
isClickRef
.
current
=
true
try
{
await
reborn
()
}
finally
{
isClickRef
.
current
=
false
}
},
[
reborn
])
return
(
<
RootPortal
>
<
View
className=
{
classNames
(
styles
.
mask
,
modalContinueVisible
&&
styles
.
is_show
)
}
>
</
View
>
<
EyeProtectionView
className=
{
classNames
(
styles
.
modal
,
modalContinueVisible
&&
styles
.
is_show
)
}
>
{
modalContinueVisible
&&
(
<
Image
src=
{
assets
[
'fail-ip.png'
].
u
}
className=
{
styles
.
fail_icon
}
/>
)
}
<
View
className=
{
styles
.
title
}
>
是否继续闯关?
</
View
>
<
View
className=
{
styles
.
tips
}
>
消耗
<
Text
className=
{
styles
.
em
}
>
1
</
Text
>
张答题卡,复活继续闯关
</
View
>
<
View
className=
{
styles
.
tips
}
>
还剩
<
Text
className=
{
styles
.
em
}
>
{
bornTimes
}
</
Text
>
次复活机会
</
View
>
<
View
className=
{
styles
.
footer
}
>
<
View
className=
{
styles
.
btn_left
}
hoverClass=
{
styles
.
is_active
}
onClick=
{
()
=>
submit
()
}
id=
"fail_game_give_up"
>
放弃
</
View
>
<
View
className=
{
classNames
(
styles
.
btn_right
,
!
canGoNext
&&
styles
.
disabled
)
}
hoverClass=
{
canGoNext
?
styles
.
is_active
:
null
}
onClick=
{
handleReborn
}
id=
"fail_game_reborn"
>
<
Image
src=
{
require
(
'@/pages/main/assets/ph.png'
)
}
className=
{
styles
.
icon
}
></
Image
>
<
Text
>
-1 继续
</
Text
>
<
View
className=
{
styles
.
account_left
}
>
剩余
<
Text
className=
{
styles
.
account_num
}
>
{
cardNum
}
</
Text
>
张
</
View
>
</
View
>
</
View
>
</
EyeProtectionView
>
</
RootPortal
>
)
}
export
default
ModalName
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