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
e94b8d2a
Commit
e94b8d2a
authored
Jun 20, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: pk历史数据展示
parent
5abb7931
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
9 deletions
+27
-9
global.d.ts
global.d.ts
+2
-1
index.ts
src/native-components/pk-record/index.ts
+17
-2
index.wxml
src/native-components/pk-record/index.wxml
+4
-5
index.tsx
src/pages/battles/index.tsx
+4
-1
No files found.
global.d.ts
View file @
e94b8d2a
...
...
@@ -41,7 +41,8 @@ declare namespace JSX {
>
,
'pk-record'
:
React
.
DetailedHTMLProps
<
React
.
HTMLAttributes
<
HTMLElement
>
&
{
list
:
any
[]
list
:
any
[];
config
:
any
;
},
HTMLElement
>
,
...
...
src/native-components/pk-record/index.ts
View file @
e94b8d2a
...
...
@@ -3,6 +3,7 @@
import
{
rankTranslate
,
getImageForRank
}
from
'@/pages/battles/utils'
import
assets
from
'@/assets/oss/assets-pk'
import
assets2
from
'@/assets/oss/assets-prepare'
import
{
getStorage
,
StorageKeys
}
from
'@/utils/storage'
import
styles
from
'./index.module.scss'
const
PageSize
=
10
...
...
@@ -13,9 +14,13 @@ Component({
type
:
Array
,
value
:
[],
},
config
:
{
type
:
Object
,
value
:
{}
}
},
observers
:
{
'list'
(
val
)
{
'list'
()
{
this
.
reset
()
}
},
...
...
@@ -31,6 +36,7 @@ Component({
this
.
_loading
=
false
this
.
_currentPage
=
0
this
.
loadMore
()
this
.
_userInfo
=
getStorage
(
StorageKeys
.
userInfo
)
},
methods
:
{
reset
()
{
...
...
@@ -60,10 +66,19 @@ Component({
hasNextPage
=
false
}
const
userInfo
=
this
.
_userInfo
const
isWin
=
item
=>
{
if
(
item
.
initiator
===
userInfo
?.
userId
)
{
return
item
.
result
===
'WIN'
}
return
item
.
result
===
'LOSE'
}
const
start
=
currentPage
*
PageSize
const
newList
=
list
.
slice
(
start
,
max
).
map
((
item
)
=>
({
...
item
,
wined
:
i
tem
.
result
===
'WIN'
,
wined
:
i
sWin
(
item
)
,
initiatorLevel
:
rankTranslate
(
item
.
initiatorLevel
),
recipientLevel
:
rankTranslate
(
item
.
recipientLevel
),
initiatorBadge
:
getImageForRank
(
item
.
initiatorLevel
),
...
...
src/native-components/pk-record/index.wxml
View file @
e94b8d2a
...
...
@@ -41,7 +41,7 @@
<text class="{{styles.value}}">{{item.initiatorResultTime}}s</text>
<view class="{{styles.value}}">
<image class="{{styles.diamond}}" src="{{assets2['diamond.png'].u}}" />
<text>+
10
</text>
<text>+
{{ item.result === 'WIN' ? config.personalPkWinPoint : config.personalPkLosePoint }}
</text>
</view>
</view>
<!-- stats -->
...
...
@@ -56,7 +56,7 @@
<text class="{{styles.value}}">{{item.recipientResultTime}}s</text>
<view class="{{styles.value}}">
<image class="{{styles.diamond}}" src="{{assets2['diamond.png'].u}}" />
<text>+
15
</text>
<text>+
{{ item.result === 'WIN' ? config.personalPkLosePoint : config.personalPkWinPoint }}
</text>
</view>
</view>
</view>
...
...
@@ -64,7 +64,7 @@
</view>
</template>
<block wx:for="{{ realList }}" wx:key="userId">
<template is="pkItem" data="{{ styles, item, assets, assets2, rankTranslate }}" />
<template is="pkItem" data="{{ styles, item, assets, assets2, rankTranslate
, config
}}" />
</block>
<view class="{{styles.spinWrap}}" wx:if="{{loading}}">
<view class="{{styles.spin}}">
...
...
@@ -72,4 +72,4 @@
<View class="{{styles.spinText}}">加载中</View>
</view>
</view>
<view class="{{styles.emptyText}}" wx:if="{{list.length < 1}}">暂无数据</view>
\ No newline at end of file
<view class="{{styles.emptyText}}" wx:if="{{list.length < 1}}">暂无数据</view>
src/pages/battles/index.tsx
View file @
e94b8d2a
...
...
@@ -18,6 +18,8 @@ const Battles = () => {
const
nav
=
useMemo
(
getMenuButtonBoundingClientRect
,
[])
const
summary
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
summary
)
const
addPkGuideTimes
=
useStoreActions
((
state
)
=>
state
.
guideModel
.
addPkGuideTimes
)
const
getSetting
=
useStoreActions
((
state
)
=>
state
.
userModel
.
getSetting
)
const
setting
=
useStoreState
((
state
)
=>
state
.
userModel
.
setting
)
const
fetchUserSummary
=
useStoreActions
(
(
actions
)
=>
actions
.
battlesModel
.
fetchUserSummary
...
...
@@ -30,6 +32,7 @@ const Battles = () => {
useDidShow
(()
=>
{
fetchUserSummary
({})
getSetting
()
})
const
page
=
useMemo
(()
=>
getCurrentInstance
()?.
page
,
[])
...
...
@@ -68,7 +71,7 @@ const Battles = () => {
</
View
>
<
View
className=
{
styles
.
gameResult
}
>
<
pk
-
record
list=
{
summary
?.
records
||
[]
}
ref=
{
pkRecords
}
/>
<
pk
-
record
list=
{
summary
?.
records
||
[]
}
config=
{
setting
}
ref=
{
pkRecords
}
/>
</
View
>
</
View
>
<
View
className=
{
styles
.
bottom
}
>
...
...
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