Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ed432c5a
authored
Nov 03, 2023
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复令牌bug
parent
40c626cb
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
28 deletions
+48
-28
web/src/App.js
+2
-0
web/src/components/LogsTable.js
+1
-1
web/src/components/TokensTable.js
+8
-7
web/src/index.css
+10
-1
web/src/index.js
+4
-4
web/src/pages/Token/EditToken.js
+1
-0
web/src/pages/TopUp/index.js
+22
-15
No files found.
web/src/App.js
View file @
ed432c5a
...
@@ -89,6 +89,7 @@ function App() {
...
@@ -89,6 +89,7 @@ function App() {
return
(
return
(
<
Layout
>
<
Layout
>
<
Layout
.
Content
>
<
Routes
>
<
Routes
>
<
Route
<
Route
path
=
'/'
path
=
'/'
...
@@ -298,6 +299,7 @@ function App() {
...
@@ -298,6 +299,7 @@ function App() {
<
NotFound
/>
<
NotFound
/>
}
/
>
}
/
>
<
/Routes
>
<
/Routes
>
<
/Layout.Content
>
<
/Layout
>
<
/Layout
>
);
);
}
}
...
...
web/src/components/LogsTable.js
View file @
ed432c5a
...
@@ -71,7 +71,7 @@ const LogsTable = () => {
...
@@ -71,7 +71,7 @@ const LogsTable = () => {
isAdminUser
?
isAdminUser
?
record
.
type
===
0
||
record
.
type
===
2
?
record
.
type
===
0
||
record
.
type
===
2
?
<
div
>
<
div
>
{
<
Tag
color
=
{
stringToColor
(
text
)
}
size
=
'large'
>
{
text
}
<
/Tag>
}
{
<
Tag
color
=
{
colors
[
parseInt
(
text
)
%
colors
.
length
]
}
size
=
'large'
>
{
text
}
<
/Tag>
}
<
/div
>
<
/div
>
:
:
<><
/
>
<><
/
>
...
...
web/src/components/TokensTable.js
View file @
ed432c5a
...
@@ -187,21 +187,21 @@ const TokensTable = () => {
...
@@ -187,21 +187,21 @@ const TokensTable = () => {
const
closeEdit
=
()
=>
{
const
closeEdit
=
()
=>
{
setShowEdit
(
false
);
setShowEdit
(
false
);
setEditingToken
({
//
setEditingToken({
id
:
undefined
,
//
id: undefined,
});
//
});
}
}
const
setTokensFormat
=
(
tokens
)
=>
{
const
setTokensFormat
=
(
tokens
)
=>
{
setTokens
(
tokens
);
setTokens
(
tokens
);
if
(
tokens
.
length
==
=
ITEMS_PER_PAGE
)
{
if
(
tokens
.
length
>
=
ITEMS_PER_PAGE
)
{
setTokenCount
(
tokens
.
length
+
ITEMS_PER_PAGE
);
setTokenCount
(
tokens
.
length
+
ITEMS_PER_PAGE
);
}
else
{
}
else
{
setTokenCount
(
tokens
.
length
);
setTokenCount
(
tokens
.
length
);
}
}
}
}
//
let pageData = tokens.slice((activePage - 1) * ITEMS_PER_PAGE, activePage * ITEMS_PER_PAGE);
let
pageData
=
tokens
.
slice
((
activePage
-
1
)
*
ITEMS_PER_PAGE
,
activePage
*
ITEMS_PER_PAGE
);
const
loadTokens
=
async
(
startIdx
)
=>
{
const
loadTokens
=
async
(
startIdx
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
const
res
=
await
API
.
get
(
`/api/token/?p=
${
startIdx
}
`
);
const
res
=
await
API
.
get
(
`/api/token/?p=
${
startIdx
}
`
);
...
@@ -450,11 +450,12 @@ const TokensTable = () => {
...
@@ -450,11 +450,12 @@ const TokensTable = () => {
onClick
=
{
searchTokens
}
style
=
{{
marginRight
:
8
}}
>
查询
<
/Button
>
onClick
=
{
searchTokens
}
style
=
{{
marginRight
:
8
}}
>
查询
<
/Button
>
<
/Form
>
<
/Form
>
<
Table
style
=
{{
marginTop
:
20
}}
columns
=
{
columns
}
dataSource
=
{
tokens
}
pagination
=
{{
<
Table
style
=
{{
marginTop
:
20
}}
columns
=
{
columns
}
dataSource
=
{
pageData
}
pagination
=
{{
currentPage
:
activePage
,
currentPage
:
activePage
,
pageSize
:
ITEMS_PER_PAGE
,
pageSize
:
ITEMS_PER_PAGE
,
total
:
tokenCount
,
total
:
tokenCount
,
pageSizeOpts
:
[
10
,
20
,
50
,
100
],
showSizeChanger
:
true
,
pageSizeOptions
:
[
10
,
20
,
50
,
100
],
onPageChange
:
handlePageChange
,
onPageChange
:
handlePageChange
,
}}
loading
=
{
loading
}
rowSelection
=
{
rowSelection
}
>
}}
loading
=
{
loading
}
rowSelection
=
{
rowSelection
}
>
<
/Table
>
<
/Table
>
...
...
web/src/index.css
View file @
ed432c5a
...
@@ -8,6 +8,15 @@ body {
...
@@ -8,6 +8,15 @@ body {
scrollbar-width
:
none
;
scrollbar-width
:
none
;
color
:
var
(
--semi-color-text-0
)
!important
;
color
:
var
(
--semi-color-text-0
)
!important
;
background-color
:
var
(
--semi-color-bg-0
)
!important
;
background-color
:
var
(
--semi-color-bg-0
)
!important
;
height
:
100%
;
}
#root
{
height
:
100%
;
}
.semi-layout
{
height
:
100%
;
}
}
.tableShow
{
.tableShow
{
...
@@ -40,7 +49,7 @@ code {
...
@@ -40,7 +49,7 @@ code {
/*display: flex;*/
/*display: flex;*/
/*flex-direction: column;*/
/*flex-direction: column;*/
/*width: 100%;*/
/*width: 100%;*/
height
:
100
vh
;
height
:
100
%
;
overflow
:
hidden
;
overflow
:
hidden
;
}
}
...
...
web/src/index.js
View file @
ed432c5a
...
@@ -22,7 +22,6 @@ root.render(
...
@@ -22,7 +22,6 @@ root.render(
<
UserProvider
>
<
UserProvider
>
<
BrowserRouter
>
<
BrowserRouter
>
<
Layout
>
<
Layout
>
<
Sider
>
<
Sider
>
<
SiderBar
/>
<
SiderBar
/>
<
/Sider
>
<
/Sider
>
...
@@ -37,11 +36,12 @@ root.render(
...
@@ -37,11 +36,12 @@ root.render(
>
>
<
App
/>
<
App
/>
<
/Content
>
<
/Content
>
<
Footer
><
/Footer
>
{
/*<Layout.Footer>*/
}
<
/Layout
>
{
/* <Footer></Footer>*/
}
{
/*</Layout.Footer>*/
}
<
/Layout
>
<
/Layout
>
<
ToastContainer
/>
<
ToastContainer
/>
{
/*<Footer />*/
}
<
/Layout
>
<
/BrowserRouter
>
<
/BrowserRouter
>
<
/UserProvider
>
<
/UserProvider
>
<
/StatusProvider
>
<
/StatusProvider
>
...
...
web/src/pages/Token/EditToken.js
View file @
ed432c5a
...
@@ -112,6 +112,7 @@ const EditToken = (props) => {
...
@@ -112,6 +112,7 @@ const EditToken = (props) => {
return
(
return
(
<>
<>
<
SideSheet
<
SideSheet
placement
=
{
isEdit
?
'right'
:
'left'
}
title
=
{
<
Title
level
=
{
3
}
>
{
isEdit
?
'更新令牌信息'
:
'创建新的令牌'
}
<
/Title>
}
title
=
{
<
Title
level
=
{
3
}
>
{
isEdit
?
'更新令牌信息'
:
'创建新的令牌'
}
<
/Title>
}
headerStyle
=
{{
borderBottom
:
'1px solid var(--semi-color-border)'
}}
headerStyle
=
{{
borderBottom
:
'1px solid var(--semi-color-border)'
}}
bodyStyle
=
{{
borderBottom
:
'1px solid var(--semi-color-border)'
}}
bodyStyle
=
{{
borderBottom
:
'1px solid var(--semi-color-border)'
}}
...
...
web/src/pages/TopUp/index.js
View file @
ed432c5a
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Button
,
Confirm
,
Form
,
Grid
,
Header
,
Segment
,
Statistic
}
from
'semantic-ui-react'
;
import
{
Button
,
C
ard
,
C
onfirm
,
Form
,
Grid
,
Header
,
Segment
,
Statistic
}
from
'semantic-ui-react'
;
import
{
API
,
showError
,
showInfo
,
showSuccess
}
from
'../../helpers'
;
import
{
API
,
isMobile
,
showError
,
showInfo
,
showSuccess
}
from
'../../helpers'
;
import
{
renderNumber
,
renderQuota
}
from
'../../helpers/render'
;
import
{
renderNumber
,
renderQuota
}
from
'../../helpers/render'
;
import
{
Col
,
Layout
,
Row
,
Typography
}
from
"@douyinfe/semi-ui"
;
const
TopUp
=
()
=>
{
const
TopUp
=
()
=>
{
const
[
redemptionCode
,
setRedemptionCode
]
=
useState
(
''
);
const
[
redemptionCode
,
setRedemptionCode
]
=
useState
(
''
);
...
@@ -162,7 +163,15 @@ const TopUp = () => {
...
@@ -162,7 +163,15 @@ const TopUp = () => {
return
(
return
(
<
div
>
<
div
>
<
Segment
>
<
Layout
>
<
Layout
.
Header
>
<
h3
>
我的钱包
<
/h3
>
<
/Layout.Header
>
<
Layout
.
Content
>
<
div
style
=
{{
marginTop
:
20
,
paddingLeft
:
isMobile
()?
0
:
200
,
paddingRight
:
isMobile
()?
0
:
200
}}
>
<
Card
style
=
{{
width
:
'100%'
,
padding
:
'20px'
}}
>
<
Confirm
<
Confirm
open
=
{
open
}
open
=
{
open
}
content
=
{
'充值数量:'
+
topUpCount
+
',充值金额:'
+
renderAmount
()
+
',是否确认充值?'
}
content
=
{
'充值数量:'
+
topUpCount
+
',充值金额:'
+
renderAmount
()
+
',是否确认充值?'
}
...
@@ -171,7 +180,7 @@ const TopUp = () => {
...
@@ -171,7 +180,7 @@ const TopUp = () => {
onCancel
=
{
handleCancel
}
onCancel
=
{
handleCancel
}
onConfirm
=
{
onlineTopUp
}
onConfirm
=
{
onlineTopUp
}
/
>
/
>
<
Header
as
=
'h3'
>
充值额度
<
/Header
>
<
h3
>
兑换
<
/h3
>
<
Grid
columns
=
{
2
}
stackable
>
<
Grid
columns
=
{
2
}
stackable
>
<
Grid
.
Column
>
<
Grid
.
Column
>
<
Form
>
<
Form
>
...
@@ -200,8 +209,10 @@ const TopUp = () => {
...
@@ -200,8 +209,10 @@ const TopUp = () => {
<
/Statistic.Group
>
<
/Statistic.Group
>
<
/Grid.Column
>
<
/Grid.Column
>
<
/Grid
>
<
/Grid
>
<
/Segment
>
<
/Card
>
<
Segment
>
<
Card
style
=
{{
width
:
'100%'
,
padding
:
'20px'
}}
>
<
Header
as
=
'h3'
>
在线充值,最低
1
<
/Header
>
<
Header
as
=
'h3'
>
在线充值,最低
1
<
/Header
>
<
Grid
columns
=
{
2
}
stackable
>
<
Grid
columns
=
{
2
}
stackable
>
<
Grid
.
Column
>
<
Grid
.
Column
>
...
@@ -217,14 +228,6 @@ const TopUp = () => {
...
@@ -217,14 +228,6 @@ const TopUp = () => {
await
getAmount
(
e
.
target
.
value
);
await
getAmount
(
e
.
target
.
value
);
}}
}}
/
>
/
>
{
/*<Form.Input*/
}
{
/* placeholder='充值码,如果你没有充值码,可不填写'*/
}
{
/* name='redemptionCount'*/
}
{
/* value={topUpCode}*/
}
{
/* onChange={(e) => {*/
}
{
/* setTopUpCode(e.target.value);*/
}
{
/* }}*/
}
{
/*/>*/
}
<
Button
color
=
'blue'
onClick
=
{
<
Button
color
=
'blue'
onClick
=
{
async
()
=>
{
async
()
=>
{
preTopUp
(
'zfb'
)
preTopUp
(
'zfb'
)
...
@@ -250,7 +253,11 @@ const TopUp = () => {
...
@@ -250,7 +253,11 @@ const TopUp = () => {
<
/Statistic.Group
>
<
/Statistic.Group
>
<
/Grid.Column
>
<
/Grid.Column
>
<
/Grid
>
<
/Grid
>
<
/Segment
>
<
/Card
>
<
/div
>
<
/Layout.Content
>
<
/Layout
>
<
/div
>
<
/div
>
);
);
...
...
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