mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-18 00:16:37 +08:00
修复令牌bug
This commit is contained in:
parent
9eb8ad6786
commit
e06186fe0c
@ -89,6 +89,7 @@ function App() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
|
<Layout.Content>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route
|
<Route
|
||||||
path='/'
|
path='/'
|
||||||
@ -298,6 +299,7 @@ function App() {
|
|||||||
<NotFound />
|
<NotFound />
|
||||||
} />
|
} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
</Layout.Content>
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -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>
|
||||||
:
|
:
|
||||||
<></>
|
<></>
|
||||||
|
@ -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 = () => {
|
|||||||
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>
|
||||||
|
@ -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 {
|
|||||||
/*display: flex;*/
|
/*display: flex;*/
|
||||||
/*flex-direction: column;*/
|
/*flex-direction: column;*/
|
||||||
/*width: 100%;*/
|
/*width: 100%;*/
|
||||||
height: 100vh;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ root.render(
|
|||||||
<UserProvider>
|
<UserProvider>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Layout>
|
<Layout>
|
||||||
|
|
||||||
<Sider>
|
<Sider>
|
||||||
<SiderBar/>
|
<SiderBar/>
|
||||||
</Sider>
|
</Sider>
|
||||||
@ -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>
|
||||||
|
@ -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)'}}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
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, Card, Confirm, 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 = () => {
|
|||||||
|
|
||||||
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 = () => {
|
|||||||
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 = () => {
|
|||||||
</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 = () => {
|
|||||||
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 = () => {
|
|||||||
</Statistic.Group>
|
</Statistic.Group>
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Segment>
|
</Card>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</Layout.Content>
|
||||||
|
</Layout>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user