[baozhangchao] 3 anos atrás
pai
commit
1a86f19cc1

+ 0
- 6
public/css/hyzlsJ-embed.css
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


BIN
src/assets/images/screen/header-bg.png Ver arquivo


BIN
src/assets/images/screen/header-title.png Ver arquivo


+ 13
- 4
src/components/ScreenBox/ScreenHeader/index.jsx Ver arquivo

@@ -1,11 +1,20 @@
1
+import titleImg from '@/assets/images/screen/header-title.png';
1 2
 import Styles from './style.less';
2 3
 
3
-export default () => {
4
+export default (props) => {
4 5
   return (
5 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 18
     </div>
10 19
   );
11 20
 };

+ 40
- 0
src/components/ScreenBox/ScreenHeader/style.less Ver arquivo

@@ -1,12 +1,52 @@
1 1
 .screen-header-box {
2 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 15
   .screen-header-left,
5 16
   .screen-header-right {
17
+    display: grid;
6 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 32
   .screen-header-content {
33
+    display: flex;
10 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 Ver arquivo

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

+ 9
- 25
src/pages/MonitoringScreen/DateCommponetsBottomLeft.jsx Ver arquivo

@@ -1,20 +1,9 @@
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 3
 import { Column } from '@ant-design/plots';
7 4
 // import ba from './a.png'
8 5
 
9 6
 export default (props) => {
10
-
11
-
12
-  const style = {
13
-    bgd: {
14
-      width: '25vw',
15
-      display: 'inline-block',
16
-    }
17
-  }
18 7
   const data = [
19 8
     {
20 9
       name: '预约',
@@ -41,7 +30,6 @@ export default (props) => {
41 30
       NongType: '维修',
42 31
       sum: 147,
43 32
     },
44
-
45 33
   ];
46 34
   const config = {
47 35
     data,
@@ -82,15 +70,11 @@ export default (props) => {
82 70
   };
83 71
 
84 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 78
     </div>
94
-
95
-  )
96
-}
79
+  );
80
+};

+ 10
- 25
src/pages/MonitoringScreen/DateCommponetsBottomRight.jsx Ver arquivo

@@ -1,20 +1,9 @@
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 3
 import { Pie, G2 } from '@ant-design/plots';
7 4
 // import ba from './a.png'
8 5
 
9 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 7
   const data = [
19 8
     {
20 9
       type: '收割机',
@@ -31,7 +20,7 @@ export default (props) => {
31 20
     {
32 21
       type: '其他',
33 22
       value: 70,
34
-    }
23
+    },
35 24
   ];
36 25
   const config = {
37 26
     color: ['#FB9900', '#355C9C', '#23E8AE', '#E63404'],
@@ -74,15 +63,11 @@ export default (props) => {
74 63
     ],
75 64
   };
76 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 71
     </div>
86
-
87
-  )
88
-}
72
+  );
73
+};

+ 11
- 27
src/pages/MonitoringScreen/DateCommponetsLeft.jsx Ver arquivo

@@ -1,19 +1,8 @@
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 3
 import { Bar } from '@ant-design/plots';
7 4
 
8 5
 export default (props) => {
9
-
10
-
11
-  const style = {
12
-    bgd: {
13
-      width: '25vw',
14
-      display: 'inline-block',
15
-    }
16
-  }
17 6
   const data = [
18 7
     {
19 8
       key: '收割机',
@@ -38,7 +27,6 @@ export default (props) => {
38 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 28
     legend: {
40 29
       position: 'top-left',
41
-
42 30
     },
43 31
     statistic: {
44 32
       style: {
@@ -46,20 +34,16 @@ export default (props) => {
46 34
         fontWeight: 60,
47 35
         textAlign: 'center',
48 36
         textBaseline: 'middle',
49
-      }
50
-    }
37
+      },
38
+    },
51 39
   };
52 40
 
53 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 47
     </div>
63
-
64
-  )
65
-}
48
+  );
49
+};

+ 34
- 28
src/pages/MonitoringScreen/hook.js Ver arquivo

@@ -1,43 +1,49 @@
1 1
 import React, { useCallback, useEffect, useRef, useState } from 'react';
2 2
 import useResize from '@/utils/hooks/useResize';
3 3
 
4
-export function useFullScreen() {
5
-  const [style, setStyle] = useState({});
4
+export function useFullScreen(elRef) {
6 5
   const [isFullScreen, setIsFullScreen] = useState(false);
7 6
   const fullScreenRef = useRef();
8 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 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 Ver arquivo

@@ -14,38 +14,50 @@ import SquareBox from '@/components/ScreenBox/SquareBox';
14 14
 import ScreenHeader from '@/components/ScreenBox/ScreenHeader';
15 15
 
16 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 28
   return (
20 29
     <PageHeaderWrapper
21 30
       extra={
22
-        <Button icon={<FullscreenOutlined />} onClick={onFullScreen}>
31
+        <Button icon={<FullscreenOutlined />} onClick={toggleFullScreen}>
23 32
           全屏
24 33
         </Button>
25 34
       }
26 35
     >
27 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 43
         <div className={Styles['grail-layout']}>
32 44
           <div className={Styles['grail-header']}>
33 45
             <ScreenHeader weather="多云 21-28 °C" />
34 46
           </div>
35
-          <div className={Styles['grail-container']}>
47
+          <div className={classNames(Styles['grail-container'], Styles['mg-tp-40'])}>
36 48
             <div className={Styles['grail-left']}>
37
-              <SquareBox>asdfasdf</SquareBox>
38
-            </div>
39
-            <div className={Styles['grail-content']}>
40 49
               <DateCommponetsLeft />
50
+              <div className={Styles['mg-tp-40']}>{/* 占位 */}</div>
41 51
               <DateCommponetsBottomLeft />
42
-              <DateCommponetsBottomRight />
52
+            </div>
53
+            <div className={classNames(Styles['grail-content'], Styles['pd-lr-40'])}>
54
+              <DateCommponetsLeft />
43 55
             </div>
44 56
             <div className={Styles['grail-right']}>
45
-              <SquareBox>asdfasdf</SquareBox>
57
+              <DateCommponetsBottomRight />
46 58
             </div>
47 59
           </div>
48
-          <div className={Styles['grail-footer']}></div>
60
+          <div className={classNames(Styles['grail-footer'], Styles['mg-tp-40'])}></div>
49 61
         </div>
50 62
       </div>
51 63
     </PageHeaderWrapper>

+ 7
- 6
src/pages/MonitoringScreen/style.less Ver arquivo

@@ -39,10 +39,11 @@
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 Ver arquivo

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