From ccf5a7dc7cd4dbfc9e19549d9bf437772940c76d Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Thu, 9 Dec 2021 15:52:34 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=B5=8B=E8=AF=95]=E6=B5=8B=E8=AF=95=E7=AD=89?= =?UTF-8?q?=E6=AF=94=E4=BE=8B=E7=BC=A9=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.component.ts | 59 ++++++++++++++++++- .../pages/home-page/home-page.component.ts | 3 + src/app/pages/login/login.component.html | 11 ---- src/styles.scss | 2 +- src/theme.less | 9 +++ 5 files changed, 71 insertions(+), 13 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 2edc3c9..fb3d6c2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -27,7 +27,64 @@ export class AppComponent { // this.token.startUp() // }) // } + + // let t = this; + // if(t._getSystem()) { //判断设备,目前只在windows系统下校正浏览器缩放比例 + // //初始化页面校正浏览器缩放比例 + // t._correct(); + // //开启监听页面缩放 + // t._watch(); + // } + + } + + ngAfterViewInit(): void { + + } + + + _getSystem() { + let flag = false; + var agent = navigator.userAgent.toLowerCase(); + // var isMac = /macintosh|mac os x/i.test(navigator.userAgent); + // if(isMac) { + // return false; + // } + //现只针对windows处理,其它系统暂无该情况,如有,继续在此添加 + if (agent.indexOf("windows") >= 0) { + return true; + } + } + //获取页面缩放比例 + // _getDevicePixelRatio() { + // let t = this; + // } + //监听方法兼容写法 + _addHandler(element, type, handler) { + if (element.addEventListener) { + element.addEventListener(type, handler, false); + } else if (element.attachEvent) { + element.attachEvent("on" + type, handler); + } else { + element["on" + type] = handler; + } + } + //校正浏览器缩放比例 + _correct() { + let t = this; + console.log('devicePixelRatio',window.devicePixelRatio) + //页面devicePixelRatio(设备像素比例)变化后,计算页面body标签zoom修改其大小,来抵消devicePixelRatio带来的变化。 + document.getElementsByTagName('body')[0].style['zoom'] = String(1 / window.devicePixelRatio); + sessionStorage.setItem('zoom',String(1 / window.devicePixelRatio)) + + } + //监听页面缩放 + _watch() { + let t = this; + t._addHandler(window, 'resize', function () { //注意这个方法是解决全局有两个window.resize + //重新校正 + t._correct() + }) } - } diff --git a/src/app/pages/home-page/home-page.component.ts b/src/app/pages/home-page/home-page.component.ts index d830481..d9e0b19 100644 --- a/src/app/pages/home-page/home-page.component.ts +++ b/src/app/pages/home-page/home-page.component.ts @@ -253,6 +253,9 @@ export class HomePageComponent implements OnInit { this.getUnreadNotification() this.getAggregations() + + + } //获得所有未读消息 diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html index af65716..4d6331b 100644 --- a/src/app/pages/login/login.component.html +++ b/src/app/pages/login/login.component.html @@ -37,17 +37,6 @@ -
中化石油销售有限公司 版权所有
diff --git a/src/styles.scss b/src/styles.scss index b27f4fa..877a497 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1,4 +1,4 @@ -// @import "~ng-zorro-antd/ng-zorro-antd.min.css"; +// @import "./media.scss"; @font-face { font-family: titlefont; src: url("./assets/font-family/titlefont.TTF"); diff --git a/src/theme.less b/src/theme.less index 318daa9..44dbc59 100644 --- a/src/theme.less +++ b/src/theme.less @@ -387,4 +387,13 @@ .maxHeightTreeSelect{ max-height: 280px; +} + +.cdk-overlay-pane{ + // position: fixed!important; + // top: 47px; + // right: 26px!important; + // left: none!important; + + // width: 88px; } \ No newline at end of file