Yansen před 2 roky
rodič
revize
aa6b99aea0

+ 1
- 1
src/components/ScreenBox/utils.js Zobrazit soubor

@@ -1 +1 @@
1
-export const colorArr = ['#FB9900', '#23E8AE', '#E63404', '#51D4FF', '#B8B2A9', '#C579FF'];
1
+export const colorArr = ['#FB9900', '#3D93FD', '#E63404', '#23E8AE', '#51D4FF', '#C579FF'];

+ 8
- 13
src/pages/MonitoringScreen2/components/MachineryInfo.jsx Zobrazit soubor

@@ -1,28 +1,23 @@
1 1
 import React from 'react';
2 2
 import { Col, Row } from 'antd';
3
+import { Link } from 'umi';
4
+import Styles from './style.less';
3 5
 
4 6
 export default React.forwardRef((props, ref) => {
5 7
   const { data = {}, onClose } = props;
6
-  console.log(data);
7 8
 
8 9
   return (
9
-    <div
10
-      ref={ref}
11
-      style={{
12
-        background: 'rgba(0,0,0,0.8)',
13
-        color: '#fff',
14
-        padding: '1em',
15
-        paddingTop: '0',
16
-        borderRadius: '4px',
17
-        width: '320px',
18
-      }}
19
-    >
10
+    <div ref={ref} className={Styles['info-window']}>
20 11
       <div style={{ textAlign: 'right', fontSize: '24px' }} onClick={onClose}>
21 12
         ×
22 13
       </div>
23 14
       <Row gutter={16}>
24 15
         <Col span={8}>农机名称</Col>
25
-        <Col span={16}>{data.machineryName || ''}</Col>
16
+        <Col span={16}>
17
+          <Link to={``} target="_blank">
18
+            {data.machineryName || ''}
19
+          </Link>
20
+        </Col>
26 21
       </Row>
27 22
       <Row gutter={16}>
28 23
         <Col span={8}>设备编号</Col>

+ 4
- 1
src/pages/MonitoringScreen2/components/machinery.js Zobrazit soubor

@@ -1,6 +1,9 @@
1 1
 import React from 'react';
2 2
 import { transform } from './map/coordinate';
3 3
 
4
+const iconB = '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png';
5
+const iconR = '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-red.png';
6
+
4 7
 export default function makeMachinery(machines, markers, map, AMap, onClick) {
5 8
   if (!map) return;
6 9
   if (!machines || !machines.length) return;
@@ -23,7 +26,7 @@ export default function makeMachinery(machines, markers, map, AMap, onClick) {
23 26
     const marker = new AMap.Marker({
24 27
       map,
25 28
       position,
26
-      icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
29
+      icon: item.deviceType === 'shensong' ? iconB : iconR,
27 30
       offset: new AMap.Pixel(-13, -30),
28 31
     });
29 32
 

+ 26
- 0
src/pages/MonitoringScreen2/components/style.less Zobrazit soubor

@@ -0,0 +1,26 @@
1
+@winWidth: 320px;
2
+@angWidth: 12px;
3
+
4
+.info-window {
5
+  position: relative;
6
+  width: @winWidth;
7
+  padding: 1em;
8
+  padding-top: 0;
9
+  color: #fff;
10
+  background: rgba(0, 0, 0, 0.8);
11
+  border-radius: 4px;
12
+
13
+  &::after {
14
+    position: absolute;
15
+    bottom: -@angWidth;
16
+    left: (@winWidth - @angWidth) / 2;
17
+    display: block;
18
+    width: 0;
19
+    height: 0;
20
+    margin: 0 auto;
21
+    border-top: @angWidth solid rgba(0, 0, 0, 0.8);
22
+    border-right: @angWidth / 2 solid transparent;
23
+    border-left: @angWidth / 2 solid transparent;
24
+    content: '';
25
+  }
26
+}

+ 2
- 2
src/pages/MonitoringScreen2/index.jsx Zobrazit soubor

@@ -42,7 +42,7 @@ export default (props) => {
42 42
         aMapRef.current,
43 43
         (machine, position) => {
44 44
           // 创建信息窗体
45
-          setCurMachine(machine);
45
+          setCurMachine({ ...machine });
46 46
           curPos.current = position;
47 47
         },
48 48
       );
@@ -58,7 +58,7 @@ export default (props) => {
58 58
         const infoWindow = new AMap.InfoWindow({
59 59
           isCustom: true, //使用自定义窗体
60 60
           content: infoWinRef.current,
61
-          offset: new AMap.Pixel(16, -45),
61
+          offset: new AMap.Pixel(0, -45),
62 62
         });
63 63
 
64 64
         infoWindow.on('close', () => {