diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 9369776..8b5dc47 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -13,6 +13,7 @@ import UserLayout from "./UserLayout"; import { IRouterProps, RouterContext } from "./RouterContext"; import { layoutConfig } from "@/layouts/config"; import stores from "@/store"; +import { Storage } from "@/utils"; import "moment/locale/zh-cn"; import "antd/dist/antd.variable.min.css"; @@ -38,6 +39,16 @@ const Layout = ({ children, location, route, history, match }: IRouteComponentPr useEffect(() => { // API.SettingService.initSystemParam(); + const { themeFontSize } = Storage.local.get("theme-themeInfo") || { themeFontSize: "12" }; + document.documentElement.style.setProperty("--data-size", themeFontSize + "px"); + const checkData = () => { + const { themeFontSize } = Storage.local.get("theme-themeInfo") || { themeFontSize: "12" }; + document.documentElement.style.setProperty("--data-size", themeFontSize + "px"); + }; + window.addEventListener("storage", checkData); + return () => { + window.removeEventListener("storage", checkData); + }; }, []); let layout; diff --git a/src/pages/atdTable/components/index.less b/src/pages/atdTable/components/index.less index 3c0cd6c..bed55a6 100644 --- a/src/pages/atdTable/components/index.less +++ b/src/pages/atdTable/components/index.less @@ -80,7 +80,7 @@ } .danger { - font-size: 12px; + font-size: var(--data-size); color: rgb(217, 0, 27) } @@ -140,11 +140,11 @@ align-items: center; margin-right: 12px; color: #5d9cec; - font-size: 12px; + font-size: var(--data-size); :global { .anticon { - font-size: 12px; + font-size: var(--data-size); margin-right: 4px; } } @@ -176,7 +176,7 @@ .ant-btn-link, .ant-dropdown-trigger { padding: 0; - font-size: 12px; + font-size: var(--data-size); color: #333; } @@ -199,7 +199,7 @@ .ant-spin-container { .ant-pagination { - font-size: 12px; + font-size: var(--data-size); align-items: center; margin-right: 8px; @@ -225,7 +225,7 @@ .ant-pagination-options { .ant-select { - font-size: 12px; + font-size: var(--data-size); .ant-select-selector { height: 28px; @@ -242,7 +242,7 @@ } .ant-select-item { - font-size: 12px; + font-size: var(--data-size); } } @@ -264,7 +264,7 @@ } th, td { - font-size: 12px; + font-size: var(--data-size); .ant-form-item { margin-bottom: 0; @@ -277,7 +277,7 @@ .ant-typography { margin-bottom: 0 !important; - font-size: 12px !important; + font-size: var(--data-size) !important; } .ant-checkbox-inner { @@ -307,7 +307,7 @@ .moreIconWrapper { :global { .ant-btn-link { - font-size: 12px; + font-size: var(--data-size); color: #333; } @@ -321,7 +321,7 @@ .ant-dropdown-menu-title-content { a { - font-size: 12px; + font-size: var(--data-size); color: #333; } @@ -350,7 +350,7 @@ } .ant-dropdown-menu-item { - font-size: 12px; + font-size: var(--data-size); color: #333; } diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 61edc4d..7aedce1 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -48,7 +48,7 @@ const index: FunctionComponent = (props) => { const data: any = exceptStr(event.data); if (!_.isEmpty(data)) { const { - columns, dataSource, pageInfo, selectedRowKeys: rowKeys, i18n: i18nRes = {}, + columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {}, showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail, fixed = true, tableScrollHeight, sumRow, optWidth } = data; diff --git a/src/pages/custom-project/index.less b/src/pages/custom-project/index.less index 0a71435..781b0c0 100644 --- a/src/pages/custom-project/index.less +++ b/src/pages/custom-project/index.less @@ -14,7 +14,7 @@ .ant-spin-container { .ant-pagination { - font-size: 12px; + font-size: var(--data-size); align-items: center; margin-right: 8px; @@ -40,7 +40,7 @@ .ant-pagination-options { .ant-select { - font-size: 12px; + font-size: var(--data-size); .ant-select-selector { height: 28px; @@ -57,7 +57,7 @@ } .ant-select-item { - font-size: 12px; + font-size: var(--data-size); } } @@ -79,7 +79,7 @@ } th, td { - font-size: 12px; + font-size: var(--data-size); .ant-form-item { margin-bottom: 0; diff --git a/src/pages/passport/sign-in.less b/src/pages/passport/sign-in.less index 8db0736..9a45033 100644 --- a/src/pages/passport/sign-in.less +++ b/src/pages/passport/sign-in.less @@ -18,7 +18,7 @@ color: rgb(204, 204, 204); text-align: center; margin-top: 16px; - font-size: 12px; + font-size: var(--data-size); display: flex; justify-content: space-between; } diff --git a/src/pages/salaryFileTable/index.tsx b/src/pages/salaryFileTable/index.tsx index 03f179c..0c2ec5c 100644 --- a/src/pages/salaryFileTable/index.tsx +++ b/src/pages/salaryFileTable/index.tsx @@ -38,7 +38,7 @@ const Index: FunctionComponent = (props) => { const data: any = exceptStr(event.data); if (!_.isEmpty(data)) { const { - columns, dataSource, pageInfo, selectedRowKeys: rowKeys, i18n: i18nRes = {}, selectedKey, showDelSalaryFileBtn + columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {}, selectedKey, showDelSalaryFileBtn } = data; setRunStatuses(selectedKey); setI18n(i18nRes); diff --git a/src/pages/unitTable/index.less b/src/pages/unitTable/index.less index 40485fe..852cac3 100644 --- a/src/pages/unitTable/index.less +++ b/src/pages/unitTable/index.less @@ -8,7 +8,7 @@ .ant-btn-link, .ant-dropdown-trigger { padding: 0; - font-size: 12px; + font-size: var(--data-size); color: #333; } @@ -31,7 +31,7 @@ .ant-spin-container { .ant-pagination { - font-size: 12px; + font-size: var(--data-size); align-items: center; margin-right: 8px; @@ -57,7 +57,7 @@ .ant-pagination-options { .ant-select { - font-size: 12px; + font-size: var(--data-size); .ant-select-selector { height: 28px; @@ -74,7 +74,7 @@ } .ant-select-item { - font-size: 12px; + font-size: var(--data-size); } } @@ -96,7 +96,7 @@ } th, td { - font-size: 12px; + font-size: var(--data-size); .ant-form-item { margin-bottom: 0; @@ -117,7 +117,7 @@ } .ant-dropdown-menu-item { - font-size: 12px; + font-size: var(--data-size); color: #333; } } diff --git a/src/pages/unitTable/index.tsx b/src/pages/unitTable/index.tsx index 8287327..a921749 100644 --- a/src/pages/unitTable/index.tsx +++ b/src/pages/unitTable/index.tsx @@ -36,7 +36,7 @@ const UnitTable: FC = (props) => { if (!_.isEmpty(data)) { const { columns, dataSource, pageInfo, scrollHeight, i18n, showOperateBtn: permission, unitTableType = "welfareRecord", - selectedRowKeys: rowKeys, selectedKey, rowKey, showTotalCell = false, sumDataSource = {} + selectedRowKeys: rowKeys = [], selectedKey, rowKey, showTotalCell = false, sumDataSource = {} } = data; setI18n(i18n); setColumns(columns); diff --git a/src/pages/welfareArchiveTable/index.tsx b/src/pages/welfareArchiveTable/index.tsx index 550fd4b..bc64799 100644 --- a/src/pages/welfareArchiveTable/index.tsx +++ b/src/pages/welfareArchiveTable/index.tsx @@ -37,7 +37,7 @@ const Index: FunctionComponent = (props) => { const receiveMessageFromIndex = (event: any) => { const data: any = exceptStr(event.data); if (!_.isEmpty(data)) { - const { columns, dataSource, pageInfo, selectedRowKeys: rowKeys, i18n: i18nRes = {}, runStatuses } = data; + const { columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {}, runStatuses } = data; setRunStatuses(runStatuses); setI18n(i18nRes); setPageInfo(pageInfo);