Yansen 2 лет назад
Родитель
Сommit
aa6b99aea0

+ 1
- 1
src/components/ScreenBox/utils.js Просмотреть файл

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 Просмотреть файл

1
 import React from 'react';
1
 import React from 'react';
2
 import { Col, Row } from 'antd';
2
 import { Col, Row } from 'antd';
3
+import { Link } from 'umi';
4
+import Styles from './style.less';
3
 
5
 
4
 export default React.forwardRef((props, ref) => {
6
 export default React.forwardRef((props, ref) => {
5
   const { data = {}, onClose } = props;
7
   const { data = {}, onClose } = props;
6
-  console.log(data);
7
 
8
 
8
   return (
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
       <div style={{ textAlign: 'right', fontSize: '24px' }} onClick={onClose}>
11
       <div style={{ textAlign: 'right', fontSize: '24px' }} onClick={onClose}>
21
         ×
12
         ×
22
       </div>
13
       </div>
23
       <Row gutter={16}>
14
       <Row gutter={16}>
24
         <Col span={8}>农机名称</Col>
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
       </Row>
21
       </Row>
27
       <Row gutter={16}>
22
       <Row gutter={16}>
28
         <Col span={8}>设备编号</Col>
23
         <Col span={8}>设备编号</Col>

+ 4
- 1
src/pages/MonitoringScreen2/components/machinery.js Просмотреть файл

1
 import React from 'react';
1
 import React from 'react';
2
 import { transform } from './map/coordinate';
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
 export default function makeMachinery(machines, markers, map, AMap, onClick) {
7
 export default function makeMachinery(machines, markers, map, AMap, onClick) {
5
   if (!map) return;
8
   if (!map) return;
6
   if (!machines || !machines.length) return;
9
   if (!machines || !machines.length) return;
23
     const marker = new AMap.Marker({
26
     const marker = new AMap.Marker({
24
       map,
27
       map,
25
       position,
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
       offset: new AMap.Pixel(-13, -30),
30
       offset: new AMap.Pixel(-13, -30),
28
     });
31
     });
29
 
32
 

+ 26
- 0
src/pages/MonitoringScreen2/components/style.less Просмотреть файл

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 Просмотреть файл

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