feat: able to change theme

This commit is contained in:
JustSong
2024-01-07 17:53:05 +08:00
parent 8491785c9d
commit 86261cc656
3 changed files with 60 additions and 15 deletions

View File

@@ -1,18 +1,18 @@
import { useState, useEffect } from 'react';
import SubCard from 'ui-component/cards/SubCard';
import {
Stack,
FormControl,
InputLabel,
OutlinedInput,
Button,
Alert,
TextField,
Dialog,
DialogTitle,
DialogActions,
DialogContent,
Divider
Stack,
FormControl,
InputLabel,
OutlinedInput,
Button,
Alert,
TextField,
Dialog,
DialogTitle,
DialogActions,
DialogContent,
Divider, Link
} from '@mui/material';
import Grid from '@mui/material/Unstable_Grid2';
import { showError, showSuccess } from 'utils/common'; //,
@@ -26,7 +26,8 @@ const OtherSetting = () => {
About: '',
SystemName: '',
Logo: '',
HomePageContent: ''
HomePageContent: '',
Theme: '',
});
let [loading, setLoading] = useState(false);
const [showUpdateModal, setShowUpdateModal] = useState(false);
@@ -88,6 +89,10 @@ const OtherSetting = () => {
await updateOption('SystemName', inputs.SystemName);
};
const submitTheme = async () => {
await updateOption('Theme', inputs.Theme);
};
const submitLogo = async () => {
await updateOption('Logo', inputs.Logo);
};
@@ -171,6 +176,25 @@ const OtherSetting = () => {
设置系统名称
</Button>
</Grid>
<Grid xs={12}>
<FormControl fullWidth>
<InputLabel htmlFor="Theme">主题名称</InputLabel>
<OutlinedInput
id="Theme"
name="Theme"
value={inputs.Theme || ''}
onChange={handleInputChange}
label="主题名称"
placeholder="请输入主题名称"
disabled={loading}
/>
</FormControl>
</Grid>
<Grid xs={12}>
<Button variant="contained" onClick={submitTheme}>
设置主题重启生效
</Button>
</Grid>
<Grid xs={12}>
<FormControl fullWidth>
<InputLabel htmlFor="Logo">Logo 图片地址</InputLabel>