[baozhangchao] 3 years ago
parent
commit
1a86f19cc1

+ 0
- 6
public/css/hyzlsJ-embed.css
File diff suppressed because it is too large
View File


BIN
src/assets/images/screen/header-bg.png View File


BIN
src/assets/images/screen/header-title.png View File


+ 13
- 4
src/components/ScreenBox/ScreenHeader/index.jsx View File

1
+import titleImg from '@/assets/images/screen/header-title.png';
1
 import Styles from './style.less';
2
 import Styles from './style.less';
2
 
3
 
3
-export default () => {
4
+export default (props) => {
4
   return (
5
   return (
5
     <div className={Styles['screen-header-box']}>
6
     <div className={Styles['screen-header-box']}>
6
-      <div className={Styles['screen-header-left']}></div>
7
-      <div className={Styles['screen-header-content']}></div>
8
-      <div className={Styles['screen-header-right']}></div>
7
+      <div className={Styles['screen-header-left']}>
8
+        <div>数据概览</div>
9
+      </div>
10
+      <div className={Styles['screen-header-left']}>{/* 只负责占位 */}</div>
11
+      <div className={Styles['screen-header-content']}>
12
+        <img src={titleImg} alt="" />
13
+      </div>
14
+      <div className={Styles['screen-header-right']}>{/* 只负责占位 */}</div>
15
+      <div className={Styles['screen-header-right']}>
16
+        <div>{props.weather}</div>
17
+      </div>
9
     </div>
18
     </div>
10
   );
19
   );
11
 };
20
 };

+ 40
- 0
src/components/ScreenBox/ScreenHeader/style.less View File

1
 .screen-header-box {
1
 .screen-header-box {
2
   display: flex;
2
   display: flex;
3
+  align-items: stretch;
4
+  height: 5%;
5
+  min-height: 60px;
6
+
7
+  padding-right: 1.5em;
8
+  padding-left: 1.5em;
9
+  color: #fff;
10
+  font-size: 12px;
11
+  background-image: url('~@/assets/images/screen/header-bg.png');
12
+  background-repeat: no-repeat;
13
+  background-size: 100% 100%;
3
 
14
 
4
   .screen-header-left,
15
   .screen-header-left,
5
   .screen-header-right {
16
   .screen-header-right {
17
+    display: grid;
6
     flex: 1;
18
     flex: 1;
19
+    letter-spacing: 2px;
20
+    text-align: left;
21
+    place-items: center;
22
+
23
+    & > div {
24
+      width: 100%;
25
+    }
26
+  }
27
+
28
+  .screen-header-right {
29
+    text-align: right;
7
   }
30
   }
8
 
31
 
9
   .screen-header-content {
32
   .screen-header-content {
33
+    display: flex;
10
     flex: 6;
34
     flex: 6;
35
+    align-items: center;
36
+    justify-content: center;
37
+
38
+    & > img {
39
+      height: 50%;
40
+    }
41
+  }
42
+
43
+  .attchment {
44
+    color: #fff;
45
+    font-size: 12px;
46
+    line-height: 2em;
47
+
48
+    &.attchment-right {
49
+      text-align: right;
50
+    }
11
   }
51
   }
12
 }
52
 }

+ 1
- 1
src/components/ScreenBox/TitleBox/style.less View File

2
   // width: 163px;
2
   // width: 163px;
3
   display: inline-block;
3
   display: inline-block;
4
   align-items: center;
4
   align-items: center;
5
+  margin-bottom: 10px;
5
   padding: 11px 11px 9px 11px;
6
   padding: 11px 11px 9px 11px;
6
   border-radius: 4px;
7
   border-radius: 4px;
7
-
8
   box-shadow: 0px 0px 10px 0px #3d81f0 inset;
8
   box-shadow: 0px 0px 10px 0px #3d81f0 inset;
9
 
9
 
