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
2155adb1
Commit
2155adb1
authored
Jun 20, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 分享
parent
245d40da
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
battle-complete.tsx
src/pages/game/play/components/battle-complete.tsx
+18
-9
No files found.
src/pages/game/play/components/battle-complete.tsx
View file @
2155adb1
...
...
@@ -36,13 +36,22 @@ const BattleComplete = ({ pkResult }: BattleCompleteProps) => {
return
getUserRank
(
pkResult
?.
recipientLevel
??
''
)
},
[
pkResult
])
const
isWin
=
useMemo
(()
=>
{
if
(
userInfo
.
userId
&&
userInfo
.
userId
===
pkResult
?.
initiator
)
{
const
isMySelf
=
useMemo
(()
=>
{
return
userInfo
.
userId
&&
userInfo
.
userId
===
pkResult
?.
initiator
},
[
userInfo
,
pkResult
])
/** 发起者输了 */
const
isInitiatorFail
=
useMemo
(()
=>
{
return
pkResult
?.
result
===
'LOSE'
},
[
pkResult
])
const
headerWin
=
useMemo
(()
=>
{
if
(
isMySelf
)
{
return
pkResult
?.
result
===
'WIN'
}
/** 从发起者角度算 */
return
pkResult
?.
result
===
'LOSE'
},
[
pkResult
,
userInfo
])
return
isInitiatorFail
},
[
pkResult
,
isMySelf
,
isInitiatorFail
])
useEffect
(()
=>
{
if
(
pkResult
)
{
...
...
@@ -51,11 +60,11 @@ const BattleComplete = ({ pkResult }: BattleCompleteProps) => {
},
[
getSetting
,
pkResult
])
const
score
=
useMemo
(()
=>
{
if
(
is
Win
)
{
if
(
header
Win
)
{
return
setting
?.
personalPkWinPoint
??
0
}
return
setting
?.
personalPkLosePoint
??
0
},
[
setting
,
is
Win
])
},
[
setting
,
header
Win
])
if
(
!
pkResult
)
{
return
null
...
...
@@ -64,14 +73,14 @@ const BattleComplete = ({ pkResult }: BattleCompleteProps) => {
return
(
<
View
className=
{
styles
.
wrap
}
>
<
View
className=
{
styles
.
gap_1
}
></
View
>
<
Image
src=
{
is
Win
?
assetsGame
[
'pk-success.png'
].
u
:
assetsGame
[
'pk-fail.png'
].
u
}
className=
{
styles
.
pk_result
}
mode=
"heightFix"
></
Image
>
<
Image
src=
{
header
Win
?
assetsGame
[
'pk-success.png'
].
u
:
assetsGame
[
'pk-fail.png'
].
u
}
className=
{
styles
.
pk_result
}
mode=
"heightFix"
></
Image
>
<
View
className=
{
styles
.
game_bonus
}
>
<
Image
src=
{
assetsPrepare
[
'diamond.png'
].
u
}
className=
{
styles
.
diamond
}
></
Image
>
水晶 +
{
score
}
</
View
>
<
View
className=
{
styles
.
game_role
}
>
<
View
className=
{
classNames
(
styles
.
game_role_left
,
!
is
Win
&&
styles
.
is_fail
)
}
>
<
View
className=
{
classNames
(
styles
.
game_role_left
,
!
is
InitiatorFail
&&
styles
.
is_fail
)
}
>
<
View
className=
{
styles
.
user_name
}
>
{
pkResult
.
recipientName
}
</
View
>
<
View
className=
{
styles
.
user_level
}
>
<
Image
src=
{
getUserLevelIcon
(
recipientLevel
.
level
)
}
className=
{
styles
.
level_icon
}
/>
...
...
@@ -83,7 +92,7 @@ const BattleComplete = ({ pkResult }: BattleCompleteProps) => {
<
View
className=
{
classNames
(
styles
.
info
,
styles
.
is_info_2
)
}
>
答题用时:
{
pkResult
.
recipientResultTime
}
s
</
View
>
</
View
>
<
View
className=
{
classNames
(
styles
.
game_role_right
,
is
Win
&&
styles
.
is_fail
)
}
>
<
View
className=
{
classNames
(
styles
.
game_role_right
,
is
InitiatorFail
&&
styles
.
is_fail
)
}
>
<
View
className=
{
styles
.
user_name
}
>
{
pkResult
.
initiatorName
}
</
View
>
<
View
className=
{
styles
.
user_level
}
>
<
Image
src=
{
getUserLevelIcon
(
initiatorLevel
.
level
)
}
className=
{
styles
.
level_icon
}
/>
...
...
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