From 53a7cfa4bde26ad059d2af885ed7f86996498b76 Mon Sep 17 00:00:00 2001
From: zhangqun <179111901@qq.com>
Date: Thu, 29 Feb 2024 09:45:25 +0800
Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layouts/CommandPlatformLayout.js | 27 +++++++++++++++++++++++++-
src/layouts/CommandPlatformLayout.less | 6 ++++--
src/pages/CommandPlatform/One.js | 4 ++--
src/pages/CommandPlatform/One.less | 15 +++++++++-----
4 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/src/layouts/CommandPlatformLayout.js b/src/layouts/CommandPlatformLayout.js
index 50d2483..910631f 100644
--- a/src/layouts/CommandPlatformLayout.js
+++ b/src/layouts/CommandPlatformLayout.js
@@ -129,7 +129,32 @@ class CommandPlatformLayout extends React.PureComponent {
}); */
return `${currRouterData.name}`;
};
+ setRemPc = () => {
+ var docEl = document.documentElement,
+ resizeEvt = "orientationchange" in window ? "orientationchange" : "resize",
+ recalc = function () {
+ var clientWidth = docEl.clientWidth;
+ if (!clientWidth) return;
+ if (location.href.indexOf("express") > -1) {
+ docEl.style.fontSize = "";
+ } else if (clientWidth >= 7680) {
+ docEl.style.fontSize = "100px"; //1rem = 100px
+ } else {
+ docEl.style.fontSize = 100 * (clientWidth / 1920) + "px";
+ }
+ };
+ if (!document.addEventListener) return;
+ window.addEventListener(resizeEvt, recalc, false);
+ document.addEventListener("DOMContentLoaded", recalc, false);
+ // var whdef = 100 / 7680;
+ // var bodyWidth = document.body.clientWidth;
+ // var rem = bodyWidth * whdef;
+ // document.getElementsByTagName('html')[0].style.fontSize = rem + 'px';
+ }
+ componentDidMount(){
+ this.setRemPc()
+ }
render() {
const {
children,
@@ -141,7 +166,7 @@ class CommandPlatformLayout extends React.PureComponent {