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
17bd2d0c
authored
Jun 21, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: do not show dollar balance if not enabled
parent
cded3643
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
web/src/helpers/render.js
+10
-0
web/src/pages/Redemption/EditRedemption.js
+3
-3
web/src/pages/Token/EditToken.js
+2
-2
No files found.
web/src/helpers/render.js
View file @
17bd2d0c
...
@@ -46,4 +46,13 @@ export function renderQuota(quota, digits = 2) {
...
@@ -46,4 +46,13 @@ export function renderQuota(quota, digits = 2) {
return
'$'
+
(
quota
/
quotaPerUnit
).
toFixed
(
digits
);
return
'$'
+
(
quota
/
quotaPerUnit
).
toFixed
(
digits
);
}
}
return
renderNumber
(
quota
);
return
renderNumber
(
quota
);
}
export
function
renderQuotaWithPrompt
(
quota
,
digits
)
{
let
displayInCurrency
=
localStorage
.
getItem
(
'display_in_currency'
);
displayInCurrency
=
displayInCurrency
===
'true'
;
if
(
displayInCurrency
)
{
return
`(等价金额:
${
renderQuota
(
quota
,
digits
)}
)`
;
}
return
''
;
}
}
\ No newline at end of file
web/src/pages/Redemption/EditRedemption.js
View file @
17bd2d0c
...
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
...
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import
{
Button
,
Form
,
Header
,
Segment
}
from
'semantic-ui-react'
;
import
{
Button
,
Form
,
Header
,
Segment
}
from
'semantic-ui-react'
;
import
{
useParams
}
from
'react-router-dom'
;
import
{
useParams
}
from
'react-router-dom'
;
import
{
API
,
downloadTextAsFile
,
showError
,
showSuccess
}
from
'../../helpers'
;
import
{
API
,
downloadTextAsFile
,
showError
,
showSuccess
}
from
'../../helpers'
;
import
{
renderQuota
}
from
'../../helpers/render'
;
import
{
renderQuota
,
renderQuotaWithPrompt
}
from
'../../helpers/render'
;
const
EditRedemption
=
()
=>
{
const
EditRedemption
=
()
=>
{
const
params
=
useParams
();
const
params
=
useParams
();
...
@@ -11,7 +11,7 @@ const EditRedemption = () => {
...
@@ -11,7 +11,7 @@ const EditRedemption = () => {
const
[
loading
,
setLoading
]
=
useState
(
isEdit
);
const
[
loading
,
setLoading
]
=
useState
(
isEdit
);
const
originInputs
=
{
const
originInputs
=
{
name
:
''
,
name
:
''
,
quota
:
100
,
quota
:
100
000
,
count
:
1
count
:
1
};
};
const
[
inputs
,
setInputs
]
=
useState
(
originInputs
);
const
[
inputs
,
setInputs
]
=
useState
(
originInputs
);
...
@@ -88,7 +88,7 @@ const EditRedemption = () => {
...
@@ -88,7 +88,7 @@ const EditRedemption = () => {
<
/Form.Field
>
<
/Form.Field
>
<
Form
.
Field
>
<
Form
.
Field
>
<
Form
.
Input
<
Form
.
Input
label
=
{
`额度
(等价金额
${
renderQuota
(
quota
)}
)
`
}
label
=
{
`额度
${
renderQuotaWithPrompt
(
quota
)}
`
}
name
=
'quota'
name
=
'quota'
placeholder
=
{
'请输入单个兑换码中包含的额度'
}
placeholder
=
{
'请输入单个兑换码中包含的额度'
}
onChange
=
{
handleInputChange
}
onChange
=
{
handleInputChange
}
...
...
web/src/pages/Token/EditToken.js
View file @
17bd2d0c
...
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
...
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import
{
Button
,
Form
,
Header
,
Message
,
Segment
}
from
'semantic-ui-react'
;
import
{
Button
,
Form
,
Header
,
Message
,
Segment
}
from
'semantic-ui-react'
;
import
{
useParams
}
from
'react-router-dom'
;
import
{
useParams
}
from
'react-router-dom'
;
import
{
API
,
showError
,
showSuccess
,
timestamp2string
}
from
'../../helpers'
;
import
{
API
,
showError
,
showSuccess
,
timestamp2string
}
from
'../../helpers'
;
import
{
renderQuota
}
from
'../../helpers/render'
;
import
{
renderQuota
,
renderQuotaWithPrompt
}
from
'../../helpers/render'
;
const
EditToken
=
()
=>
{
const
EditToken
=
()
=>
{
const
params
=
useParams
();
const
params
=
useParams
();
...
@@ -138,7 +138,7 @@ const EditToken = () => {
...
@@ -138,7 +138,7 @@ const EditToken = () => {
<
Message
>
注意,令牌的额度仅用于限制令牌本身的最大额度使用量,实际的使用受到账户的剩余额度限制。
<
/Message
>
<
Message
>
注意,令牌的额度仅用于限制令牌本身的最大额度使用量,实际的使用受到账户的剩余额度限制。
<
/Message
>
<
Form
.
Field
>
<
Form
.
Field
>
<
Form
.
Input
<
Form
.
Input
label
=
{
`额度
(等价金额
${
renderQuota
(
remain_quota
)}
)
`
}
label
=
{
`额度
${
renderQuotaWithPrompt
(
remain_quota
)}
`
}
name
=
'remain_quota'
name
=
'remain_quota'
placeholder
=
{
'请输入额度'
}
placeholder
=
{
'请输入额度'
}
onChange
=
{
handleInputChange
}
onChange
=
{
handleInputChange
}
...
...
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