Administrator
2022-05-09 c7735db135f9c3c99224d8b5d2157926efde0977
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// import {getStore, setStore} from '@/util/store'
 
// import {getDictionary} from '@/api/system/dict'
 
const dict = {
  state: {
    clearOtherBut: {
      refreshBtn: false,
      columnBtn: false,
      searchShowBtn: false,
      filterBtn: false,
    },
    changePageSize: {
      pageSize: 15,
      currentPage: 1,
      total: 0,
      pageSizes: [15, 30, 50, 100],
    },
    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;
      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);
    },
  }
};
 
 
export default dict;