Pārlūkot izejas kodu

Merge branch 'master' of http://git.ycjcjy.com/nanyang/machinery-admin

李志伟 3 gadus atpakaļ
vecāks
revīzija
f575606d42

Binārs
src/assets/images/screen/map-cars.png Parādīt failu


Binārs
src/assets/images/screen/map-rural.png Parādīt failu


Binārs
src/assets/images/screen/map-video-start.png Parādīt failu


Binārs
src/assets/images/screen/map-video-stop.png Parādīt failu


+ 4
- 0
src/components/ECharts/index.jsx Parādīt failu

@@ -39,10 +39,14 @@ echarts.use([
39 39
 
40 40
 import Styles from './style.less';
41 41
 
42
+
43
+
44
+
42 45
 export default forwardRef((props, ref) => {
43 46
   const domRef = useRef();
44 47
   const echartsRef = useRef();
45 48
 
49
+
46 50
   useEffect(() => {
47 51
     echartsRef.current = echarts.init(domRef.current);
48 52
 

+ 81
- 0
src/components/GeoMap/CarsMarker.js Parādīt failu

@@ -0,0 +1,81 @@
1
+import markerImg from '@/assets/images/screen/map-marker.png';
2
+import carsImg from '@/assets/images/screen/map-cars.png';
3
+import videoStartImg from '@/assets/images/screen/map-video-start.png';
4
+import videoStopImg from '@/assets/images/screen/map-video-stop.png';
5
+
6
+
7
+
8
+export default (AMap, map, opts = {}) => {
9
+  const marker = new AMap.Marker({
10
+    map,
11
+    icon: markerImg,
12
+    anchor: 'top-center',
13
+    offset: new AMap.Pixel(0, 0),
14
+    ...opts,
15
+  });
16
+
17
+  let show = false;
18
+
19
+  // 
20
+  const { carsName, carsRural } = opts?.extData;
21
+
22
+  marker.setLabel({
23
+    direction: 'top',
24
+    offset: new AMap.Pixel(0, 0),
25
+    content: `
26
+    <div class="SquareBox-box-carsMarker" onclick="openVideo()">
27
+    <div class="border_corner-carsMarker border_corner_left_top-left" ></div>
28
+    <div class="border_corner-carsMarker border_corner_right_top-right" ></div>
29
+    <div class="border_corner-carsMarker border_corner_left_bottom-left" ></div>
30
+    <div class="border_corner-carsMarker border_corner_right_bottom-right" ></div>
31
+    <div class="SquareBox-body-carsMarker">
32
+    <div>
33
+    <div>
34
+    </div>
35
+    <div>
36
+      <div  class="map-top-border">
37
+        <img class="map-top-cars borderBox" src="${carsImg}" alt="" />
38
+        <img class="map-top-start borderBox" src="${videoStartImg}" alt="" />
39
+        <img class="map-top-stop borderBox" src="${videoStopImg}" alt="" />
40
+      </div>
41
+
42
+
43
+      <div  class="map-button-border">
44
+      
45
+        <div class="carsName">名称:${carsName}</div>
46
+        <div class="map-button-border-carsRural carsName">
47
+        <div >归属:${carsRural}</div>
48
+        <span> \>> </span>
49
+        </div>
50
+  
51
+      </div>
52
+
53
+
54
+    </div>
55
+  </div> `,
56
+  });
57
+
58
+
59
+  // marker.on('click', () => {
60
+  //   if (show) {
61
+  //     marker.setLabel({ content: '' });
62
+  //     show = false;
63
+  //     return;
64
+  //   }
65
+
66
+
67
+  //   if (!content) {
68
+  //     marker.setLabel({ content: '' });
69
+  //   } else {
70
+  //     marker.setLabel({
71
+  //       direction: 'top',
72
+  //       offset: new AMap.Pixel(0, 0),
73
+  //       content: `<div class='geo-map-marker-label' ><div class='geo-map-marker-label-text'>${ruralName}</div></div>`,
74
+  //     });
75
+  //   }
76
+
77
+  //   show = true;
78
+  // });
79
+
80
+  return marker;
81
+};

+ 55
- 0
src/components/GeoMap/RuralMarker.js Parādīt failu

@@ -0,0 +1,55 @@
1
+import ruralMarkerImg from '@/assets/images/screen/map-rural.png';
2
+
3
+
4
+
5
+
6
+export default (AMap, map, opts = {}) => {
7
+  const marker = new AMap.Marker({
8
+    map,
9
+    icon: ruralMarkerImg,
10
+    anchor: 'top-center',
11
+    offset: new AMap.Pixel(0, 0),
12
+    ...opts,
13
+  });
14
+
15
+  let show = false;
16
+
17
+  // 合作社数据
18
+  const { ruralName, ruralAddress, ruralNumber, ruralPhone, } = opts?.extData;
19
+
20
+  marker.setLabel({
21
+    direction: 'top',
22
+    offset: new AMap.Pixel(0, 0),
23
+    content: `
24
+    <div class='geo-map-rural-box' >
25
+      <div class="borderBox"><span class='geo-map-rural-text-span borderBox'>名 称</span>:${ruralName}</div>
26
+      <div class="borderBox"><span class='geo-map-rural-text-span borderBox'>地 址</span>:${ruralAddress}</div>
27
+      <div class="borderBox">农机数量:${ruralNumber}</div>
28
+      <div class="borderBox">联系电话:${ruralPhone}</div>
29
+    </div>`,
30
+  });
31
+
32
+
33
+  // marker.on('click', () => {
34
+  //   if (show) {
35
+  //     marker.setLabel({ content: '' });
36
+  //     show = false;
37
+  //     return;
38
+  //   }
39
+
40
+
41
+  //   if (!content) {
42
+  //     marker.setLabel({ content: '' });
43
+  //   } else {
44
+  //     marker.setLabel({
45
+  //       direction: 'top',
46
+  //       offset: new AMap.Pixel(0, 0),
47
+  //       content: `<div class='geo-map-marker-label' ><div class='geo-map-marker-label-text'>${ruralName}</div></div>`,
48
+  //     });
49
+  //   }
50
+
51
+  //   show = true;
52
+  // });
53
+
54
+  return marker;
55
+};

+ 45
- 0
src/components/GeoMap/index.jsx Parādīt failu

@@ -1,16 +1,32 @@
1 1
 import React, { useEffect, useRef, useState } from 'react';
2
+import { Modal, Button } from 'antd';
2 3
 import loader from '@/components/AMap/loader';
3 4
 import getMarker from './marker';
5
+import getRuralMarker from './RuralMarker';
6
+import getCarsMarker from './CarsMarker';
7
+
4 8
 import geoPolygon from './geoPolygon';
5 9
 import Styles from './style.less';
6 10
 
7 11
 const plugins = [];
8 12
 
13
+
14
+
9 15
 export default (props) => {
16
+
17
+
10 18
   const container = useRef();
11 19
   const amapRef = useRef();
12 20
   const [map, setMap] = useState();
13 21
 
22
+  const [isModalVisible, setIsModalVisible] = useState(false)
23
+
24
+  window.openVideo = function () {
25
+    console.log(' window.foo 全局方法');
26
+    setIsModalVisible(true)
27
+
28
+  }
29
+
14 30
   useEffect(() => {
15 31
     loader(plugins).then((AMap) => {
16 32
       amapRef.current = AMap;
@@ -38,6 +54,27 @@ export default (props) => {
38 54
       position: [112.092716, 32.681642],
39 55
       extData: { value: '68辆' },
40 56
     });
57
+
58
+
59
+    // 合作社图标定位
60
+    getRuralMarker(amapRef.current, map, {
61
+      position: [111.909659, 32.651123],
62
+      extData: {
63
+        ruralName: 'ABC合作社',
64
+        ruralAddress: '南阳市邓州市林扒镇',
65
+        ruralNumber: '9辆',
66
+        ruralPhone: '13613949434',
67
+      }
68
+    })
69
+
70
+    // 农机监控
71
+    getCarsMarker(amapRef.current, map, {
72
+      position: [112.115574, 32.65235],
73
+      extData: {
74
+        carsName: '播种机0001',
75
+        carsRural: 'ABC合作社',
76
+      }
77
+    })
41 78
   }, [map]);
42 79
 
43 80
   return (
@@ -59,6 +96,14 @@ export default (props) => {
59 96
         <div />
60 97
         <div />
61 98
       </div>
99
+      <Modal title="农机监控" footer={null} visible={isModalVisible} onCancel={() => setIsModalVisible(false)}>
100
+        <video width="320" height="240" controls src='https://www.runoob.com/try/demo_source/movie.mp4'>
101
+          <source src="movie.mp4" type="video/mp4" />
102
+          <source src="movie.ogg" type="video/ogg" />
103
+          您的浏览器不支持 video 。
104
+        </video>
105
+
106
+      </Modal>
62 107
     </div>
63 108
   );
64 109
 };

+ 4
- 1
src/components/GeoMap/marker.js Parādīt failu

@@ -1,5 +1,6 @@
1 1
 import markerImg from '@/assets/images/screen/map-marker.png';
2 2
 
3
+
3 4
 export default (AMap, map, opts = {}) => {
4 5
   const marker = new AMap.Marker({
5 6
     map,
@@ -12,6 +13,7 @@ export default (AMap, map, opts = {}) => {
12 13
   let show = false;
13 14
   const content = opts?.extData?.value;
14 15
 
16
+
15 17
   marker.on('click', () => {
16 18
     if (show) {
17 19
       marker.setLabel({ content: '' });
@@ -19,13 +21,14 @@ export default (AMap, map, opts = {}) => {
19 21
       return;
20 22
     }
21 23
 
24
+
22 25
     if (!content) {
23 26
       marker.setLabel({ content: '' });
24 27
     } else {
25 28
       marker.setLabel({
26 29
         direction: 'top',
27 30
         offset: new AMap.Pixel(0, 0),
28
-        content: `<div class='geo-map-marker-label'><div class='geo-map-marker-label-text'>${content}</div></div>`,
31
+        content: `<div class='geo-map-marker-label' ><div class='geo-map-marker-label-text'>${content}</div></div>`,
29 32
       });
30 33
     }
31 34
 

+ 117
- 1
src/global.less Parādīt failu

@@ -1,5 +1,4 @@
1 1
 @import '~antd/es/style/variable.less';
2
-
3 2
 html,
4 3
 body,
5 4
 #root {
@@ -94,3 +93,120 @@ ol {
94 93
   background-clip: text;
95 94
   -webkit-text-fill-color: transparent;
96 95
 }
96
+
97
+// 合作社的样式----Start----
98
+
99
+.geo-map-rural-box {
100
+  padding: 18px;
101
+  font-weight: 800;
102
+  font-size: 12px;
103
+  background: rgba(3, 3, 3, 0.3);
104
+
105
+  border: 1px solid rgba(61, 129, 240, 0.5);
106
+  border-radius: 4px;
107
+}
108
+
109
+.borderBox {
110
+  background-image: linear-gradient(360deg, #fca790 0%, #e63404 93.84765625%);
111
+  background-clip: text;
112
+  -webkit-text-fill-color: transparent;
113
+}
114
+.geo-map-rural-text-span {
115
+  word-spacing: 19px;
116
+}
117
+// 合作社的样式----End----
118
+
119
+// 农机监控----Start----
120
+.SquareBox-box-carsMarker {
121
+  position: relative;
122
+  // height: 100%;
123
+  background: rgba(3, 3, 3, 0.3);
124
+  border: 1px solid rgba(61, 129, 240, 0.5);
125
+  border-radius: 4px;
126
+}
127
+.SquareBox-body-carsMarker {
128
+  height: 100%;
129
+  padding: 11px;
130
+  color: #fff;
131
+  // background: rgba(8, 40, 90, 0.4);
132
+  background: rgba(3, 3, 3, 0.3);
133
+
134
+  border: 2px solid rgba(61, 129, 240, 0.5);
135
+}
136
+.border_corner-carsMarker {
137
+  position: absolute;
138
+  width: 4px;
139
+  height: 4px;
140
+  background-color: #67ffff;
141
+  border-radius: 50%;
142
+}
143
+.border_corner_left_top-left {
144
+  top: 0;
145
+  left: -2px;
146
+  border-right: none;
147
+  border-bottom: none;
148
+}
149
+.border_corner_right_top-right {
150
+  top: 0;
151
+  right: -2px;
152
+  border-bottom: none;
153
+  border-left: none;
154
+}
155
+.border_corner_left_bottom-left {
156
+  bottom: 0;
157
+  left: -2px;
158
+  border-top: none;
159
+  border-right: none;
160
+}
161
+.border_corner_right_bottom-right {
162
+  right: -2px;
163
+  bottom: 0;
164
+  border-top: none;
165
+  border-left: none;
166
+}
167
+// 合作社的样式----End----
168
+
169
+// 农机监控信息----Start----
170
+
171
+//上部
172
+.map-top-border {
173
+  width: 100%;
174
+}
175
+
176
+.map-top-cars {
177
+  width: 7vw;
178
+}
179
+
180
+.map-top-start {
181
+  position: absolute;
182
+  top: 6.8vh;
183
+  left: 3.4vw;
184
+  // position: relative;
185
+  // top: 0px;
186
+  // left: 60px;
187
+}
188
+.map-top-stop {
189
+  position: absolute;
190
+  right: 1vw;
191
+  bottom: 8vh;
192
+}
193
+
194
+//底部
195
+.map-button-border {
196
+  font-weight: 800;
197
+  font-size: 12px;
198
+}
199
+.carsName {
200
+  margin-top: 15px;
201
+  background-image: linear-gradient(360deg, #fca790 0%, #e63404 93.84765625%);
202
+  background-clip: text;
203
+  -webkit-text-fill-color: transparent;
204
+}
205
+.map-button-border-carsRural {
206
+  display: flex;
207
+  justify-content: space-between;
208
+  > span {
209
+    font-weight: 800;
210
+  }
211
+}
212
+// 合作社的样式----End----