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
1118e50d
Commit
1118e50d
authored
Jun 16, 2023
by
raca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 调试
parent
97841175
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
59 additions
and
30 deletions
+59
-30
account.ts
src/api/account.ts
+18
-0
auth.ts
src/api/auth.ts
+0
-18
pk.ts
src/api/pk.ts
+8
-5
battles-modal.tsx
src/pages/battles/components/battles-modal.tsx
+2
-1
game-result.tsx
src/pages/battles/components/game-result.tsx
+2
-1
index.tsx
src/pages/market/index.tsx
+1
-1
user.ts
src/store/modules/user.ts
+5
-4
day.ts
src/utils/day.ts
+23
-0
No files found.
src/api/account.ts
View file @
1118e50d
...
@@ -13,3 +13,21 @@ export const pointToCard = ({ num }: { num: number }) => {
...
@@ -13,3 +13,21 @@ export const pointToCard = ({ num }: { num: number }) => {
})
})
)
)
}
}
export
type
ExchangeParams
=
{
accountTo
:
'POINT'
|
'NAME_CARD'
|
'CARD'
,
accountFrom
:
'POINT'
|
'NAME_CARD'
|
'CARD'
,
num
:
number
;
userId
?:
number
;
}
export
function
accountExchange
(
data
:
ExchangeParams
)
{
return
requestAfterSilentLogin
<
AccountOut
[],
ExchangeParams
>
(
userInfo
=>
({
method
:
'POST'
,
url
:
'/service-idea/account/accountExchange'
,
data
:
{
...
data
,
userId
:
userInfo
?.
userId
}
}))
}
src/api/auth.ts
View file @
1118e50d
...
@@ -120,24 +120,6 @@ export const receivePoint = () => requestAfterSilentLogin<void, { userId?: numbe
...
@@ -120,24 +120,6 @@ export const receivePoint = () => requestAfterSilentLogin<void, { userId?: numbe
data
:
{
userId
:
user
?.
userId
}
data
:
{
userId
:
user
?.
userId
}
}))
}))
export
type
ExchangeParams
=
{
accountTo
:
'POINT'
|
'NAME_CARD'
|
'CARD'
,
accountFrom
:
'POINT'
|
'NAME_CARD'
|
'CARD'
,
num
:
number
;
userId
?:
number
;
}
export
function
accountExchange
(
data
:
ExchangeParams
)
{
return
requestAfterSilentLogin
<
void
,
ExchangeParams
>
(
userInfo
=>
({
method
:
'POST'
,
url
:
'/service-idea/stage/user/accountExchange'
,
data
:
{
...
data
,
userId
:
userInfo
?.
userId
}
}))
}
export
function
changeNickName
(
nickName
:
string
)
{
export
function
changeNickName
(
nickName
:
string
)
{
return
requestAfterSilentLogin
<
void
,
{
nickName
:
string
,
userId
?:
number
}
>
(
userInfo
=>
({
return
requestAfterSilentLogin
<
void
,
{
nickName
:
string
,
userId
?:
number
}
>
(
userInfo
=>
({
method
:
'GET'
,
method
:
'GET'
,
...
...
src/api/pk.ts
View file @
1118e50d
...
@@ -54,14 +54,17 @@ export type PkRecords = {
...
@@ -54,14 +54,17 @@ export type PkRecords = {
}
&
Pick
<
PkDetails
,
'allPkNum'
|
'userRanks'
|
'winPkNum'
>
}
&
Pick
<
PkDetails
,
'allPkNum'
|
'userRanks'
|
'winPkNum'
>
export
function
fetchUserRecords
(
data
:
PkParams
)
{
export
function
fetchUserRecords
(
data
:
PkParams
)
{
return
requestAfterSilentLogin
<
PkRecords
,
PkParams
>
((
userInfo
)
=>
({
if
(
!
data
.
stageId
)
{
delete
data
.
stageId
}
return
requestAfterSilentLogin
<
PkRecords
,
PkParams
>
((
userInfo
)
=>
{
data
.
userId
=
data
.
userId
||
userInfo
?.
userId
return
{
method
:
'GET'
,
method
:
'GET'
,
url
:
'/service-idea/pk/personal/stage/records'
,
url
:
'/service-idea/pk/personal/stage/records'
,
data
:
{
data
stageId
:
data
.
stageId
,
userId
:
data
.
userId
||
userInfo
?.
userId
,
}
}
})
)
})
}
}
export
type
SubmitPkResultParams
=
{
export
type
SubmitPkResultParams
=
{
...
...
src/pages/battles/components/battles-modal.tsx
View file @
1118e50d
...
@@ -3,6 +3,7 @@ import { View, Text, Image, ScrollView } from '@tarojs/components'
...
@@ -3,6 +3,7 @@ import { View, Text, Image, ScrollView } from '@tarojs/components'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
Modal
from
'@/components/Modal'
import
Modal
from
'@/components/Modal'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
convertDateTime
}
from
'@/utils/day'
import
assets
from
'@/assets/oss/assets-pk'
import
assets
from
'@/assets/oss/assets-pk'
import
{
badgeImages
}
from
'../const'
import
{
badgeImages
}
from
'../const'
import
{
UserInfo
,
GameResultProps
}
from
'./game-result'
import
{
UserInfo
,
GameResultProps
}
from
'./game-result'
...
@@ -97,7 +98,7 @@ const GameResult = ({ record }: GameResultProps) => {
...
@@ -97,7 +98,7 @@ const GameResult = ({ record }: GameResultProps) => {
src=
{
record
.
result
?
assets
[
'win.png'
].
u
:
assets
[
'lose.png'
].
u
}
src=
{
record
.
result
?
assets
[
'win.png'
].
u
:
assets
[
'lose.png'
].
u
}
className=
{
gameResultStyles
.
levelResult
}
className=
{
gameResultStyles
.
levelResult
}
/>
/>
<
Text
className=
{
gameResultStyles
.
levelDate
}
>
{
record
.
createTime
}
</
Text
>
<
Text
className=
{
gameResultStyles
.
levelDate
}
>
{
convertDateTime
(
record
.
createTime
)
}
</
Text
>
</
View
>
</
View
>
<
View
className=
{
styles
.
gameBody
}
>
<
View
className=
{
styles
.
gameBody
}
>
...
...
src/pages/battles/components/game-result.tsx
View file @
1118e50d
import
{
CSSProperties
}
from
'react'
import
{
CSSProperties
}
from
'react'
import
{
View
,
Text
,
Image
}
from
'@tarojs/components'
import
{
View
,
Text
,
Image
}
from
'@tarojs/components'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
{
convertDateTime
}
from
'@/utils/day'
import
assets
from
'@/assets/oss/assets-pk'
import
assets
from
'@/assets/oss/assets-pk'
import
assets2
from
'@/assets/oss/assets-prepare'
import
assets2
from
'@/assets/oss/assets-prepare'
import
{
PkRecord
}
from
'@/api/pk'
import
{
PkRecord
}
from
'@/api/pk'
...
@@ -27,7 +28,7 @@ const GameResult = ({ record }: GameResultProps) => {
...
@@ -27,7 +28,7 @@ const GameResult = ({ record }: GameResultProps) => {
src=
{
assets
[
record
.
result
?
'win.png'
:
'lose.png'
].
u
}
src=
{
assets
[
record
.
result
?
'win.png'
:
'lose.png'
].
u
}
className=
{
styles
.
levelResult
}
className=
{
styles
.
levelResult
}
/>
/>
<
Text
className=
{
styles
.
levelDate
}
>
{
record
.
createTime
}
</
Text
>
<
Text
className=
{
styles
.
levelDate
}
>
{
convertDateTime
(
record
.
createTime
)
}
</
Text
>
</
View
>
</
View
>
<
View
className=
{
styles
.
gameBody
}
>
<
View
className=
{
styles
.
gameBody
}
>
...
...
src/pages/market/index.tsx
View file @
1118e50d
...
@@ -245,7 +245,7 @@ const StudyMarket = () => {
...
@@ -245,7 +245,7 @@ const StudyMarket = () => {
bodyClassName=
{
styles
.
moal_body
}
bodyClassName=
{
styles
.
moal_body
}
onClose=
{
setFalse
}
onClose=
{
setFalse
}
maskClosable=
{
false
}
maskClosable=
{
false
}
tilte=
{
`兑换${currentGoods?.subTitle ??
currentGoods?.title ??
''}`
}
tilte=
{
`兑换${currentGoods?.subTitle ?? ''}`
}
>
>
{
currentGoods
?.
subTitle
===
'改名卡'
?
(
{
currentGoods
?.
subTitle
===
'改名卡'
?
(
<
ExchangeRenameCard
<
ExchangeRenameCard
...
...
src/store/modules/user.ts
View file @
1118e50d
import
{
import
{
action
,
Action
,
Thunk
,
thunk
,
State
action
,
Action
,
Thunk
,
thunk
,
State
}
from
'easy-peasy'
}
from
'easy-peasy'
import
{
getAccountInfo
,
getSetting
,
accountExchange
,
changeNickName
,
type
ExchangeParams
,
type
SettintType
,
updateUserInfo
,
type
UpdateUserInfoIn
,
updateUserPhon
e
}
from
'@/api'
import
{
getAccountInfo
,
getSetting
,
type
SettintType
,
updateUserInfo
,
type
UpdateUserInfoIn
,
updateUserPhone
,
changeNickNam
e
}
from
'@/api'
import
type
{
UserInfo
}
from
'@/types'
import
type
{
UserInfo
}
from
'@/types'
import
{
pointToCard
}
from
'@/api/account'
import
{
ExchangeParams
,
accountExchange
,
pointToCard
}
from
'@/api/account'
import
{
showModal
,
showToast
,
showLoading
,
hideLoading
}
from
'@tarojs/taro'
import
{
showModal
,
showToast
,
showLoading
,
hideLoading
}
from
'@tarojs/taro'
import
{
getStorage
,
StorageKeys
,
updateStorage
}
from
'@/utils/storage'
import
{
getStorage
,
StorageKeys
,
updateStorage
}
from
'@/utils/storage'
import
{
Deferred
}
from
'@/utils/deferred'
import
{
Deferred
}
from
'@/utils/deferred'
...
@@ -176,8 +176,9 @@ const userModel: UserModel = {
...
@@ -176,8 +176,9 @@ const userModel: UserModel = {
accountExchange
:
thunk
(
async
(
actions
,
payload
)
=>
{
accountExchange
:
thunk
(
async
(
actions
,
payload
)
=>
{
try
{
try
{
showLoading
({
mask
:
true
,
title
:
'操作中...'
})
showLoading
({
mask
:
true
,
title
:
'操作中...'
})
const
{
data
}
=
await
accountExchange
(
payload
)
const
{
data
:
list
}
=
await
accountExchange
(
payload
)
console
.
log
(
data
)
const
point
=
list
.
find
(
c
=>
c
.
accountType
===
'POINT'
)?.
amount
??
0
actions
.
updateState
({
point
})
hideLoading
()
hideLoading
()
}
catch
(
err
)
{
}
catch
(
err
)
{
hideLoading
()
hideLoading
()
...
...
src/utils/day.ts
0 → 100644
View file @
1118e50d
// 返回月和日,例如:6月16日
function
formatMonthDay
(
date
:
Date
):
string
{
const
month
=
date
.
getMonth
()
+
1
const
day
=
date
.
getDate
()
return
`
${
month
}
月
${
day
}
日`
}
// 返回时间,例如:18:00:00
function
formatTime
(
date
:
Date
):
string
{
const
hours
=
date
.
getHours
()
const
minutes
=
date
.
getMinutes
()
const
seconds
=
date
.
getSeconds
()
return
`
${
hours
.
toString
().
padStart
(
2
,
'0'
)}
:
${
minutes
.
toString
()
.
padStart
(
2
,
'0'
)}
:
${
seconds
.
toString
().
padStart
(
2
,
'0'
)}
`
}
export
function
convertDateTime
(
input
:
string
):
string
{
const
date
=
new
Date
(
input
)
const
monthDay
=
formatMonthDay
(
date
)
const
time
=
formatTime
(
date
)
return
`
${
monthDay
}
${
time
}
`
}
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