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
ca005426
Commit
ca005426
authored
Jun 19, 2023
by
raca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化
parent
1118e50d
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
82 additions
and
55 deletions
+82
-55
pk.ts
src/api/pk.ts
+4
-4
battles-modal.tsx
src/pages/battles/components/battles-modal.tsx
+15
-17
game-result.tsx
src/pages/battles/components/game-result.tsx
+4
-3
player-details.tsx
src/pages/battles/components/player-details.tsx
+6
-5
index.tsx
src/pages/battles/index.tsx
+6
-9
model.ts
src/pages/battles/model.ts
+10
-10
utils.ts
src/pages/battles/utils.ts
+27
-0
exchange-rename-card.tsx
src/pages/market/components/exchange-rename-card.tsx
+1
-1
top-bar.tsx
src/pages/prepare/components/top-bar.tsx
+2
-1
user.ts
src/store/modules/user.ts
+7
-5
No files found.
src/api/pk.ts
View file @
ca005426
...
@@ -45,19 +45,19 @@ export type PkRecord = {
...
@@ -45,19 +45,19 @@ export type PkRecord = {
recipientErrNum
:
number
,
recipientErrNum
:
number
,
recipientName
:
string
,
recipientName
:
string
,
recipientResultTime
:
number
,
recipientResultTime
:
number
,
result
:
string
,
result
:
'LOSE'
|
'WIN'
,
stageName
:
string
stageName
:
string
}
}
export
type
Pk
Records
=
{
export
type
Pk
Summary
=
{
records
:
PkRecord
[]
records
:
PkRecord
[]
}
&
Pick
<
PkDetails
,
'allPkNum'
|
'userRanks'
|
'winPkNum'
>
}
&
Pick
<
PkDetails
,
'allPkNum'
|
'userRanks'
|
'winPkNum'
>
export
function
fetchUser
Records
(
data
:
PkParams
)
{
export
function
fetchUser
Summary
(
data
:
PkParams
)
{
if
(
!
data
.
stageId
)
{
if
(
!
data
.
stageId
)
{
delete
data
.
stageId
delete
data
.
stageId
}
}
return
requestAfterSilentLogin
<
Pk
Records
,
PkParams
>
((
userInfo
)
=>
{
return
requestAfterSilentLogin
<
Pk
Summary
,
PkParams
>
((
userInfo
)
=>
{
data
.
userId
=
data
.
userId
||
userInfo
?.
userId
data
.
userId
=
data
.
userId
||
userInfo
?.
userId
return
{
return
{
method
:
'GET'
,
method
:
'GET'
,
...
...
src/pages/battles/components/battles-modal.tsx
View file @
ca005426
...
@@ -10,23 +10,20 @@ import { UserInfo, GameResultProps } from './game-result'
...
@@ -10,23 +10,20 @@ import { UserInfo, GameResultProps } from './game-result'
import
styles
from
'./battles-modal.module.scss'
import
styles
from
'./battles-modal.module.scss'
import
gameResultStyles
from
'./game-result.module.scss'
import
gameResultStyles
from
'./game-result.module.scss'
import
{
rankTranslate
}
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
(
actions
=>
actions
.
battlesModel
.
setModalIsVisible
)
const
details
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
details
)
const
summary
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
summary
)
const
records
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
records
)
const
fetchUserDetails
=
useStoreActions
(
const
fetchUserSummary
=
useStoreActions
(
(
actions
)
=>
actions
.
battlesModel
.
fetchUserDetails
(
actions
)
=>
actions
.
battlesModel
.
fetchUserSummary
)
const
fetchUserRecords
=
useStoreActions
(
(
actions
)
=>
actions
.
battlesModel
.
fetchUserRecords
)
)
useEffect
(()
=>
{
useEffect
(()
=>
{
Promise
.
allSettled
([
fetchUserDetails
({}),
fetchUserRecords
({})]
)
fetchUserSummary
({}
)
},
[
fetchUser
Details
,
fetchUserRecords
])
},
[
fetchUser
Summary
])
return
(
return
(
<
Modal
<
Modal
...
@@ -56,7 +53,7 @@ const BattlesModal = () => {
...
@@ -56,7 +53,7 @@ const BattlesModal = () => {
/>
/>
<
View
className=
{
styles
.
detailsRight
}
>
<
View
className=
{
styles
.
detailsRight
}
>
<
Text
className=
{
styles
.
badgeText
}
>
<
Text
className=
{
styles
.
badgeText
}
>
{
details
?.
userRanks
.
level
||
'-'
}
{
rankTranslate
(
summary
?.
userRanks
.
level
)
}
</
Text
>
</
Text
>
<
View
className=
{
styles
.
badgeBar
}
>
<
View
className=
{
styles
.
badgeBar
}
>
{
[...
Array
(
3
)].
map
((
_
,
index
)
=>
(
{
[...
Array
(
3
)].
map
((
_
,
index
)
=>
(
...
@@ -64,7 +61,7 @@ const BattlesModal = () => {
...
@@ -64,7 +61,7 @@ const BattlesModal = () => {
key=
{
index
}
key=
{
index
}
className=
{
classNames
(
className=
{
classNames
(
styles
.
badgeBarItem
,
styles
.
badgeBarItem
,
index
<
(
details
?.
userRanks
.
star
||
0
)
?
styles
.
active
:
null
index
<
(
summary
?.
userRanks
.
star
||
0
)
?
styles
.
active
:
null
)
}
)
}
></
Text
>
></
Text
>
))
}
))
}
...
@@ -73,8 +70,8 @@ const BattlesModal = () => {
...
@@ -73,8 +70,8 @@ const BattlesModal = () => {
</
View
>
</
View
>
<
ScrollView
className=
{
styles
.
gameResult
}
scrollY
>
<
ScrollView
className=
{
styles
.
gameResult
}
scrollY
>
{
records
.
length
>
0
{
summary
&&
summary
?.
records
.
length
>
0
?
records
.
map
((
item
)
=>
<
GameResult
key=
{
item
.
id
}
record=
{
item
}
/>)
?
summary
?.
records
.
map
((
item
)
=>
<
GameResult
key=
{
item
.
id
}
record=
{
item
}
/>)
:
<
Text
className=
{
styles
.
emptyText
}
>
暂无PK记录
</
Text
>
:
<
Text
className=
{
styles
.
emptyText
}
>
暂无PK记录
</
Text
>
}
}
</
ScrollView
>
</
ScrollView
>
...
@@ -84,18 +81,19 @@ const BattlesModal = () => {
...
@@ -84,18 +81,19 @@ const BattlesModal = () => {
}
}
const
GameResult
=
({
record
}:
GameResultProps
)
=>
{
const
GameResult
=
({
record
}:
GameResultProps
)
=>
{
const
wined
=
record
.
result
===
'WIN'
return
(
return
(
<
View
className=
{
gameResultStyles
.
gameResult
}
>
<
View
className=
{
gameResultStyles
.
gameResult
}
>
<
View
<
View
className=
{
classNames
(
className=
{
classNames
(
gameResultStyles
.
levelInfo
,
gameResultStyles
.
levelInfo
,
record
.
result
?
gameResultStyles
.
win
:
gameResultStyles
.
lose
wined
?
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=
{
record
.
result
?
assets
[
'win.png'
].
u
:
assets
[
'lose.png'
].
u
}
src=
{
wined
?
assets
[
'win.png'
].
u
:
assets
[
'lose.png'
].
u
}
className=
{
gameResultStyles
.
levelResult
}
className=
{
gameResultStyles
.
levelResult
}
/>
/>
<
Text
className=
{
gameResultStyles
.
levelDate
}
>
{
convertDateTime
(
record
.
createTime
)
}
</
Text
>
<
Text
className=
{
gameResultStyles
.
levelDate
}
>
{
convertDateTime
(
record
.
createTime
)
}
</
Text
>
...
@@ -103,11 +101,11 @@ const GameResult = ({ record }: GameResultProps) => {
...
@@ -103,11 +101,11 @@ const GameResult = ({ record }: GameResultProps) => {
<
View
className=
{
styles
.
gameBody
}
>
<
View
className=
{
styles
.
gameBody
}
>
<
View
className=
{
styles
.
playerSection
}
>
<
View
className=
{
styles
.
playerSection
}
>
<
View
className=
{
classNames
(
styles
.
userInfo
,
record
.
result
?
styles
.
win
:
styles
.
lose
)
}
>
<
View
className=
{
classNames
(
styles
.
userInfo
,
wined
?
styles
.
win
:
styles
.
lose
)
}
>
<
UserInfo
name=
{
record
.
initiatorName
}
/>
<
UserInfo
name=
{
record
.
initiatorName
}
/>
</
View
>
</
View
>
<
Image
className=
{
gameResultStyles
.
vs
}
src=
{
assets
[
'vs.png'
].
u
}
/>
<
Image
className=
{
gameResultStyles
.
vs
}
src=
{
assets
[
'vs.png'
].
u
}
/>
<
View
className=
{
classNames
(
styles
.
userInfo
,
!
record
.
result
?
styles
.
win
:
styles
.
lose
)
}
>
<
View
className=
{
classNames
(
styles
.
userInfo
,
!
wined
?
styles
.
win
:
styles
.
lose
)
}
>
<
UserInfo
style=
{
{
alignItems
:
'flex-end'
}
}
name=
{
record
.
recipientName
}
/>
<
UserInfo
style=
{
{
alignItems
:
'flex-end'
}
}
name=
{
record
.
recipientName
}
/>
</
View
>
</
View
>
</
View
>
</
View
>
...
...
src/pages/battles/components/game-result.tsx
View file @
ca005426
...
@@ -14,18 +14,19 @@ export interface GameResultProps {
...
@@ -14,18 +14,19 @@ export interface GameResultProps {
}
}
const
GameResult
=
({
record
}:
GameResultProps
)
=>
{
const
GameResult
=
({
record
}:
GameResultProps
)
=>
{
const
wined
=
record
.
result
===
'WIN'
return
(
return
(
<
View
className=
{
styles
.
gameResult
}
>
<
View
className=
{
styles
.
gameResult
}
>
<
View
<
View
className=
{
classNames
(
className=
{
classNames
(
styles
.
levelInfo
,
styles
.
levelInfo
,
record
.
result
?
styles
.
win
:
styles
.
lose
wined
?
styles
.
win
:
styles
.
lose
)
}
)
}
>
>
<
Text
className=
{
styles
.
levelName
}
>
{
record
.
stageName
}
</
Text
>
<
Text
className=
{
styles
.
levelName
}
>
{
record
.
stageName
}
</
Text
>
<
Image
<
Image
mode=
"widthFix"
mode=
"widthFix"
src=
{
assets
[
record
.
result
?
'win.png'
:
'lose.png'
].
u
}
src=
{
assets
[
wined
?
'win.png'
:
'lose.png'
].
u
}
className=
{
styles
.
levelResult
}
className=
{
styles
.
levelResult
}
/>
/>
<
Text
className=
{
styles
.
levelDate
}
>
{
convertDateTime
(
record
.
createTime
)
}
</
Text
>
<
Text
className=
{
styles
.
levelDate
}
>
{
convertDateTime
(
record
.
createTime
)
}
</
Text
>
...
@@ -41,7 +42,7 @@ const GameResult = ({ record }: GameResultProps) => {
...
@@ -41,7 +42,7 @@ const GameResult = ({ record }: GameResultProps) => {
/>
/>
</
View
>
</
View
>
<
GameStats
<
GameStats
result=
{
record
.
result
}
result=
{
wined
}
initiator=
{
{
initiator=
{
{
err
:
record
.
initiatorErrNum
,
err
:
record
.
initiatorErrNum
,
time
:
record
.
initiatorResultTime
,
time
:
record
.
initiatorResultTime
,
...
...
src/pages/battles/components/player-details.tsx
View file @
ca005426
...
@@ -5,9 +5,10 @@ import assets from '@/assets/oss/assets-pk'
...
@@ -5,9 +5,10 @@ import assets from '@/assets/oss/assets-pk'
import
styles
from
'./player-details.module.scss'
import
styles
from
'./player-details.module.scss'
import
{
badgeImages
}
from
'../const'
import
{
badgeImages
}
from
'../const'
import
{
rankTranslate
}
from
'../utils'
const
PlayerDetails
=
()
=>
{
const
PlayerDetails
=
()
=>
{
const
details
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
details
)
const
summary
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
summary
)
return
(
return
(
<
View
className=
{
styles
.
player
}
>
<
View
className=
{
styles
.
player
}
>
<
View
className=
{
styles
.
playerHeader
}
>
<
View
className=
{
styles
.
playerHeader
}
>
...
@@ -16,7 +17,7 @@ const PlayerDetails = () => {
...
@@ -16,7 +17,7 @@ const PlayerDetails = () => {
className=
{
styles
.
badgeIcon
}
className=
{
styles
.
badgeIcon
}
></
Image
>
></
Image
>
<
Text
className=
{
styles
.
badgeText
}
>
<
Text
className=
{
styles
.
badgeText
}
>
{
details
?.
userRanks
.
level
||
'-'
}
{
rankTranslate
(
summary
?.
userRanks
.
level
)
}
</
Text
>
</
Text
>
<
View
className=
{
styles
.
badgeBar
}
>
<
View
className=
{
styles
.
badgeBar
}
>
{
[...
Array
(
3
)].
map
((
_
,
index
)
=>
(
{
[...
Array
(
3
)].
map
((
_
,
index
)
=>
(
...
@@ -24,7 +25,7 @@ const PlayerDetails = () => {
...
@@ -24,7 +25,7 @@ const PlayerDetails = () => {
key=
{
index
}
key=
{
index
}
className=
{
classNames
(
className=
{
classNames
(
styles
.
badgeBarItem
,
styles
.
badgeBarItem
,
index
<
(
details
?.
userRanks
.
star
||
0
)
?
styles
.
active
:
null
index
<
(
summary
?.
userRanks
.
star
||
0
)
?
styles
.
active
:
null
)
}
)
}
></
Text
>
></
Text
>
))
}
))
}
...
@@ -33,13 +34,13 @@ const PlayerDetails = () => {
...
@@ -33,13 +34,13 @@ const PlayerDetails = () => {
<
View
className=
{
styles
.
playerFooter
}
>
<
View
className=
{
styles
.
playerFooter
}
>
<
View
className=
{
styles
.
stats
}
>
<
View
className=
{
styles
.
stats
}
>
<
View
>
<
View
>
胜
<
Text
className=
{
styles
.
winText
}
>
{
details
?.
winPkNum
||
0
}
</
Text
>
胜
<
Text
className=
{
styles
.
winText
}
>
{
summary
?.
winPkNum
||
0
}
</
Text
>
</
View
>
</
View
>
<
Image
className=
{
styles
.
icon
}
src=
{
assets
[
'stats.png'
].
u
}
/>
<
Image
className=
{
styles
.
icon
}
src=
{
assets
[
'stats.png'
].
u
}
/>
<
View
>
<
View
>
负
负
<
Text
className=
{
styles
.
loseText
}
>
<
Text
className=
{
styles
.
loseText
}
>
{
(
details
?.
allPkNum
||
0
)
-
(
details
?.
winPkNum
||
0
)
}
{
(
summary
?.
allPkNum
||
0
)
-
(
summary
?.
winPkNum
||
0
)
}
</
Text
>
</
Text
>
</
View
>
</
View
>
</
View
>
</
View
>
...
...
src/pages/battles/index.tsx
View file @
ca005426
...
@@ -12,17 +12,14 @@ import styles from './index.module.scss'
...
@@ -12,17 +12,14 @@ import styles from './index.module.scss'
const
Battles
=
()
=>
{
const
Battles
=
()
=>
{
const
nav
=
useMemo
(
getMenuButtonBoundingClientRect
,
[])
const
nav
=
useMemo
(
getMenuButtonBoundingClientRect
,
[])
const
records
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
records
)
const
summary
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
summary
)
const
fetchUserDetails
=
useStoreActions
(
const
fetchUserSummary
=
useStoreActions
(
(
actions
)
=>
actions
.
battlesModel
.
fetchUserDetails
(
actions
)
=>
actions
.
battlesModel
.
fetchUserSummary
)
const
fetchUserRecords
=
useStoreActions
(
(
actions
)
=>
actions
.
battlesModel
.
fetchUserRecords
)
)
useDidShow
(()
=>
{
useDidShow
(()
=>
{
Promise
.
allSettled
([
fetchUserDetails
({}),
fetchUserRecords
({})]
)
fetchUserSummary
({}
)
})
})
return
(
return
(
...
@@ -49,8 +46,8 @@ const Battles = () => {
...
@@ -49,8 +46,8 @@ const Battles = () => {
</
View
>
</
View
>
<
View
className=
{
styles
.
gameResult
}
>
<
View
className=
{
styles
.
gameResult
}
>
{
records
.
length
>
0
{
summary
&&
summary
.
records
.
length
>
0
?
records
.
map
((
item
)
=>
<
GameResult
key=
{
item
.
id
}
record=
{
item
}
/>)
?
summary
.
records
.
map
((
item
)
=>
<
GameResult
key=
{
item
.
id
}
record=
{
item
}
/>)
:
<
Text
className=
{
styles
.
emptyText
}
>
暂无PK记录
</
Text
>
:
<
Text
className=
{
styles
.
emptyText
}
>
暂无PK记录
</
Text
>
}
}
</
View
>
</
View
>
...
...
src/pages/battles/model.ts
View file @
ca005426
import
{
Action
,
Thunk
,
action
,
thunk
}
from
'easy-peasy'
import
{
Action
,
Thunk
,
action
,
thunk
}
from
'easy-peasy'
import
{
fetchUserDetails
,
fetchUser
Records
,
type
PkParams
,
type
PkDetails
,
type
PkRecord
}
from
'@/api/pk'
import
{
fetchUserDetails
,
fetchUser
Summary
,
type
PkParams
,
type
PkDetails
,
type
PkSummary
}
from
'@/api/pk'
interface
BattlesModel
{
interface
BattlesModel
{
details
:
PkDetails
|
null
,
details
:
PkDetails
|
null
,
records
:
PkRecord
[]
;
summary
:
PkSummary
|
null
;
modalIsVisible
:
boolean
;
modalIsVisible
:
boolean
;
setModalIsVisible
:
Action
<
BattlesModel
,
boolean
>
;
setModalIsVisible
:
Action
<
BattlesModel
,
boolean
>
;
setUserDetails
:
Action
<
BattlesModel
,
PkDetails
>
;
setUserDetails
:
Action
<
BattlesModel
,
PkDetails
>
;
setUser
Records
:
Action
<
BattlesModel
,
PkRecord
[]
>
;
setUser
Summary
:
Action
<
BattlesModel
,
PkSummary
>
;
fetchUserDetails
:
Thunk
<
BattlesModel
,
PkParams
>
;
fetchUserDetails
:
Thunk
<
BattlesModel
,
PkParams
>
;
fetchUser
Records
:
Thunk
<
BattlesModel
,
PkParams
>
;
fetchUser
Summary
:
Thunk
<
BattlesModel
,
PkParams
>
;
}
}
const
battlesModel
:
BattlesModel
=
{
const
battlesModel
:
BattlesModel
=
{
details
:
null
,
details
:
null
,
records
:
[]
,
summary
:
null
,
modalIsVisible
:
true
,
modalIsVisible
:
true
,
setModalIsVisible
:
action
((
state
,
payload
)
=>
{
setModalIsVisible
:
action
((
state
,
payload
)
=>
{
...
@@ -25,8 +25,8 @@ const battlesModel: BattlesModel = {
...
@@ -25,8 +25,8 @@ const battlesModel: BattlesModel = {
state
.
details
=
payload
state
.
details
=
payload
}),
}),
setUser
Records
:
action
((
state
,
payload
)
=>
{
setUser
Summary
:
action
((
state
,
payload
)
=>
{
state
.
records
=
payload
state
.
summary
=
payload
}),
}),
fetchUserDetails
:
thunk
(
async
(
actions
,
payload
)
=>
{
fetchUserDetails
:
thunk
(
async
(
actions
,
payload
)
=>
{
...
@@ -37,10 +37,10 @@ const battlesModel: BattlesModel = {
...
@@ -37,10 +37,10 @@ const battlesModel: BattlesModel = {
}
}
}),
}),
fetchUser
Records
:
thunk
(
async
(
actions
,
payload
)
=>
{
fetchUser
Summary
:
thunk
(
async
(
actions
,
payload
)
=>
{
try
{
try
{
const
res
=
await
fetchUser
Records
(
payload
)
const
res
=
await
fetchUser
Summary
(
payload
)
actions
.
setUser
Records
(
res
.
data
.
records
)
actions
.
setUser
Summary
(
res
.
data
)
}
catch
(
err
)
{
}
catch
(
err
)
{
}
}
}),
}),
...
...
src/pages/battles/utils.ts
0 → 100644
View file @
ca005426
type
Rank
=
'BRONZE'
|
'SILVER'
|
'GOLD'
|
'PLATINUM'
|
'DIAMOND'
function
toRomanNumeral
(
num
:
number
):
string
{
const
roman
:
{
[
key
:
number
]:
string
}
=
{
1
:
'I'
,
2
:
'II'
,
3
:
'III'
,
}
return
roman
[
num
]
}
export
function
rankTranslate
(
rankWithLevel
:
string
|
undefined
):
string
{
if
(
!
rankWithLevel
)
{
return
'-'
}
const
[
rank
,
level
]
=
rankWithLevel
.
split
(
'_'
)
const
rankName
:
{
[
key
in
Rank
]?:
string
}
=
{
BRONZE
:
'青铜'
,
SILVER
:
'白银'
,
GOLD
:
'黄金'
,
PLATINUM
:
'铂金'
,
DIAMOND
:
'钻石'
,
}
return
`
${
rankName
[
rank
as
Rank
]}
${
toRomanNumeral
(
Number
(
level
))}
`
}
src/pages/market/components/exchange-rename-card.tsx
View file @
ca005426
...
@@ -79,7 +79,7 @@ const ExchangeRenameCard = (props: ExchangeItemProps) => {
...
@@ -79,7 +79,7 @@ const ExchangeRenameCard = (props: ExchangeItemProps) => {
})
})
.
then
(()
=>
{
.
then
(()
=>
{
changeNickName
(
name
).
then
(()
=>
{
changeNickName
(
name
).
then
(()
=>
{
showToast
({
title
:
'
操作
成功'
,
icon
:
'success'
})
showToast
({
title
:
'
修改
成功'
,
icon
:
'success'
})
onCancel
&&
onCancel
()
onCancel
&&
onCancel
()
})
})
})
})
...
...
src/pages/prepare/components/top-bar.tsx
View file @
ca005426
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
import
{
useMemo
}
from
'react'
import
{
useMemo
}
from
'react'
import
{
navigateTo
,
getMenuButtonBoundingClientRect
,
navigateBack
,
getSystemInfoSync
}
from
'@tarojs/taro'
import
{
navigateTo
,
getMenuButtonBoundingClientRect
,
navigateBack
,
getSystemInfoSync
}
from
'@tarojs/taro'
import
assets
from
'@/assets/oss/assets-main-next'
import
{
useStoreState
}
from
'@/store/hooks'
import
{
useStoreState
}
from
'@/store/hooks'
import
Scene3
from
'../guide/complete/scene-3'
import
Scene3
from
'../guide/complete/scene-3'
...
@@ -42,7 +43,7 @@ export default () => {
...
@@ -42,7 +43,7 @@ export default () => {
<
Text
>
{
point
}
</
Text
>
<
Text
>
{
point
}
</
Text
>
</
Scene3
>
</
Scene3
>
<
View
className=
{
styles
.
ph
}
onClick=
{
goStore
}
>
<
View
className=
{
styles
.
ph
}
onClick=
{
goStore
}
>
<
Image
src=
{
require
(
'@/pages/main/assets/ph.png'
)
}
className=
{
styles
.
icon
}
/>
<
Image
src=
{
assets
[
'star.png'
].
u
}
className=
{
styles
.
icon
}
/>
<
Text
>
{
cardNum
}
</
Text
>
<
Text
>
{
cardNum
}
</
Text
>
</
View
>
</
View
>
</
View
>
</
View
>
...
...
src/store/modules/user.ts
View file @
ca005426
...
@@ -179,22 +179,24 @@ const userModel: UserModel = {
...
@@ -179,22 +179,24 @@ const userModel: UserModel = {
const
{
data
:
list
}
=
await
accountExchange
(
payload
)
const
{
data
:
list
}
=
await
accountExchange
(
payload
)
const
point
=
list
.
find
(
c
=>
c
.
accountType
===
'POINT'
)?.
amount
??
0
const
point
=
list
.
find
(
c
=>
c
.
accountType
===
'POINT'
)?.
amount
??
0
actions
.
updateState
({
point
})
actions
.
updateState
({
point
})
hideLoading
()
}
catch
(
err
)
{
}
catch
(
err
)
{
hideLoading
()
showModal
({
showModal
({
title
:
'提示'
,
title
:
'提示'
,
content
:
err
.
message
,
content
:
err
.
message
,
showCancel
:
false
showCancel
:
false
})
})
throw
err
throw
err
}
finally
{
hideLoading
()
}
}
}),
}),
changeNickName
:
thunk
(
async
(
_
,
payload
)
=>
{
changeNickName
:
thunk
(
async
(
actions
,
payload
)
=>
{
try
{
try
{
const
{
data
}
=
await
changeNickName
(
payload
)
const
{
code
}
=
await
changeNickName
(
payload
)
console
.
log
(
data
)
if
(
code
===
0
)
{
actions
.
updateUserInfo
({
nickName
:
payload
})
}
}
catch
(
err
)
{
}
catch
(
err
)
{
showModal
({
showModal
({
title
:
'提示'
,
title
:
'提示'
,
...
...
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