10
   .TitleBox-ListBox {
10
   .TitleBox-ListBox {

+ 9
- 25
src/pages/MonitoringScreen/DateCommponetsBottomLeft.jsx View File

1
-
2
-
3
-
4
-import SquareBox from '@/components/ScreenBox/SquareBox'
5
-import TitleBox from '@/components/ScreenBox/TitleBox'
1
+import SquareBox from '@/components/ScreenBox/SquareBox';
2
+import TitleBox from '@/components/ScreenBox/TitleBox';
6
 import { Column } from '@ant-design/plots';
3
 import { Column } from '@ant-design/plots';
7
 // import ba from './a.png'
4
 // import ba from './a.png'
8
 
5
 
9
 export default (props) => {
6
 export default (props) => {
10
-
11
-
12
-  const style = {
13
-    bgd: {
14
-      width: '25vw',
15
-      display: 'inline-block',
16
-    }
17
-  }
18
   const data = [
7
   const data = [
19
     {
8
     {
20
       name: '预约',
9
       name: '预约',
41
       NongType: '维修',
30
       NongType: '维修',
42
       sum: 147,
31
       sum: 147,
43
     },
32
     },
44
-
45
   ];
33
   ];
46
   const config = {
34
   const config = {
47
     data,
35
     data,
82
   };
70
   };
83
 
71
 
84
   return (
72
   return (
85
-    <div style={{ width: '100vw' }}>
86
-      <div style={style.bgd} >
87
-        <TitleBox value='农机状态统计' />
88
-        <SquareBox>
89
-          <Column  {...config} />
90
-        </SquareBox>
91
-      </div>
92
-
73
+    <div>
74
+      <TitleBox value="农机状态统计" />
75
+      <SquareBox>
76
+        <Column {...config} />
77
+      </SquareBox>
93
     </div>
78
     </div>
94
-
95
-  )
96
-}
79
+  );
80
+};

+ 10
- 25
src/pages/MonitoringScreen/DateCommponetsBottomRight.jsx View File

1
-
2
-
3
-
4
-import SquareBox from '@/components/ScreenBox/SquareBox'
5
-import TitleBox from '@/components/ScreenBox/TitleBox'
1
+import SquareBox from '@/components/ScreenBox/SquareBox';
2
+import TitleBox from '@/components/ScreenBox/TitleBox';
6
 import { Pie, G2 } from '@ant-design/plots';
3
 import { Pie, G2 } from '@ant-design/plots';
7
 // import ba from './a.png'
4
 // import ba from './a.png'
8
 
5
 
9
 export default (props) => {
6
 export default (props) => {
10
-
11
-  const G = G2.getEngine('canvas');
12
-  const style = {
13
-    bgd: {
14
-      width: '30vw',
15
-      display: 'inline-block',
16
-    }
17
-  }
18
   const data = [
7
   const data = [
19
     {
8
     {
20
       type: '收割机',
9
       type: '收割机',
31
     {
20
     {
32
       type: '其他',
21
       type: '其他',
33
       value: 70,
22
       value: 70,
34
-    }
23
+    },
35
   ];
24
   ];
36
   const config = {
25
   const config = {
37
     color: ['#FB9900', '#355C9C', '#23E8AE', '#E63404'],
26
     color: ['#FB9900', '#355C9C', '#23E8AE', '#E63404'],
74
     ],
63
     ],
75
   };
64
   };
76
   return (
65
   return (
77
-    <div style={{ width: '100vw' }}>
78
-      <div style={style.bgd} >
79
-        <TitleBox value='农机类型统计' />
80
-        <SquareBox>
81
-          <Pie  {...config} />
82
-        </SquareBox>
83
-      </div>
84
-
66
+    <div>
67
+      <TitleBox value="农机类型统计" />
68
+      <SquareBox>
69
+        <Pie {...config} />
70
+      </SquareBox>
85
     </div>
71
     </div>
86
-
87
-  )
88
-}
72
+  );
73
+};

+ 11
- 27
src/pages/MonitoringScreen/DateCommponetsLeft.jsx View File

1
-
2
-
3
-
4
-import SquareBox from '@/components/ScreenBox/SquareBox'
5
-import TitleBox from '@/components/ScreenBox/TitleBox'
1
+import SquareBox from '@/components/ScreenBox/SquareBox';
2
+import TitleBox from '@/components/ScreenBox/TitleBox';
6
 import { Bar } from '@ant-design/plots';
3
 import { Bar } from '@ant-design/plots';
7
 
4
 
8
 export default (props) => {
5
 export default (props) => {
9
-
10
-
11
-  const style = {
12
-    bgd: {
13
-      width: '25vw',
14
-      display: 'inline-block',
15
-    }
16
-  }
17
   const data = [
6
   const data = [
18
     {
7
     {
19
       key: '收割机',
8
       key: '收割机',
38
     color: ['l(0) 0:rgba(225,225,225,0.0) 1:#FB9900', 'l(0) 0:rgba(225,225,225,0.0) 1:#23E8AE', 'l(0) 0:rgba(225,225,225,0.0) 1:#E63404'],
27
     color: ['l(0) 0:rgba(225,225,225,0.0) 1:#FB9900', 'l(0) 0:rgba(225,225,225,0.0) 1:#23E8AE', 'l(0) 0:rgba(225,225,225,0.0) 1:#E63404'],
39
     legend: {
28
     legend: {
40
       position: 'top-left',
29
       position: 'top-left',
41
-
42
     },
30
     },
43
     statistic: {
31
     statistic: {
44
       style: {
32
       style: {
46
         fontWeight: 60,
34
         fontWeight: 60,
47
         textAlign: 'center',
35
         textAlign: 'center',
48
         textBaseline: 'middle',
36
         textBaseline: 'middle',
49
-      }
50
-    }
37
+      },
38
+    },
51
   };
39
   };
52
 
40
 
53
   return (
41
   return (
54
-    <div style={{ width: '100vw' }}>
55
-      <div style={style.bgd} >
56
-        <TitleBox value='农机类型统计' />
57
-        <SquareBox>
58
-          <Bar  {...config} />
59
-        </SquareBox>
60
-      </div>
61
-
42
+    <div>
43
+      <TitleBox value="农机类型统计" />
44
+      <SquareBox>
45
+        <Bar {...config} />
46
+      </SquareBox>
62
     </div>
47
     </div>
63
-
64
-  )
65
-}
48
+  );
49
+};

+ 34
- 28
src/pages/MonitoringScreen/hook.js View File

1
 import React, { useCallback, useEffect, useRef, useState } from 'react';
1
 import React, { useCallback, useEffect, useRef, useState } from 'react';
2
 import useResize from '@/utils/hooks/useResize';
2
 import useResize from '@/utils/hooks/useResize';
3
 
3
 
4
-export function useFullScreen() {
5
-  const [style, setStyle] = useState({});
4
+export function useFullScreen(elRef) {
6
   const [isFullScreen, setIsFullScreen] = useState(false);
5
   const [isFullScreen, setIsFullScreen] = useState(false);
7
   const fullScreenRef = useRef();
6
   const fullScreenRef = useRef();
8
   fullScreenRef.current = isFullScreen;
7
   fullScreenRef.current = isFullScreen;
9
 
8
 
10
-  const calcStyle = useCallback(() => {
11
-    const container = document.querySelector('main.ant-layout-content');
12
-    const header = container.querySelector('.ant-pro-page-container-warp');
13
-    const height = container.offsetHeight - header.offsetHeight;
14
-
15
-    setStyle({
16
-      width: '100%',
17
-      height: `${height}px`,
18
-    });
19
-  }, []);
20
-
21
-  const onFullScreen = useCallback((e) => {
22
-    document.documentElement.requestFullscreen();
23
-  }, []);
24
-
25
-  useResize((w, h) => {
26
-    if (fullScreenRef.current) {
27
-      calcStyle();
28
-    } else {
29
-      setStyle({
30
-        width: `${w}px`,
31
-        height: `${h}px`,
9
+  const toggleFullScreen = useCallback((e) => {
10
+    if (!document.fullscreenElement) {
11
+      elRef.current.requestFullscreen().then(() => {
12
+        setIsFullScreen(true);
32
       });
13
       });
33
     }
14
     }
15
+  }, []);
16
+
17
+  // useResize((w, h) => {
18
+  //   if (fullScreenRef.current) {
19
+  //     calcStyle();
20
+  //   } else {
21
+  //     setStyle({
22
+  //       width: `${w}px`,
23
+  //       height: `${h}px`,
24
+  //     });
25
+  //   }
34
 
26
 
35
-    setIsFullScreen(!fullScreenRef.current);
36
-  });
27
+  //   setIsFullScreen(!fullScreenRef.current);
28
+  // });
37
 
29
 
38
   useEffect(() => {
30
   useEffect(() => {
39
-    calcStyle();
31
+    console.log('-----fullscreenchange------>', elRef.current);
32
+    const handleFullScreenChange = (e) => {
33
+      console.log(
34
+        '-----handleFullScreenChange------>',
35
+        document.fullscreenElement,
36
+        fullScreenRef.current,
37
+      );
38
+      setIsFullScreen(document.fullscreenElement === fullScreenRef.current);
39
+    };
40
+
41
+    elRef.current.onfullscreenchange = handleFullScreenChange;
42
+
43
+    // elRef.current.addEventListener('fullscreenchange', handleFullScreenChange);
44
+
45
+    return elRef.current.removeEventListener('fullscreenchange', handleFullScreenChange);
40
   }, []);
46
   }, []);
41
 
47
 
42
-  return { style, isFullScreen, onFullScreen };
48
+  return { isFullScreen, toggleFullScreen };
43
 }
49
 }

+ 23
- 11
src/pages/MonitoringScreen/index.jsx View File

14
 import ScreenHeader from '@/components/ScreenBox/ScreenHeader';
14
 import ScreenHeader from '@/components/ScreenBox/ScreenHeader';
15
 
15
 
16
 export default (props) => {
16
 export default (props) => {
17
-  const { style, isFullScreen, onFullScreen } = useFullScreen();
17
+  const screenRef = useRef();
18
+  const [height, setHeight] = useState('auto');
19
+  const { isFullScreen, toggleFullScreen } = useFullScreen(screenRef);
20
+
21
+  useEffect(() => {
22
+    const container = document.querySelector('main.ant-layout-content');
23
+    const header = container.querySelector('.ant-pro-page-container-warp');
24
+
25
+    setHeight(`${container.offsetHeight - header.offsetHeight}px`);
26
+  }, []);
18
 
27
 
19
   return (
28
   return (
20
     <PageHeaderWrapper
29
     <PageHeaderWrapper
21
       extra={
30
       extra={
22
-        <Button icon={<FullscreenOutlined />} onClick={onFullScreen}>
31
+        <Button icon={<FullscreenOutlined />} onClick={toggleFullScreen}>
23
           全屏
32
           全屏
24
         </Button>
33
         </Button>
25
       }
34
       }
26
     >
35
     >
27
       <div
36
       <div
28
-        className={classNames(Styles['screen-page'], { [Styles['full-screen']]: isFullScreen })}
29
-        style={style}
37
+        className={classNames(Styles['screen-page'], Styles['pd-lr-40'], {
38
+          [Styles['full-screen']]: isFullScreen,
39
+        })}
40
+        style={{ height }}
41
+        ref={screenRef}
30
       >
42
       >
31
         <div className={Styles['grail-layout']}>
43
         <div className={Styles['grail-layout']}>
32
           <div className={Styles['grail-header']}>
44
           <div className={Styles['grail-header']}>
33
             <ScreenHeader weather="多云 21-28 °C" />
45
             <ScreenHeader weather="多云 21-28 °C" />
34
           </div>
46
           </div>
35
-          <div className={Styles['grail-container']}>
47
+          <div className={classNames(Styles['grail-container'], Styles['mg-tp-40'])}>
36
             <div className={Styles['grail-left']}>
48
             <div className={Styles['grail-left']}>
37
-              <SquareBox>asdfasdf</SquareBox>
38
-            </div>
39
-            <div className={Styles['grail-content']}>
40
               <DateCommponetsLeft />
49
               <DateCommponetsLeft />
50
+              <div className={Styles['mg-tp-40']}>{/* 占位 */}</div>
41
               <DateCommponetsBottomLeft />
51
               <DateCommponetsBottomLeft />
42
-              <DateCommponetsBottomRight />
52
+            </div>
53
+            <div className={classNames(Styles['grail-content'], Styles['pd-lr-40'])}>
54
+              <DateCommponetsLeft />
43
             </div>
55
             </div>
44
             <div className={Styles['grail-right']}>
56
             <div className={Styles['grail-right']}>
45
-              <SquareBox>asdfasdf</SquareBox>
57
+              <DateCommponetsBottomRight />
46
             </div>
58
             </div>
47
           </div>
59
           </div>
48
-          <div className={Styles['grail-footer']}></div>
60
+          <div className={classNames(Styles['grail-footer'], Styles['mg-tp-40'])}></div>
49
         </div>
61
         </div>
50
       </div>
62
       </div>
51
     </PageHeaderWrapper>
63
     </PageHeaderWrapper>

+ 7
- 6
src/pages/MonitoringScreen/style.less View File

39
   }
39
   }
40
 }
40
 }
41
 
41
 
42
-.demo {
43
-  font-size: 3em;
44
-  font-family: 'hyzlsJ';
45
-  background-image: linear-gradient(#3bd6e8, #0c49c6);
46
-  background-clip: text;
47
-  -webkit-text-fill-color: transparent;
42
+.pd-lr-40 {
43
+  padding-right: 40px;
44
+  padding-left: 40px;
45
+}
46
+
47
+.mg-tp-40 {
48
+  margin-top: 40px;
48
 }
49
 }

+ 0
- 1
src/pages/document.ejs View File

23
       content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
23
       content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
24
     />
24
     />
25
     <title>Ant Design Pro</title>
25
     <title>Ant Design Pro</title>
26
-    <link rel="stylesheet" href="./css/hyzlsJ-embed.css" />
27
     <link rel="icon" href="<%= context.config.publicPath +'favicon.ico'%>" type="image/x-icon" />
26
     <link rel="icon" href="<%= context.config.publicPath +'favicon.ico'%>" type="image/x-icon" />
28
   </head>
27
   </head>
29
   <body>
28
   <body>