feat: 完成个人设置界面
This commit is contained in:
parent
8d8792a283
commit
27b75d79b8
@ -47,7 +47,7 @@ const PersonalSetting = () => {
|
|||||||
const [countdown, setCountdown] = useState(30);
|
const [countdown, setCountdown] = useState(30);
|
||||||
const [affLink, setAffLink] = useState('');
|
const [affLink, setAffLink] = useState('');
|
||||||
const [systemToken, setSystemToken] = useState('');
|
const [systemToken, setSystemToken] = useState('');
|
||||||
const [models, setModels] = useState([]);
|
// const [models, setModels] = useState([]);
|
||||||
const [openTransfer, setOpenTransfer] = useState(false);
|
const [openTransfer, setOpenTransfer] = useState(false);
|
||||||
const [transferAmount, setTransferAmount] = useState(0);
|
const [transferAmount, setTransferAmount] = useState(0);
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ const PersonalSetting = () => {
|
|||||||
console.log(userState);
|
console.log(userState);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
loadModels().then();
|
// loadModels().then();
|
||||||
getAffLink().then();
|
getAffLink().then();
|
||||||
setTransferAmount(getQuotaPerUnit());
|
setTransferAmount(getQuotaPerUnit());
|
||||||
}, []);
|
}, []);
|
||||||
@ -127,16 +127,16 @@ const PersonalSetting = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadModels = async () => {
|
// const loadModels = async () => {
|
||||||
let res = await API.get(`/api/user/models`);
|
// let res = await API.get(`/api/user/models`);
|
||||||
const { success, message, data } = res.data;
|
// const { success, message, data } = res.data;
|
||||||
if (success) {
|
// if (success) {
|
||||||
setModels(data);
|
// setModels(data);
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
} else {
|
// } else {
|
||||||
showError(message);
|
// showError(message);
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
const handleAffLinkClick = async (e) => {
|
const handleAffLinkClick = async (e) => {
|
||||||
e.target.select();
|
e.target.select();
|
||||||
@ -311,7 +311,7 @@ const PersonalSetting = () => {
|
|||||||
<Typography.Text>{`划转额度${renderQuotaWithPrompt(transferAmount)} 最低` + renderQuota(getQuotaPerUnit())}</Typography.Text>
|
<Typography.Text>{`划转额度${renderQuotaWithPrompt(transferAmount)} 最低` + renderQuota(getQuotaPerUnit())}</Typography.Text>
|
||||||
<div>
|
<div>
|
||||||
<InputNumber min={0} style={{ marginTop: 5 }} value={transferAmount}
|
<InputNumber min={0} style={{ marginTop: 5 }} value={transferAmount}
|
||||||
onChange={(value) => setTransferAmount(value)} disabled={false}></InputNumber>
|
onChange={(value) => setTransferAmount(value)} disabled={false}></InputNumber>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
@ -320,7 +320,7 @@ const PersonalSetting = () => {
|
|||||||
title={
|
title={
|
||||||
<Card.Meta
|
<Card.Meta
|
||||||
avatar={<Avatar size="default" color={stringToColor(getUsername())}
|
avatar={<Avatar size="default" color={stringToColor(getUsername())}
|
||||||
style={{ marginRight: 4 }}>
|
style={{ marginRight: 4 }}>
|
||||||
{typeof getUsername() === 'string' && getUsername().slice(0, 1)}
|
{typeof getUsername() === 'string' && getUsername().slice(0, 1)}
|
||||||
</Avatar>}
|
</Avatar>}
|
||||||
title={<Typography.Text>{getUsername()}</Typography.Text>}
|
title={<Typography.Text>{getUsername()}</Typography.Text>}
|
||||||
@ -343,7 +343,8 @@ const PersonalSetting = () => {
|
|||||||
</Descriptions>
|
</Descriptions>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Typography.Title heading={6}>可用模型</Typography.Title>
|
<Typography.Title heading={6}>调用信息</Typography.Title>
|
||||||
|
{/* <Typography.Title heading={6}>可用模型</Typography.Title>
|
||||||
<div style={{ marginTop: 10 }}>
|
<div style={{ marginTop: 10 }}>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
{models.map((model) => (
|
{models.map((model) => (
|
||||||
@ -354,10 +355,9 @@ const PersonalSetting = () => {
|
|||||||
</Tag>
|
</Tag>
|
||||||
))}
|
))}
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
</Card>
|
</Card>
|
||||||
<Card
|
{/* <Card
|
||||||
footer={
|
footer={
|
||||||
<div>
|
<div>
|
||||||
<Typography.Text>邀请链接</Typography.Text>
|
<Typography.Text>邀请链接</Typography.Text>
|
||||||
@ -374,19 +374,28 @@ const PersonalSetting = () => {
|
|||||||
<div style={{ marginTop: 10 }}>
|
<div style={{ marginTop: 10 }}>
|
||||||
<Descriptions row>
|
<Descriptions row>
|
||||||
<Descriptions.Item itemKey="待使用收益">
|
<Descriptions.Item itemKey="待使用收益">
|
||||||
<span style={{ color: 'rgba(var(--semi-red-5), 1)' }}>
|
<span style={{ color: 'rgba(var(--semi-red-5), 1)' }}>
|
||||||
{
|
{
|
||||||
renderQuota(userState?.user?.aff_quota)
|
renderQuota(userState?.user?.aff_quota)
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
<Button type={'secondary'} onClick={() => setOpenTransfer(true)} size={'small'}
|
<Button type={'secondary'} onClick={() => setOpenTransfer(true)} size={'small'}
|
||||||
style={{ marginLeft: 10 }}>划转</Button>
|
style={{ marginLeft: 10 }}>划转</Button>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item
|
<Descriptions.Item
|
||||||
itemKey="总收益">{renderQuota(userState?.user?.aff_history_quota)}</Descriptions.Item>
|
itemKey="总收益">{renderQuota(userState?.user?.aff_history_quota)}</Descriptions.Item>
|
||||||
<Descriptions.Item itemKey="邀请人数">{userState?.user?.aff_count}</Descriptions.Item>
|
<Descriptions.Item itemKey="邀请人数">{userState?.user?.aff_count}</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
</div>
|
</div>
|
||||||
|
</Card> */}
|
||||||
|
<Card>
|
||||||
|
<Typography.Title heading={6}>邀请链接</Typography.Title>
|
||||||
|
<Input
|
||||||
|
style={{ marginTop: 10 }}
|
||||||
|
value={affLink}
|
||||||
|
onClick={handleAffLinkClick}
|
||||||
|
readOnly
|
||||||
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
<Card>
|
<Card>
|
||||||
<Typography.Title heading={6}>个人信息</Typography.Title>
|
<Typography.Title heading={6}>个人信息</Typography.Title>
|
||||||
@ -403,8 +412,8 @@ const PersonalSetting = () => {
|
|||||||
<Button onClick={() => {
|
<Button onClick={() => {
|
||||||
setShowEmailBindModal(true);
|
setShowEmailBindModal(true);
|
||||||
}}>{
|
}}>{
|
||||||
userState.user && userState.user.email !== '' ? '修改绑定' : '绑定邮箱'
|
userState.user && userState.user.email !== '' ? '修改绑定' : '绑定邮箱'
|
||||||
}</Button>
|
}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -450,7 +459,7 @@ const PersonalSetting = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ marginTop: 10 }}>
|
{/* <div style={{ marginTop: 10 }}>
|
||||||
<Typography.Text strong>Telegram</Typography.Text>
|
<Typography.Text strong>Telegram</Typography.Text>
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||||
<div>
|
<div>
|
||||||
@ -463,12 +472,12 @@ const PersonalSetting = () => {
|
|||||||
{status.telegram_oauth ?
|
{status.telegram_oauth ?
|
||||||
userState.user.telegram_id !== '' ? <Button disabled={true}>已绑定</Button>
|
userState.user.telegram_id !== '' ? <Button disabled={true}>已绑定</Button>
|
||||||
: <TelegramLoginButton dataAuthUrl="/api/oauth/telegram/bind"
|
: <TelegramLoginButton dataAuthUrl="/api/oauth/telegram/bind"
|
||||||
botName={status.telegram_bot_name} />
|
botName={status.telegram_bot_name} />
|
||||||
: <Button disabled={true}>未启用</Button>
|
: <Button disabled={true}>未启用</Button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
<div style={{ marginTop: 10 }}>
|
<div style={{ marginTop: 10 }}>
|
||||||
<Space>
|
<Space>
|
||||||
@ -543,7 +552,7 @@ const PersonalSetting = () => {
|
|||||||
type="email"
|
type="email"
|
||||||
/>
|
/>
|
||||||
<Button onClick={sendVerificationCode}
|
<Button onClick={sendVerificationCode}
|
||||||
disabled={disableButton || loading}>
|
disabled={disableButton || loading}>
|
||||||
{disableButton ? `重新发送(${countdown})` : '获取验证码'}
|
{disableButton ? `重新发送(${countdown})` : '获取验证码'}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user