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
593eb9e7
Commit
593eb9e7
authored
Jun 20, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/2023-06-12-v1.1' of…
Merge branch 'feature/2023-06-12-v1.1' of dev.jiuaoedu.com:hewenhao/GeekLearnMathWeapp into feature/2023-06-12-v1.1
parents
35c9e17b
c6523e1b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
38 deletions
+96
-38
index.ts
src/native-components/pk-record/index.ts
+23
-9
index.wxml
src/native-components/pk-record/index.wxml
+4
-3
modal-name.module.scss
src/pages/accept-pk/components/modal-name.module.scss
+2
-0
modal-name.tsx
src/pages/accept-pk/components/modal-name.tsx
+6
-2
top-header.module.scss
src/pages/accept-pk/components/top-header.module.scss
+1
-0
battles-modal.module.scss
src/pages/battles/components/battles-modal.module.scss
+0
-1
battles-modal.tsx
src/pages/battles/components/battles-modal.tsx
+58
-22
index.tsx
src/pages/battles/index.tsx
+2
-1
No files found.
src/native-components/pk-record/index.ts
View file @
593eb9e7
...
@@ -7,6 +7,11 @@ import { getStorage, StorageKeys } from '@/utils/storage'
...
@@ -7,6 +7,11 @@ import { getStorage, StorageKeys } from '@/utils/storage'
import
styles
from
'./index.module.scss'
import
styles
from
'./index.module.scss'
const
PageSize
=
10
const
PageSize
=
10
const
determineStyle
=
(
isPlayer
:
boolean
,
isWin
:
boolean
)
=>
{
return
(
isWin
&&
isPlayer
)
||
(
!
isWin
&&
!
isPlayer
)
?
styles
.
statsWin
:
styles
.
statsLose
}
// @ts-ignore
// @ts-ignore
Component
({
Component
({
properties
:
{
properties
:
{
...
@@ -22,7 +27,7 @@ Component({
...
@@ -22,7 +27,7 @@ Component({
observers
:
{
observers
:
{
'list'
()
{
'list'
()
{
this
.
reset
()
this
.
reset
()
}
}
,
},
},
data
:
{
data
:
{
styles
,
styles
,
...
@@ -76,14 +81,23 @@ Component({
...
@@ -76,14 +81,23 @@ Component({
}
}
const
start
=
currentPage
*
PageSize
const
start
=
currentPage
*
PageSize
const
newList
=
list
.
slice
(
start
,
max
).
map
((
item
)
=>
({
const
newList
=
list
.
slice
(
start
,
max
).
map
((
item
)
=>
{
...
item
,
const
isInitiator
=
item
.
initiator
===
userInfo
?.
userId
wined
:
isWin
(
item
),
const
isRecipient
=
item
.
recipient
===
userInfo
?.
userId
initiatorLevel
:
rankTranslate
(
item
.
initiatorLevel
),
const
initiatorStyle
=
determineStyle
(
isInitiator
,
isWin
(
item
))
recipientLevel
:
rankTranslate
(
item
.
recipientLevel
),
const
recipientStyle
=
determineStyle
(
isRecipient
,
isWin
(
item
))
initiatorBadge
:
getImageForRank
(
item
.
initiatorLevel
),
recipientBadge
:
getImageForRank
(
item
.
recipientLevel
),
return
{
}))
...
item
,
wined
:
isWin
(
item
),
initiatorStyle
,
recipientStyle
,
initiatorLevel
:
rankTranslate
(
item
.
initiatorLevel
),
recipientLevel
:
rankTranslate
(
item
.
recipientLevel
),
initiatorBadge
:
getImageForRank
(
item
.
initiatorLevel
),
recipientBadge
:
getImageForRank
(
item
.
recipientLevel
),
}
})
const
opts
=
{}
as
any
const
opts
=
{}
as
any
newList
.
forEach
((
item
,
index
)
=>
{
newList
.
forEach
((
item
,
index
)
=>
{
...
...
src/native-components/pk-record/index.wxml
View file @
593eb9e7
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
</view>
</view>
<!-- gameStats -->
<!-- gameStats -->
<view class="{{styles.gameStats}}">
<view class="{{styles.gameStats}}">
<view class="{{styles.stats}} {{item.
wined ? styles.statsWin : styles.statsLos
e}}">
<view class="{{styles.stats}} {{item.
initiatorStyl
e}}">
<text class="{{styles.value}}">{{item.initiatorErrNum > 0 ? '错'+item.initiatorErrNum+'题' : '全对'}}</text>
<text class="{{styles.value}}">{{item.initiatorErrNum > 0 ? '错'+item.initiatorErrNum+'题' : '全对'}}</text>
<text class="{{styles.value}}">{{item.initiatorResultTime}}s</text>
<text class="{{styles.value}}">{{item.initiatorResultTime}}s</text>
<view class="{{styles.value}}">
<view class="{{styles.value}}">
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
<text class="{{styles.value}}">PK奖励</text>
<text class="{{styles.value}}">PK奖励</text>
</view>
</view>
<!-- stats -->
<!-- stats -->
<view class="{{styles.stats}} {{
!item.wined ? styles.statsWin : styles.statsLos
e}}">
<view class="{{styles.stats}} {{
item.recipientStyl
e}}">
<text class="{{styles.value}}">{{item.recipientErrNum > 0 ? '错'+item.recipientErrNum+'题' : '全对'}}</text>
<text class="{{styles.value}}">{{item.recipientErrNum > 0 ? '错'+item.recipientErrNum+'题' : '全对'}}</text>
<text class="{{styles.value}}">{{item.recipientResultTime}}s</text>
<text class="{{styles.value}}">{{item.recipientResultTime}}s</text>
<view class="{{styles.value}}">
<view class="{{styles.value}}">
...
@@ -72,4 +72,4 @@
...
@@ -72,4 +72,4 @@
<View class="{{styles.spinText}}">加载中</View>
<View class="{{styles.spinText}}">加载中</View>
</view>
</view>
</view>
</view>
<view class="{{styles.emptyText}}" wx:if="{{list.length < 1}}">暂无数据</view>
<view class="{{styles.emptyText}}" wx:if="{{list.length < 1}}">暂无数据</view>
\ No newline at end of file
src/pages/accept-pk/components/modal-name.module.scss
View file @
593eb9e7
...
@@ -65,8 +65,10 @@
...
@@ -65,8 +65,10 @@
background
:
#F4F6F8
;
background
:
#F4F6F8
;
border-radius
:
56px
;
border-radius
:
56px
;
}
}
.inputName
{
.inputName
{
flex
:
1
;
flex
:
1
;
text-align
:
left
;
font-size
:
36px
;
font-size
:
36px
;
font-weight
:
600
;
font-weight
:
600
;
color
:
#465164
;
color
:
#465164
;
...
...
src/pages/accept-pk/components/modal-name.tsx
View file @
593eb9e7
import
{
View
,
RootPortal
,
Image
,
Button
,
ButtonProps
,
CommonEventFunction
}
from
'@tarojs/components'
import
{
View
,
RootPortal
,
Image
,
Button
,
ButtonProps
,
CommonEventFunction
,
Input
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
{
useCallback
,
useRef
,
useState
}
from
'react'
import
{
useCallback
,
useRef
,
useState
}
from
'react'
import
{
EyeProtectionView
}
from
'@/components'
import
{
EyeProtectionView
}
from
'@/components'
...
@@ -98,7 +98,11 @@ const ModalName = ({
...
@@ -98,7 +98,11 @@ const ModalName = ({
请输入您的角色名(7字以内)
请输入您的角色名(7字以内)
</
View
>
</
View
>
<
View
className=
{
styles
.
input
}
>
<
View
className=
{
styles
.
input
}
>
<
View
className=
{
styles
.
inputName
}
>
{
name
}
</
View
>
<
Input
className=
{
styles
.
inputName
}
value=
{
name
as
string
}
onInput=
{
(
e
)
=>
setName
(
e
.
detail
.
value
)
}
/>
<
Image
<
Image
src=
{
assetsGuide
[
'touzi.png'
].
u
}
src=
{
assetsGuide
[
'touzi.png'
].
u
}
className=
{
classNames
(
className=
{
classNames
(
...
...
src/pages/accept-pk/components/top-header.module.scss
View file @
593eb9e7
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
.arrow
{
.arrow
{
position
:
absolute
;
position
:
absolute
;
z-index
:
999
;
left
:
10
PX
;
left
:
10
PX
;
width
:
30
PX
;
width
:
30
PX
;
height
:
30
PX
;
height
:
30
PX
;
...
...
src/pages/battles/components/battles-modal.module.scss
View file @
593eb9e7
...
@@ -81,7 +81,6 @@
...
@@ -81,7 +81,6 @@
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
text-align
:
center
;
text-align
:
center
;
gap
:
16px
;
max-height
:
500px
;
max-height
:
500px
;
}
}
...
...
src/pages/battles/components/battles-modal.tsx
View file @
593eb9e7
...
@@ -13,15 +13,23 @@ import gameResultStyles from './game-result.module.scss'
...
@@ -13,15 +13,23 @@ import gameResultStyles from './game-result.module.scss'
import
{
rankTranslate
,
getImageForRank
}
from
'../utils'
import
{
rankTranslate
,
getImageForRank
}
from
'../utils'
const
BattlesModal
=
()
=>
{
const
BattlesModal
=
()
=>
{
const
isVisible
=
useStoreState
(
state
=>
state
.
battlesModel
.
modalIsVisible
)
const
isVisible
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
modalIsVisible
)
const
setModalIsVisible
=
useStoreActions
(
actions
=>
actions
.
battlesModel
.
setModalIsVisible
)
const
setModalIsVisible
=
useStoreActions
(
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
(
actions
)
=>
actions
.
battlesModel
.
setModalIsVisible
)
const
fetchAccount
=
useStoreActions
(
(
actions
)
=>
actions
.
userModel
.
fetchAccount
)
const
pkDetails
=
useStoreState
((
state
)
=>
state
.
userModel
.
pkDetails
)
const
pkDetails
=
useStoreState
((
state
)
=>
state
.
userModel
.
pkDetails
)
const
pkGuideActive
=
useStoreState
(
state
=>
state
.
guideModel
.
pkGuideActive
)
const
pkGuideActive
=
useStoreState
((
state
)
=>
state
.
guideModel
.
pkGuideActive
)
const
groupGuideActive
=
useStoreState
(
state
=>
state
.
guideModel
.
groupGuideActive
)
const
groupGuideActive
=
useStoreState
(
const
mainGuideActive
=
useStoreState
(
state
=>
state
.
guideModel
.
mainGuideActive
)
(
state
)
=>
state
.
guideModel
.
groupGuideActive
const
joinDeferred
=
useStoreState
(
state
=>
state
.
userModel
.
joinDefered
)
)
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
const
mainGuideActive
=
useStoreState
(
(
state
)
=>
state
.
guideModel
.
mainGuideActive
)
const
joinDeferred
=
useStoreState
((
state
)
=>
state
.
userModel
.
joinDefered
)
const
userInfo
=
useStoreState
((
state
)
=>
state
.
userModel
.
userInfo
)
const
[
enable
,
setEnable
]
=
useState
(
false
)
const
[
enable
,
setEnable
]
=
useState
(
false
)
...
@@ -45,7 +53,10 @@ const BattlesModal = () => {
...
@@ -45,7 +53,10 @@ const BattlesModal = () => {
}
}
},
[
pkDetails
,
setModalIsVisible
])
},
[
pkDetails
,
setModalIsVisible
])
const
hasAreaAndGrad
=
useMemo
(()
=>
!!
userInfo
.
city
&&
!!
userInfo
.
grade
,
[
userInfo
])
const
hasAreaAndGrad
=
useMemo
(
()
=>
!!
userInfo
.
city
&&
!!
userInfo
.
grade
,
[
userInfo
]
)
const
onClose
=
useCallback
(()
=>
{
const
onClose
=
useCallback
(()
=>
{
receivePkPrize
().
finally
(()
=>
{
receivePkPrize
().
finally
(()
=>
{
...
@@ -61,7 +72,14 @@ const BattlesModal = () => {
...
@@ -61,7 +72,14 @@ const BattlesModal = () => {
return
(
return
(
<
Modal
<
Modal
maskClosable=
{
false
}
maskClosable=
{
false
}
isVisible=
{
hasAreaAndGrad
&&
enable
&&
!
pkGuideActive
&&
!
groupGuideActive
&&
!
mainGuideActive
&&
isVisible
}
isVisible=
{
hasAreaAndGrad
&&
enable
&&
!
pkGuideActive
&&
!
groupGuideActive
&&
!
mainGuideActive
&&
isVisible
}
wrapClassName=
{
styles
.
modalWrap
}
wrapClassName=
{
styles
.
modalWrap
}
bodyClassName=
{
styles
.
modalBody
}
bodyClassName=
{
styles
.
modalBody
}
onClose=
{
onClose
}
onClose=
{
onClose
}
...
@@ -81,10 +99,12 @@ const BattlesModal = () => {
...
@@ -81,10 +99,12 @@ const BattlesModal = () => {
</
View
>
</
View
>
<
View
className=
{
styles
.
details
}
>
<
View
className=
{
styles
.
details
}
>
{
getImageForBadge
&&
<
Image
{
getImageForBadge
&&
(
src=
{
assets
[
getImageForBadge
.
default
].
u
}
<
Image
className=
{
styles
.
badgeIcon
}
src=
{
assets
[
getImageForBadge
.
default
].
u
}
/>
}
className=
{
styles
.
badgeIcon
}
/>
)
}
<
View
className=
{
styles
.
detailsRight
}
>
<
View
className=
{
styles
.
detailsRight
}
>
<
Text
className=
{
styles
.
badgeText
}
>
<
Text
className=
{
styles
.
badgeText
}
>
{
rankTranslate
(
pkDetails
?.
userRanks
.
level
)
}
{
rankTranslate
(
pkDetails
?.
userRanks
.
level
)
}
...
@@ -108,7 +128,11 @@ const BattlesModal = () => {
...
@@ -108,7 +128,11 @@ const BattlesModal = () => {
<
ScrollView
className=
{
styles
.
gameResult
}
scrollY
>
<
ScrollView
className=
{
styles
.
gameResult
}
scrollY
>
{
pkDetails
&&
pkDetails
?.
pkList
.
length
>
0
?
(
{
pkDetails
&&
pkDetails
?.
pkList
.
length
>
0
?
(
pkDetails
?.
pkList
.
map
((
item
)
=>
(
pkDetails
?.
pkList
.
map
((
item
)
=>
(
<
GameResult
key=
{
item
.
id
}
record=
{
item
}
/>
<
GameResult
userId=
{
userInfo
.
userId
!
}
key=
{
item
.
id
}
record=
{
item
}
/>
))
))
)
:
(
)
:
(
<
Text
className=
{
styles
.
emptyText
}
>
暂无PK记录
</
Text
>
<
Text
className=
{
styles
.
emptyText
}
>
暂无PK记录
</
Text
>
...
@@ -119,20 +143,32 @@ const BattlesModal = () => {
...
@@ -119,20 +143,32 @@ const BattlesModal = () => {
)
)
}
}
const
GameResult
=
({
record
}:
GameResultProps
)
=>
{
const
determineStyle
=
(
isPlayer
:
boolean
,
isWin
:
boolean
)
=>
{
const
wined
=
record
.
result
===
'WIN'
return
(
isWin
&&
isPlayer
)
||
(
!
isWin
&&
!
isPlayer
)
?
styles
.
win
:
styles
.
lose
}
const
GameResult
=
({
record
,
userId
,
}:
GameResultProps
&
{
userId
:
number
})
=>
{
const
isInitiator
=
record
.
initiator
===
userId
const
isRecipient
=
record
.
recipient
===
userId
const
isWin
=
(
record
.
result
===
'WIN'
&&
isInitiator
)
||
(
record
.
result
===
'LOSE'
&&
isRecipient
)
const
initiatorStyle
=
determineStyle
(
isInitiator
,
isWin
)
const
recipientStyle
=
determineStyle
(
isRecipient
,
isWin
)
return
(
return
(
<
View
className=
{
gameResultStyles
.
gameResult
}
>
<
View
className=
{
gameResultStyles
.
gameResult
}
style=
{
{
marginBottom
:
12
}
}
>
<
View
<
View
className=
{
classNames
(
className=
{
classNames
(
gameResultStyles
.
levelInfo
,
gameResultStyles
.
levelInfo
,
wined
?
gameResultStyles
.
win
:
gameResultStyles
.
lose
isWin
?
gameResultStyles
.
win
:
gameResultStyles
.
lose
)
}
)
}
>
>
<
Text
className=
{
gameResultStyles
.
levelName
}
>
{
record
.
stageName
}
</
Text
>
<
Text
className=
{
gameResultStyles
.
levelName
}
>
{
record
.
stageName
}
</
Text
>
<
Image
<
Image
mode=
"widthFix"
mode=
"widthFix"
src=
{
wined
?
assets
[
'win.png'
].
u
:
assets
[
'lose.png'
].
u
}
src=
{
isWin
?
assets
[
'win.png'
].
u
:
assets
[
'lose.png'
].
u
}
className=
{
gameResultStyles
.
levelResult
}
className=
{
gameResultStyles
.
levelResult
}
/>
/>
<
Text
className=
{
gameResultStyles
.
levelDate
}
>
<
Text
className=
{
gameResultStyles
.
levelDate
}
>
...
@@ -145,7 +181,7 @@ const GameResult = ({ record }: GameResultProps) => {
...
@@ -145,7 +181,7 @@ const GameResult = ({ record }: GameResultProps) => {
<
View
<
View
className=
{
classNames
(
className=
{
classNames
(
styles
.
userInfo
,
styles
.
userInfo
,
wined
?
styles
.
win
:
styles
.
los
e
initiatorStyl
e
)
}
)
}
>
>
<
UserInfo
<
UserInfo
...
@@ -157,7 +193,7 @@ const GameResult = ({ record }: GameResultProps) => {
...
@@ -157,7 +193,7 @@ const GameResult = ({ record }: GameResultProps) => {
<
View
<
View
className=
{
classNames
(
className=
{
classNames
(
styles
.
userInfo
,
styles
.
userInfo
,
!
wined
?
styles
.
win
:
styles
.
los
e
recipientStyl
e
)
}
)
}
>
>
<
UserInfo
<
UserInfo
...
...
src/pages/battles/index.tsx
View file @
593eb9e7
...
@@ -2,7 +2,8 @@ import { useMemo, useRef } from 'react'
...
@@ -2,7 +2,8 @@ import { useMemo, useRef } from 'react'
import
{
import
{
getCurrentInstance
,
getCurrentInstance
,
getMenuButtonBoundingClientRect
,
getMenuButtonBoundingClientRect
,
useDidShow
,
navigateBack
,
useDidShow
,
navigateBack
,
useReachBottom
,
useReachBottom
,
}
from
'@tarojs/taro'
}
from
'@tarojs/taro'
import
{
View
,
Text
,
Image
}
from
'@tarojs/components'
import
{
View
,
Text
,
Image
}
from
'@tarojs/components'
...
...
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