diff --git a/web/src/pages/User/EditUser.js b/web/src/pages/User/EditUser.js index 596edcc..90bbc4b 100644 --- a/web/src/pages/User/EditUser.js +++ b/web/src/pages/User/EditUser.js @@ -1,12 +1,13 @@ import React, { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { API, isMobile, showError, showSuccess } from '../../helpers'; -import { renderQuotaWithPrompt } from '../../helpers/render'; +import { renderQuota, renderQuotaWithPrompt } from '../../helpers/render'; import Title from '@douyinfe/semi-ui/lib/es/typography/title'; import { Button, Divider, Input, + Modal, Select, SideSheet, Space, @@ -17,6 +18,8 @@ import { const EditUser = (props) => { const userId = props.editingUser.id; const [loading, setLoading] = useState(true); + const [addQuotaModalOpen, setIsModalOpen] = useState(false); + const [addQuotaLocal, setAddQuotaLocal] = useState(0); const [inputs, setInputs] = useState({ username: '', display_name: '', @@ -107,6 +110,16 @@ const EditUser = (props) => { setLoading(false); }; + const addLocalQuota = () => { + let newQuota = parseInt(quota) + addQuotaLocal; + setInputs((inputs) => ({ ...inputs, quota: newQuota })); + }; + + const openAddQuotaModal = () => { + setAddQuotaLocal(0); + setIsModalOpen(true); + }; + return ( <> {
{`剩余额度${renderQuotaWithPrompt(quota)}`}
- handleInputChange('quota', value)} - value={quota} - type={'number'} - autoComplete='new-password' - /> + + handleInputChange('quota', value)} + value={quota} + type={'number'} + autoComplete='new-password' + /> + + )} 以下信息不可修改 @@ -245,6 +261,28 @@ const EditUser = (props) => { />
+ { + addLocalQuota(); + setIsModalOpen(false); + }} + onCancel={() => setIsModalOpen(false)} + closable={null} + > +
+ {`新额度${renderQuota(quota)} + ${renderQuota(addQuotaLocal)} = ${renderQuota(quota + addQuotaLocal)}`} +
+ setAddQuotaLocal(parseInt(value))} + value={addQuotaLocal} + type={'number'} + autoComplete='new-password' + /> +
); };