feat: able to set top up link now

This commit is contained in:
JustSong
2023-04-27 16:32:21 +08:00
parent 54b1e4adef
commit f97c2b4c22
6 changed files with 53 additions and 13 deletions

View File

@@ -25,6 +25,7 @@ const SystemSetting = () => {
TurnstileSecretKey: '',
RegisterEnabled: '',
QuotaForNewUser: 0,
TopUpLink: ''
});
let originInputs = {};
let [loading, setLoading] = useState(false);
@@ -65,7 +66,7 @@ const SystemSetting = () => {
}
const res = await API.put('/api/option', {
key,
value,
value
});
const { success, message } = res.data;
if (success) {
@@ -88,7 +89,8 @@ const SystemSetting = () => {
name === 'WeChatAccountQRCodeImageURL' ||
name === 'TurnstileSiteKey' ||
name === 'TurnstileSecretKey' ||
name === 'QuotaForNewUser'
name === 'QuotaForNewUser' ||
name === 'TopUpLink'
) {
setInputs((inputs) => ({ ...inputs, [name]: value }));
} else {
@@ -101,6 +103,15 @@ const SystemSetting = () => {
await updateOption('ServerAddress', ServerAddress);
};
const submitOperationConfig = async () => {
if (originInputs['QuotaForNewUser'] !== inputs.QuotaForNewUser) {
await updateOption('QuotaForNewUser', inputs.QuotaForNewUser);
}
if (originInputs['TopUpLink'] !== inputs.TopUpLink) {
await updateOption('TopUpLink', inputs.TopUpLink);
}
}
const submitSMTP = async () => {
if (originInputs['SMTPServer'] !== inputs.SMTPServer) {
await updateOption('SMTPServer', inputs.SMTPServer);
@@ -244,10 +255,17 @@ const SystemSetting = () => {
min='0'
placeholder='例如100'
/>
<Form.Input
label='充值链接'
name='TopUpLink'
onChange={handleInputChange}
autoComplete='off'
value={inputs.TopUpLink}
type='link'
placeholder='例如发卡网站的购买链接'
/>
</Form.Group>
<Form.Button onClick={()=>{
updateOption('QuotaForNewUser', inputs.QuotaForNewUser).then();
}}>保存运营设置</Form.Button>
<Form.Button onClick={submitOperationConfig}>保存运营设置</Form.Button>
<Divider />
<Header as='h3'>
配置 SMTP