张延森 3 年前
父节点
当前提交
bb433b04dd

+ 21
- 0
src/components/ScreenBox/ScreenHeader/Attchment.jsx 查看文件

@@ -0,0 +1,21 @@
1
+import React, { useMemo } from 'react';
2
+import classNames from 'classnames';
3
+import Styles from './style.less';
4
+
5
+export default (props) => {
6
+  const classList = useMemo(() => {
7
+    return classNames(
8
+      Styles.attchment,
9
+      Styles['bt-border'],
10
+      Styles['bt-pointer'],
11
+      Styles['bt-slash'],
12
+      {
13
+        [Styles['rht-pointer']]: props.direct === 'left',
14
+        [Styles['attchment-right']]: props.direct === 'right',
15
+        [Styles['rht-slash']]: props.direct === 'right',
16
+      },
17
+    );
18
+  }, [props.direct]);
19
+
20
+  return <div className={classList}>{props.title}</div>;
21
+};

+ 9
- 2
src/components/ScreenBox/ScreenHeader/index.jsx 查看文件

@@ -1,11 +1,18 @@
1
+import Attchment from './Attchment';
1 2
 import Styles from './style.less';
2 3
 
3 4
 export default () => {
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-left']}>
8
+        <Attchment direct="left" title="数据概览" />
9
+      </div>
10
+      <div className={Styles['screen-header-left']}>{/* 只负责占位 */}</div>
7 11
       <div className={Styles['screen-header-content']}></div>
8
-      <div className={Styles['screen-header-right']}></div>
12
+      <div className={Styles['screen-header-right']}>{/* 只负责占位 */}</div>
13
+      <div className={Styles['screen-header-right']}>
14
+        <Attchment direct="right" title="多云21-28°C" />
15
+      </div>
9 16
     </div>
10 17
   );
11 18
 };

+ 66
- 0
src/components/ScreenBox/ScreenHeader/style.less 查看文件

@@ -1,5 +1,7 @@
1 1
 .screen-header-box {
2 2
   display: flex;
3
+  align-items: center;
4
+  justify-content: center;
3 5
 
4 6
   .screen-header-left,
5 7
   .screen-header-right {
@@ -9,4 +11,68 @@
9 11
   .screen-header-content {
10 12
     flex: 6;
11 13
   }
14
+
15
+  .attchment {
16
+    color: #fff;
17
+    font-size: 12px;
18
+    line-height: 2em;
19
+
20
+    &.attchment-right {
21
+      text-align: right;
22
+    }
23
+  }
24
+
25
+  .bt-border {
26
+    margin-bottom: 10px;
27
+    padding-right: 1em;
28
+    padding-left: 1em;
29
+    border-bottom: 2px solid #3d81f0;
30
+  }
31
+
32
+  .bt-slash {
33
+    position: relative;
34
+    &::before {
35
+      position: absolute;
36
+      bottom: -3px;
37
+      left: 0;
38
+      z-index: 10;
39
+      width: 10px;
40
+      height: 10px;
41
+      border-bottom: 2px solid #3d81f0;
42
+      transform: rotate(60deg);
43
+      transform-origin: top center;
44
+      content: ' ';
45
+    }
46
+  }
47
+
48
+  .rht-slash {
49
+    &::before {
50
+      right: 0;
51
+      left: auto;
52
+      transform: rotate(120deg);
53
+      transform-origin: right center;
54
+    }
55
+  }
56
+
57
+  .bt-pointer {
58
+    position: relative;
59
+    &::after {
60
+      position: absolute;
61
+      bottom: -3px;
62
+      left: 0;
63
+      z-index: 10;
64
+      width: 6px;
65
+      height: 4px;
66
+      background: #fffa00;
67
+      border-radius: 50%;
68
+      content: ' ';
69
+    }
70
+  }
71
+
72
+  .rht-pointer {
73
+    &::after {
74
+      right: 0;
75
+      left: auto;
76
+    }
77
+  }
12 78
 }

+ 6
- 0
src/pages/MonitoringScreen/hook.js 查看文件

@@ -20,6 +20,7 @@ export function useFullScreen() {
20 20
 
21 21
   const onFullScreen = useCallback((e) => {
22 22
     document.documentElement.requestFullscreen();
23
+    setIsFullScreen(true);
23 24
   }, []);
24 25
 
25 26
   useResize((w, h) => {
@@ -37,6 +38,11 @@ export function useFullScreen() {
37 38
 
38 39
   useEffect(() => {
39 40
     calcStyle();
41
+
42
+    //
43
+    window.addEventListener('onFullScreenChange', (e) => {
44
+      console.log('-------onFullScreenChange----->', e);
45
+    });
40 46
   }, []);
41 47
 
42 48
   return { style, isFullScreen, onFullScreen };

+ 6
- 4
src/pages/MonitoringScreen/index.jsx 查看文件

@@ -23,25 +23,27 @@ export default (props) => {
23 23
       }
24 24
     >
25 25
       <div
26
-        className={classNames(Styles['screen-page'], { [Styles['full-screen']]: isFullScreen })}
26
+        className={classNames(Styles['screen-page'], Styles['pd-lr-40'], {
27
+          [Styles['full-screen']]: isFullScreen,
28
+        })}
27 29
         style={style}
28 30
       >
29 31
         <div className={Styles['grail-layout']}>
30 32
           <div className={Styles['grail-header']}>
31 33
             <ScreenHeader weather="多云 21-28 °C" />
32 34
           </div>
33
-          <div className={Styles['grail-container']}>
35
+          <div className={classNames(Styles['grail-container'], Styles['mg-tp-40'])}>
34 36
             <div className={Styles['grail-left']}>
35 37
               <SquareBox>asdfasdf</SquareBox>
36 38
             </div>
37
-            <div className={Styles['grail-content']}>
39
+            <div className={classNames(Styles['grail-content'], Styles['pd-lr-40'])}>
38 40
               <DateCommponets />
39 41
             </div>
40 42
             <div className={Styles['grail-right']}>
41 43
               <SquareBox>asdfasdf</SquareBox>
42 44
             </div>
43 45
           </div>
44
-          <div className={Styles['grail-footer']}></div>
46
+          <div className={classNames(Styles['grail-footer'], Styles['mg-tp-40'])}></div>
45 47
         </div>
46 48
       </div>
47 49
     </PageHeaderWrapper>

+ 7
- 6
src/pages/MonitoringScreen/style.less 查看文件

@@ -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
 }