张延森 3 år sedan
förälder
incheckning
06c12dd8f2

+ 3
- 0
config/config.dev.js Visa fil

@@ -1,6 +1,9 @@
1 1
 // https://umijs.org/config/
2 2
 import { defineConfig } from 'umi';
3 3
 export default defineConfig({
4
+  define: {
5
+    API_BASE: '',
6
+  },
4 7
   //
5 8
   plugins: [
6 9
     // https://github.com/zthxxx/react-dev-inspector

+ 3
- 1
config/config.js Visa fil

@@ -7,7 +7,9 @@ import routes from './routes';
7 7
 const { REACT_APP_ENV } = process.env;
8 8
 
9 9
 export default defineConfig({
10
-  // 以下是 umi 参数
10
+  define: {
11
+    API_BASE: 'http://sgl-v2.njyunzhi.com',
12
+  },
11 13
   hash: true,
12 14
   antd: {},
13 15
   dva: {

+ 1
- 1
src/components/ScreenBox/TitleBox/style.less Visa fil

@@ -14,7 +14,7 @@
14 14
     height: 10px;
15 15
     background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
16 16
     background-size: 400% 400%;
17
-    animation: gradient 5s ease infinite;
17
+    animation: gradient 2s ease infinite;
18 18
   }
19 19
   .TitleBox-ListBox-value {
20 20
     margin-left: 12px;

+ 3
- 1
src/pages/MonitoringScreen/components/MachineryStatus.jsx Visa fil

@@ -23,7 +23,9 @@ const colorList = ['#FB9900', '#23E8AE', '#E63404', '#51D4FF', '#B8B2A9', '#C579
23 23
 });
24 24
 
25 25
 const defaultOpt = {
26
-  tooltip: {},
26
+  tooltip: {
27
+    extraCssText: 'width:160px;height:40px;',
28
+  },
27 29
   grid: {
28 30
     top: 20,
29 31
     right: 10,

+ 3
- 1
src/pages/MonitoringScreen/components/MachineryType.jsx Visa fil

@@ -23,7 +23,9 @@ const colorList = ['#FB9900', '#23E8AE', '#E63404'].map((x) => {
23 23
 });
24 24
 
25 25
 const defaultOpt = {
26
-  tooltip: {},
26
+  tooltip: {
27
+    extraCssText: 'width:160px;height:40px;',
28
+  },
27 29
   legend: {},
28 30
   grid: {
29 31
     top: 20,

+ 8
- 9
src/pages/MonitoringScreen/components/WorkArea.jsx Visa fil

@@ -3,10 +3,10 @@ import BasicChart from './BasicChart';
3 3
 import deepCopy from '@/utils/deepCopy';
4 4
 
5 5
 const defaultOpt = {
6
-  tooltip: {
7
-    trigger: 'item',
8
-    formatter: '{b} : {c} ({d}%)',
9
-  },
6
+  // tooltip: {
7
+  //   trigger: 'item',
8
+  //   formatter: '{b} : {c} ({d}%)',
9
+  // },
10 10
   legend: {
11 11
     orient: 'vertical',
12 12
     left: 'right',
@@ -17,12 +17,10 @@ const defaultOpt = {
17 17
   series: [
18 18
     {
19 19
       type: 'pie',
20
-      radius: ['30%', '60%'],
20
+      radius: ['40%', '55%'],
21 21
       center: ['40%', '50%'],
22
-      roseType: 'area',
23
-      itemStyle: {
24
-        borderRadius: 5,
25
-      },
22
+      selectedMode: 'single',
23
+      avoidLabelOverlap: false,
26 24
       label: {
27 25
         color: '#fff',
28 26
         formatter: '{b} \n{d}%',
@@ -38,6 +36,7 @@ const defaultOpt = {
38 36
 export default (props) => {
39 37
   const option = useMemo(() => deepCopy(defaultOpt), []);
40 38
   option.series[0].data = props.source;
39
+  (option.series[0].data[0] || {}).selected = true; // 设置第一个是选中状态
41 40
 
42 41
   return <BasicChart title="农机作业量面积统计" option={option} />;
43 42
 };

+ 11
- 10
src/pages/MonitoringScreen/components/WorkData.jsx Visa fil

@@ -3,23 +3,24 @@ import BasicChart from './BasicChart';
3 3
 import deepCopy from '@/utils/deepCopy';
4 4
 
5 5
 const defaultOpt = {
6
-  tooltip: {
7
-    trigger: 'item',
8
-    formatter: '{b} : {c} ({d}%)',
9
-  },
6
+  // tooltip: {
7
+  //   trigger: 'item',
8
+  //   formatter: '{b} : {c} ({d}%)',
9
+  // },
10 10
   legend: {
11 11
     orient: 'vertical',
12 12
     left: 'left',
13 13
     top: '5%',
14 14
     textStyle: { color: '#fff' },
15 15
   },
16
-  toolbox: {},
17 16
   series: [
18 17
     {
19 18
       type: 'pie',
20
-      radius: ['30%', '60%'],
19
+      radius: ['45%', '65%'],
21 20
       itemStyle: {
22
-        borderRadius: 5,
21
+        borderRadius: 4,
22
+        borderColor: '#041B38',
23
+        borderWidth: 2,
23 24
       },
24 25
       // itemStyle: {
25 26
       //   borderRadius: 10,
@@ -29,13 +30,13 @@ const defaultOpt = {
29 30
       label: {
30 31
         show: false,
31 32
         position: 'center',
33
+        formatter: '{b}\n{d}%',
32 34
       },
33 35
       emphasis: {
34 36
         label: {
35
-          color: '#fff',
37
+          color: '#25E1AA',
36 38
           show: true,
37
-          fontSize: '28',
38
-          fontWeight: 'bold',
39
+          fontSize: '18',
39 40
         },
40 41
       },
41 42
       labelLine: {

+ 3
- 4
src/pages/MonitoringScreen/index.jsx Visa fil

@@ -49,13 +49,12 @@ export default (props) => {
49 49
   ]);
50 50
 
51 51
   useEffect(() => {
52
-    console.log('-------process------->', process);
53
-
54 52
     getWeather('邓州市').then((res) => {
55 53
       if (res && res.length) {
56 54
         const { casts } = res[0];
57 55
         const { dayweather, nighttemp, daytemp } = casts[0];
58
-        const [min, max] = nighttemp > daytemp ? [daytemp, nighttemp] : [nighttemp, daytemp];
56
+        const [min, max] =
57
+          parseInt(nighttemp) > parseInt(daytemp) ? [daytemp, nighttemp] : [nighttemp, daytemp];
59 58
         setWeather(`${dayweather} ${min}-${max} °C`);
60 59
       } else {
61 60
         setWeather('暂无天气信息');
@@ -94,7 +93,7 @@ export default (props) => {
94 93
           </div>
95 94
           <div className={Styles['grail-right']}>
96 95
             <div className="flex flex-column full-height">
97
-              <div className="flex-0" style={{ minHeight: '37%' }}>
96
+              <div className="flex-0" style={{ minHeight: '46%' }}>
98 97
                 <WorkData source={workData} />
99 98
               </div>
100 99
               <div className="flex-1" style={{ marginTop: '30px' }}>

+ 1
- 2
src/utils/request.js Visa fil

@@ -24,8 +24,7 @@ function requestInterceptor(url, options) {
24 24
     ? { Authorization: localStorage.getItem('token') }
25 25
     : {};
26 26
 
27
-  const prefix =
28
-    process.env.NODE_ENV === 'production' ? 'http://sgl-v2.njyunzhi.com/api/admin' : '/api/admin';
27
+  const prefix = `${process.env.API_BASE}/api/admin`;
29 28
 
30 29
   return {
31 30
     url: `${prefix}${url}`,