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
862945e3
Commit
862945e3
authored
Jun 19, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: pk math
parent
c6b40ab0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
13 deletions
+30
-13
pk.ts
src/api/pk.ts
+4
-3
index.module.scss
src/pages/accept-pk/index.module.scss
+12
-0
index.tsx
src/pages/accept-pk/index.tsx
+11
-5
model.ts
src/pages/battles/model.ts
+1
-1
create-pk.tsx
src/pages/main/main-underground/create-pk.tsx
+2
-2
pk.tsx
src/pages/main/main-underground/pk-guide/pk.tsx
+0
-2
No files found.
src/api/pk.ts
View file @
862945e3
...
@@ -21,13 +21,14 @@ export type PkDetails = {
...
@@ -21,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
)
,
}
}
}))
}))
}
}
...
...
src/pages/accept-pk/index.module.scss
View file @
862945e3
...
@@ -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 @
862945e3
...
@@ -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/model.ts
View file @
862945e3
...
@@ -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/main/main-underground/create-pk.tsx
View file @
862945e3
...
@@ -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/pk-guide/pk.tsx
View file @
862945e3
...
@@ -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
}
}
...
...
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