- 新增 React + TDesign 管理端(sau_web_react),替代历史 Vue 前端 - 后端接入 11 平台登录/发布(视频+图文),check_cookie 扩展全平台 - 异步发布任务 + 实时进度监控 + 发布日志 - Open API 开放体系(API Key 鉴权 + 7 个开放接口 + API 文档页) - 账号单/批量校验与批量删除 - 全局配置(登录方式 + 发布静默模式) - 统一浏览器为系统 Chrome,品牌文案统一为 EveryPublish
124 lines
3.2 KiB
TypeScript
124 lines
3.2 KiB
TypeScript
import React, { memo } from 'react';
|
|
import { Row, Col, Switch } from 'tdesign-react';
|
|
import { useAppDispatch, useAppSelector } from 'modules/store';
|
|
import {
|
|
selectGlobal,
|
|
toggleShowHeader,
|
|
toggleShowBreadcrumbs,
|
|
toggleShowFooter,
|
|
switchTheme,
|
|
switchColor,
|
|
switchLayout,
|
|
openSystemTheme,
|
|
ELayout,
|
|
} from 'modules/global';
|
|
import { ETheme } from 'types/index.d';
|
|
import RadioColor from './RadioColor';
|
|
import RadioRect from './RadioRect';
|
|
|
|
import Light from 'assets/svg/assets-setting-light.svg?component';
|
|
import Dark from 'assets/svg/assets-setting-dark.svg?component';
|
|
import System from 'assets/svg/assets-setting-auto.svg?component';
|
|
|
|
import Style from './index.module.less';
|
|
|
|
enum ESettingTheme {
|
|
system,
|
|
}
|
|
|
|
const themeList = [
|
|
{
|
|
value: ETheme.light,
|
|
image: <Light />,
|
|
name: '明亮',
|
|
},
|
|
{
|
|
value: ETheme.dark,
|
|
image: <Dark />,
|
|
name: '黑暗',
|
|
},
|
|
{
|
|
value: ESettingTheme.system,
|
|
image: <System />,
|
|
name: '跟随系统',
|
|
},
|
|
];
|
|
|
|
const layoutList = [
|
|
{
|
|
value: ELayout.side,
|
|
image: 'https://tdesign.gtimg.com/starter/setting/side.png',
|
|
},
|
|
{
|
|
value: ELayout.top,
|
|
image: 'https://tdesign.gtimg.com/starter/setting/top.png',
|
|
},
|
|
{
|
|
value: ELayout.mix,
|
|
image: 'https://tdesign.gtimg.com/starter/setting/mix.png',
|
|
},
|
|
];
|
|
|
|
export default memo(() => {
|
|
const dispatch = useAppDispatch();
|
|
const globalState = useAppSelector(selectGlobal);
|
|
|
|
const handleThemeSwitch = (value: any) => {
|
|
if (value === ESettingTheme.system) {
|
|
dispatch(openSystemTheme());
|
|
} else {
|
|
dispatch(switchTheme(value));
|
|
dispatch(switchColor(globalState.color));
|
|
}
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<div className={Style.settingTitle}>主题模式</div>
|
|
<RadioRect
|
|
defaultValue={globalState.systemTheme ? ESettingTheme.system : globalState.theme}
|
|
onChange={handleThemeSwitch}
|
|
options={themeList}
|
|
/>
|
|
|
|
<div className={Style.settingTitle}>主题色</div>
|
|
<RadioColor defaultValue={globalState.color} onChange={(value) => dispatch(switchColor(value))} />
|
|
|
|
<div className={Style.settingTitle}>导航布局</div>
|
|
<RadioRect
|
|
defaultValue={globalState.layout}
|
|
onChange={(value) => dispatch(switchLayout(value))}
|
|
options={layoutList}
|
|
/>
|
|
|
|
<div className={Style.settingTitle}>元素开关</div>
|
|
<Row justify='space-between'>
|
|
<Col>
|
|
<div className={Style.settingSubTitle}>显示 Header</div>
|
|
</Col>
|
|
<Col>
|
|
<Switch size='large' value={globalState.showHeader} onChange={() => dispatch(toggleShowHeader())} />
|
|
</Col>
|
|
</Row>
|
|
|
|
<Row justify='space-between'>
|
|
<Col>
|
|
<div className={Style.settingSubTitle}>显示 Breadcrumbs</div>
|
|
</Col>
|
|
<Col>
|
|
<Switch size='large' value={globalState.showBreadcrumbs} onChange={() => dispatch(toggleShowBreadcrumbs())} />
|
|
</Col>
|
|
</Row>
|
|
|
|
<Row justify='space-between'>
|
|
<Col>
|
|
<div className={Style.settingSubTitle}>显示 Footer</div>
|
|
</Col>
|
|
<Col>
|
|
<Switch size='large' value={globalState.showFooter} onChange={() => dispatch(toggleShowFooter())} />
|
|
</Col>
|
|
</Row>
|
|
</div>
|
|
);
|
|
});
|