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
971a0708
Commit
971a0708
authored
Jun 20, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: pk获取积分显示
parent
32858340
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
auth.ts
src/api/auth.ts
+4
-2
battle-complete.tsx
src/pages/game/play/components/battle-complete.tsx
+18
-3
No files found.
src/api/auth.ts
View file @
971a0708
...
@@ -63,8 +63,10 @@ export type SettintType = {
...
@@ -63,8 +63,10 @@ export type SettintType = {
aPoint
?:
number
,
aPoint
?:
number
,
bPoint
?:
number
,
bPoint
?:
number
,
sPoint
?:
number
,
sPoint
?:
number
,
createGroupPoint
?:
number
createGroupPoint
?:
number
;
joinGroupPoint
?:
number
joinGroupPoint
?:
number
;
personalPkLosePoint
?:
number
;
personalPkWinPoint
?:
number
;
}
}
export
function
getSetting
()
{
export
function
getSetting
()
{
...
...
src/pages/game/play/components/battle-complete.tsx
View file @
971a0708
...
@@ -2,9 +2,9 @@ import { View, Image, Button } from '@tarojs/components'
...
@@ -2,9 +2,9 @@ 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
,
useEffect
}
from
'react'
import
{
reLaunch
}
from
'@tarojs/taro'
import
{
reLaunch
}
from
'@tarojs/taro'
import
{
useStoreActions
}
from
'@/store/hooks'
import
{
useStoreActions
,
useStoreState
}
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
{
PkResult
}
from
'@/api'
...
@@ -17,6 +17,8 @@ type BattleCompleteProps = {
...
@@ -17,6 +17,8 @@ type BattleCompleteProps = {
const
BattleComplete
=
({
pkResult
}:
BattleCompleteProps
)
=>
{
const
BattleComplete
=
({
pkResult
}:
BattleCompleteProps
)
=>
{
const
updateState
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
updateState
)
const
updateState
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
updateState
)
const
setting
=
useStoreState
(
state
=>
state
.
userModel
.
setting
)
const
getSetting
=
useStoreActions
(
actions
=>
actions
.
userModel
.
getSetting
)
const
upSelf
=
()
=>
{
const
upSelf
=
()
=>
{
updateState
({
isCreatePkShow
:
false
,
currentPkStage
:
null
})
updateState
({
isCreatePkShow
:
false
,
currentPkStage
:
null
})
...
@@ -38,6 +40,19 @@ const BattleComplete = ({ pkResult }: BattleCompleteProps) => {
...
@@ -38,6 +40,19 @@ const BattleComplete = ({ pkResult }: BattleCompleteProps) => {
return
pkResult
?.
result
===
'LOSE'
return
pkResult
?.
result
===
'LOSE'
},
[
pkResult
])
},
[
pkResult
])
useEffect
(()
=>
{
if
(
pkResult
)
{
getSetting
()
}
},
[
getSetting
,
pkResult
])
const
score
=
useMemo
(()
=>
{
if
(
isWin
)
{
return
setting
?.
personalPkWinPoint
??
0
}
return
setting
?.
personalPkLosePoint
??
0
},
[
setting
,
isWin
])
if
(
!
pkResult
)
{
if
(
!
pkResult
)
{
return
null
return
null
}
}
...
@@ -48,7 +63,7 @@ const BattleComplete = ({ pkResult }: BattleCompleteProps) => {
...
@@ -48,7 +63,7 @@ const BattleComplete = ({ pkResult }: BattleCompleteProps) => {
<
Image
src=
{
isWin
?
assetsGame
[
'pk-success.png'
].
u
:
assetsGame
[
'pk-fail.png'
].
u
}
className=
{
styles
.
pk_result
}
mode=
"heightFix"
></
Image
>
<
Image
src=
{
isWin
?
assetsGame
[
'pk-success.png'
].
u
:
assetsGame
[
'pk-fail.png'
].
u
}
className=
{
styles
.
pk_result
}
mode=
"heightFix"
></
Image
>
<
View
className=
{
styles
.
game_bonus
}
>
<
View
className=
{
styles
.
game_bonus
}
>
<
Image
src=
{
assetsPrepare
[
'diamond.png'
].
u
}
className=
{
styles
.
diamond
}
></
Image
>
<
Image
src=
{
assetsPrepare
[
'diamond.png'
].
u
}
className=
{
styles
.
diamond
}
></
Image
>
水晶 +
5
水晶 +
{
score
}
</
View
>
</
View
>
<
View
className=
{
styles
.
game_role
}
>
<
View
className=
{
styles
.
game_role
}
>
...
...
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