From f91c4b0c2bd83c9078c0dd92851bd0c831090957 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Tue, 15 Feb 2022 17:27:17 +0800
Subject: [PATCH] +保按考试系统,动态提出滚动条,解决1366分辨率题目完成按钮点不到,改签到系统搜索栏和字段位置

---
 src/store/modules/control.js |   70 ++++++++++++++++++++++++++++++++++-
 1 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/src/store/modules/control.js b/src/store/modules/control.js
index 50693d6..5dc9309 100644
--- a/src/store/modules/control.js
+++ b/src/store/modules/control.js
@@ -16,14 +16,80 @@
       total: 0,
       pageSizes: [15, 30, 50, 100],
     },
-    windowWidth: 1025,
+    windowWidth: window.innerWidth,
+    windowHeight: window.innerHeight,
+    tableWindowHeight: window.innerHeight,
+    screenSize: window.screen.width,
+    screenHeight: window.screen.height,
+    updown: true,
   },
   actions: {
+    changeZoom({
+      state,
+      commit,
+      dispatch
+    }, data) {
+      if (window.innerWidth <= 1396 && window.innerHeight <= 798) {
+        // var devicewidth = document.documentElement.clientWidth; //获取当前分辨率下的可是区域宽度
+        // console.log(devicewidth)
+        let devicewidth = 1143;
+        var scale = devicewidth / 1366; // 分母——设计稿的尺寸
+        document.body.style.zoom = scale; //放大缩小相应倍数
+        // console.log("应用1366*768")
+      } else {
+        if (document.body.style.zoom != 1) {
+          document.body.style.zoom = 1;
+          // console.log("还原缩放")
+        }
+      }
+      // return;
+      //监听可视高度
+      Object.defineProperty(state, "tableWindowHeight", {
+        set: function (key, value) {
+          //   //此处拦截了设置请求
+          // window.console.log(key, value, "tableWindowHeight");
+          //获取答题区域subject_main
+          let subject_main = document.querySelector(".subject_main");
+          // console.log(subject_main)
+          //获取卡片区域
+          let exam_card_body = document.querySelector(".exam-card-body");
+          // console.log(subject_exam_title.offsetHeight);
+          //获取标题
+          let subject_exam_title = document.querySelector(".subject-exam-title");
+          // console.log(subject_exam_title);
+          if (subject_main && exam_card_body && subject_exam_title) {
+            let ecbh = exam_card_body.offsetHeight;
+            let seth = subject_exam_title.offsetHeight;
+            console.log(ecbh - seth);
+            subject_main.style.maxHeight = ecbh - seth - 60 + "px";
+          }
+        },
+      });
+      state.tableWindowHeight + 1;
+    },
   },
   mutations: {
     setWindowSize: (state, data) => {
       state.windowWidth = data.innerWidth;
-      // console.log(data)
+      state.windowHeight = data.innerHeight;
+    },
+    setScreenSize(state, data) {
+      state.screenSize = data.w <= 1366 && data.h <= 768 ? 1366 : data.w;
+      state.screenHeight = data.h;
+    },
+    setWindowSizeHeight: (state, data) => {
+      state.tableWindowHeight = data;
+    },
+    setWindowSizeHeightAdd: (state, data) => {
+      setTimeout(() => {
+        if (state.updown) {
+          state.tableWindowHeight += 1;
+          state.updown = false;
+        } else {
+          state.tableWindowHeight -= 1;
+          state.updown = true;
+        }
+      }, 0);
     },
   }
 };

--
Gitblit v1.9.3