From b6c337de5d32812de8db8a5ff0c1e0401f1447cc Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 24 Oct 2022 16:05:32 +0800
Subject: [PATCH] 修改首页销售趋势样式;经营概况、农资出入库记录页面显示3条
---
src/views/home/index.vue | 7 ++-
src/views/manage/index.vue | 4 +-
src/App.vue | 10 +++++
src/utils/devicePixelRatio.js | 72 ++++++++++++++++++++++++++++++++++++
4 files changed, 88 insertions(+), 5 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index ccd0e94..1ecbf7a 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -4,6 +4,16 @@
</div>
</template>
+<script>
+import devicePixelRatio from '@/utils/devicePixelRatio'
+
+export default {
+ created () {
+ new devicePixelRatio().init()
+ }
+}
+</script>
+
<style lang="scss">
#app {
width: 100%;
diff --git a/src/utils/devicePixelRatio.js b/src/utils/devicePixelRatio.js
new file mode 100644
index 0000000..5706124
--- /dev/null
+++ b/src/utils/devicePixelRatio.js
@@ -0,0 +1,72 @@
+/*
+ * @Author: shuishen 1109946754@qq.com
+ * @Date: 2022-10-21 16:42:56
+ * @LastEditors: shuishen 1109946754@qq.com
+ * @LastEditTime: 2022-10-21 16:43:01
+ * @FilePath: \sd-jg-school-web\src\utils\devicePixelRatio.js
+ * @Description:
+ *
+ * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved.
+ */
+class DevicePixelRatio {
+ constructor() {
+ // this.flag = false
+ }
+
+ // 获取系统类型
+ _getSystem () {
+ const 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 () {
+ const t = this
+ // 页面devicePixelRatio(设备像素比例)变化后,计算页面body标签zoom修改其大小,来抵消devicePixelRatio带来的变化。
+ document.getElementsByTagName('body')[0].style.zoom = 1 / window.devicePixelRatio
+ }
+
+ // 监听页面缩放
+ _watch () {
+ const t = this
+ t._addHandler(window, 'resize', function () { // 注意这个方法是解决全局有两个window.resize
+ // 重新校正
+ t._correct()
+ })
+ }
+
+ // 初始化页面比例
+ init () {
+ const t = this
+ if (t._getSystem()) { // 判断设备,目前只在windows系统下校正浏览器缩放比例
+ // 初始化页面校正浏览器缩放比例
+ t._correct()
+ // 开启监听页面缩放
+ t._watch()
+ }
+ }
+}
+export default DevicePixelRatio
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index bfe662a..4e07da0 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -2767,7 +2767,7 @@
right: 0;
.t {
- height: 310px;
+ height: 284px;
.content-box {
display: flex;
@@ -2782,7 +2782,8 @@
}
.c {
- height: 214px;
+ height: 185px;
+ margin-top: 10px;
.title-box {
.text {
@@ -2856,7 +2857,7 @@
.total {
position: relative;
- margin-top: 25px;
+ margin-top: 10px;
width: 340px;
height: 96px;
background: rgba(42, 113, 149, 0.37);
diff --git a/src/views/manage/index.vue b/src/views/manage/index.vue
index add6b56..9448ac1 100644
--- a/src/views/manage/index.vue
+++ b/src/views/manage/index.vue
@@ -1569,7 +1569,7 @@
var data = []
for (var i = 0; i < res.data.data.length; i++) {
data.push(res.data.data[i])
- if (i == 3) {
+ if (i == 2) {
break
}
}
@@ -1582,7 +1582,7 @@
params.codes = "000000"
params.deptId = this.farmValue
params.current = "1"
- params.size = "999"
+ params.size = "3"
if (this.nzSelectTime) {
params.startTime = this.nzSelectTime[0]
params.endTime = this.nzSelectTime[1]
--
Gitblit v1.9.3