From b427f0278f1047558f0a676dfbb9d697322b6ac0 Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Sun, 12 May 2024 16:06:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B9=E4=BE=BF=E5=9C=B0?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=94=A8=E6=88=B7=E9=A2=9D=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/User/EditUser.js | 56 ++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 9 deletions(-) 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' + /> +
); };