index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React from 'react';
  2. import SystemSetting from '../../components/SystemSetting';
  3. import {isRoot} from '../../helpers';
  4. import OtherSetting from '../../components/OtherSetting';
  5. import PersonalSetting from '../../components/PersonalSetting';
  6. import OperationSetting from '../../components/OperationSetting';
  7. import {Layout, TabPane, Tabs} from "@douyinfe/semi-ui";
  8. const Setting = () => {
  9. let panes = [
  10. {
  11. tab: '个人设置',
  12. content: <PersonalSetting/>,
  13. itemKey: '1'
  14. }
  15. ];
  16. if (isRoot()) {
  17. panes.push({
  18. tab: '运营设置',
  19. content: <OperationSetting/>,
  20. itemKey: '2'
  21. });
  22. panes.push({
  23. tab: '系统设置',
  24. content: <SystemSetting/>,
  25. itemKey: '3'
  26. });
  27. panes.push({
  28. tab: '其他设置',
  29. content: <OtherSetting/>,
  30. itemKey: '4'
  31. });
  32. }
  33. return (
  34. <div>
  35. <Layout>
  36. <Layout.Content>
  37. <Tabs type="line" defaultActiveKey="1">
  38. {panes.map(pane => (
  39. <TabPane itemKey={pane.itemKey} tab={pane.tab}>
  40. {pane.content}
  41. </TabPane>
  42. ))}
  43. </Tabs>
  44. </Layout.Content>
  45. </Layout>
  46. </div>
  47. );
  48. };
  49. export default Setting;