59 lines
1.4 KiB
JavaScript
Raw Normal View History

import React, { useState } from 'react';
2023-04-22 20:39:27 +08:00
import SystemSetting from '../../components/SystemSetting';
2024-03-23 21:24:39 +08:00
import { isRoot } from '../../helpers';
2023-04-22 20:39:27 +08:00
import OtherSetting from '../../components/OtherSetting';
import PersonalSetting from '../../components/PersonalSetting';
import OperationSetting from '../../components/OperationSetting';
2024-03-23 21:24:39 +08:00
import { Layout, TabPane, Tabs } from '@douyinfe/semi-ui';
2023-04-22 20:39:27 +08:00
const Setting = () => {
const [tabActiveKey, setTabActiveKey] = useState('1');
2024-03-23 21:24:39 +08:00
let panes = [
{
tab: '个人设置',
content: <PersonalSetting />,
itemKey: '1',
},
];
2023-04-22 20:39:27 +08:00
2024-03-23 21:24:39 +08:00
if (isRoot()) {
panes.push({
tab: '运营设置',
content: <OperationSetting />,
itemKey: '2',
});
panes.push({
tab: '系统设置',
content: <SystemSetting />,
itemKey: '3',
});
panes.push({
tab: '其他设置',
content: <OtherSetting />,
itemKey: '4',
});
}
2023-04-22 20:39:27 +08:00
2024-03-23 21:24:39 +08:00
return (
<div>
<Layout>
<Layout.Content>
<Tabs
type='line'
defaultActiveKey='1'
onChange={(key) => setTabActiveKey(key)}
>
2024-03-23 21:24:39 +08:00
{panes.map((pane) => (
<TabPane itemKey={pane.itemKey} tab={pane.tab} key={pane.itemKey}>
{tabActiveKey === pane.itemKey && pane.content}
2024-03-23 21:24:39 +08:00
</TabPane>
))}
</Tabs>
</Layout.Content>
</Layout>
</div>
);
2023-04-22 20:39:27 +08:00
};
export default Setting;