mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-10 10:33:41 +08:00
feat: able to change theme
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user