mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-18 00:16:37 +08:00
feat: 编辑额度支持负数
This commit is contained in:
parent
b427f0278f
commit
d8c006046f
@ -19,7 +19,7 @@ const EditUser = (props) => {
|
|||||||
const userId = props.editingUser.id;
|
const userId = props.editingUser.id;
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [addQuotaModalOpen, setIsModalOpen] = useState(false);
|
const [addQuotaModalOpen, setIsModalOpen] = useState(false);
|
||||||
const [addQuotaLocal, setAddQuotaLocal] = useState(0);
|
const [addQuotaLocal, setAddQuotaLocal] = useState('');
|
||||||
const [inputs, setInputs] = useState({
|
const [inputs, setInputs] = useState({
|
||||||
username: '',
|
username: '',
|
||||||
display_name: '',
|
display_name: '',
|
||||||
@ -111,12 +111,12 @@ const EditUser = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const addLocalQuota = () => {
|
const addLocalQuota = () => {
|
||||||
let newQuota = parseInt(quota) + addQuotaLocal;
|
let newQuota = parseInt(quota) + parseInt(addQuotaLocal);
|
||||||
setInputs((inputs) => ({ ...inputs, quota: newQuota }));
|
setInputs((inputs) => ({ ...inputs, quota: newQuota }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const openAddQuotaModal = () => {
|
const openAddQuotaModal = () => {
|
||||||
setAddQuotaLocal(0);
|
setAddQuotaLocal('0');
|
||||||
setIsModalOpen(true);
|
setIsModalOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -272,12 +272,14 @@ const EditUser = (props) => {
|
|||||||
closable={null}
|
closable={null}
|
||||||
>
|
>
|
||||||
<div style={{ marginTop: 20 }}>
|
<div style={{ marginTop: 20 }}>
|
||||||
<Typography.Text>{`新额度${renderQuota(quota)} + ${renderQuota(addQuotaLocal)} = ${renderQuota(quota + addQuotaLocal)}`}</Typography.Text>
|
<Typography.Text>{`新额度${renderQuota(quota)} + ${renderQuota(addQuotaLocal)} = ${renderQuota(quota + parseInt(addQuotaLocal))}`}</Typography.Text>
|
||||||
</div>
|
</div>
|
||||||
<Input
|
<Input
|
||||||
name='addQuotaLocal'
|
name='addQuotaLocal'
|
||||||
placeholder={'需要添加的额度'}
|
placeholder={'需要添加的额度(支持负数)'}
|
||||||
onChange={(value) => setAddQuotaLocal(parseInt(value))}
|
onChange={(value) => {
|
||||||
|
setAddQuotaLocal(value);
|
||||||
|
}}
|
||||||
value={addQuotaLocal}
|
value={addQuotaLocal}
|
||||||
type={'number'}
|
type={'number'}
|
||||||
autoComplete='new-password'
|
autoComplete='new-password'
|
||||||
|
Loading…
Reference in New Issue
Block a user