Kaynağa Gözat

feat: 中部ui

@dayan_hjm 2 yıl önce
ebeveyn
işleme
5f5acc07c9

+ 2 - 1
src/assets/css/styleTemplate.less

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm 茶百道主题样式
3 3
  * @Date: 2022-10-27 10:56:37 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-11-13 14:58:13
5
+ * @Last Modified time: 2023-11-14 17:48:54
6 6
  */
7 7
 
8 8
 @import url("../../themes/themes.less");
@@ -268,6 +268,7 @@
268 268
         color: #fff;
269 269
         margin: 0;
270 270
         font-size: 30px;
271
+
271 272
       }
272 273
     }
273 274
 

BIN
src/assets/imgs/gvc/video1.mp4


BIN
src/assets/imgs/gvc/video2.mp4


+ 111 - 0
src/pages/gvc/component/mapView2.jsx

@@ -0,0 +1,111 @@
1
+/*
2
+ * @Author: dayan_hjm 中部地图 第一段
3
+ * @Date: 2023-10-25 10:32:44 
4
+ * @Last Modified by: dayan_hjm
5
+ * controls 属性 : 值为 controls , 启用控制按钮 , 由于在不同的浏览器中表现不同 , 一般情况下 , 不显示控制按钮 ;
6
+        autoplay 属性 : 值为 autoplay , 在 Chrome 浏览器中 禁用自动播放 , 其它浏览器不禁用自动播放 ;
7
+        如果为视频设置静音播放 , 则可以在 Chrom 浏览器中 设置 autoplay 实现自动播放 ;
8
+        muted 属性 : 值为 muted , 将视频设置为静音播放 ;
9
+        如果为视频设置静音播放 , 则可以在 Chrom 浏览器中 设置 autoplay 实现自动播放 ;
10
+        width 属性 : 值为像素值 , 设置播放器宽度 ; 播放器的宽高建议只设置一个 , 避免失真 ;
11
+        height 属性 : 值为像素值 , 设置播放器高度 ; 播放器的宽高建议只设置一个 , 避免失真 ;
12
+        loop 属性 : 值为 loop , 设置播放器循环播放 ;
13
+        poster 属性 : 值为 图片 url 路径 , 设置视频位置等待加载时的图片 ;
14
+        preload 属性 :
15
+        设置 auto , 表示 预先加载视频 ;
16
+        设置 none , 表示 不预先加载视频 ;
17
+ * @Last Modified time: 2023-11-14 15:22:36
18
+ */
19
+import React, { useState, useEffect, Component } from "react";
20
+import { useHistory, useLocation, withRouter } from "react-router-dom";
21
+import mod from '../../tqcDataVHome/mod';
22
+import 'animate.css';
23
+@withRouter
24
+
25
+class MapViewTwo extends Component {
26
+  // 构造函数,组件的实例创建时,最先执行
27
+  constructor(props, context) {
28
+    super(props, context);
29
+    this.store = mod;
30
+    this.state = {
31
+      changGif: false,
32
+    };
33
+  }
34
+
35
+  componentDidMount() {
36
+    setTimeout(() => {
37
+      //替换gif
38
+      this.setState({ changGif: true });
39
+      this.videoStart();
40
+    }, 200)
41
+    // setTimeout(() => {
42
+    //   $(".video_box_hide").hide();
43
+    // }, 4000)
44
+  }
45
+  videoStart() {
46
+    /*     Chrome 浏览器的视频自动播放策略
47
+        1.始终允许静音模式下自动播放
48
+        2.在以下的情况中,带声音播放会被允许:
49
+          ①用户已经与当前的域进行了交互(也就是click,tap事件)。
50
+          ②在桌面设备上,用户的媒体参与度指数阈值已经超过,这意味着用户之前播放过有声视频。
51
+          ③用户已经将网站添加到移动设备上的主屏幕或允在桌面上安装了PWA。
52
+        3.顶部帧可以将自动播放权限委派给其iframe,来允许自动播放声音
53
+        
54
+        媒体参与度(Media Engagement)是指用户与媒体内容进行互动的程度,可以通过多个指标来衡量。这些指标主要包括观看时间、观看率、转化率、交互行为等。
55
+        可以通过:chrome://media-engagement/ 查看
56
+     */
57
+    const video = document.querySelector('.video1');
58
+    console.log(video.play());
59
+
60
+    const model = document.querySelector('.model')
61
+    const btn = document.querySelector('button')
62
+    // 第一种方法 引导用户去与页面交互实现播放
63
+    async function play() {
64
+      try {
65
+        await video.play();
66
+        //使用await的原因是因为video.play()方法返回的是一个Promise,所以在这里我们可以对他进行一些处理
67
+        // model.style.display = 'none';
68
+        btn.removeEventListener('click', play);
69
+        // 如果他自动播放了就隐藏按钮,消除点击事件
70
+      } catch (err) {
71
+        // model.style.display = 'block';
72
+        btn.addEventListener('click', play);
73
+        // 如果Promise返回的是error就引导用户点击按钮,在调用play方法
74
+      }
75
+    }
76
+    play();
77
+
78
+    //第二种方法比较主流,类似的有网页版抖音以及B站
79
+    function play() {
80
+      video.muted = true;//设置视频为静音
81
+      video.play();//调用播放方法
82
+      const ctx = new AudioContext();
83
+      const canAutoPlay = ctx.state === 'running'; //通过这个可以判断出视频能不能够自动播放 如何可以它的值就是“running” 否则为"suspended"
84
+      // 如果是不能播放我们就执行下面的逻辑,其实就是类似于第一种方法,让用户与其交互
85
+      ctx.close();
86
+      if (canAutoPlay) {
87
+        video.muted = false;
88
+        model.style.display = 'none';
89
+        btn.removeEventListener('click', play);
90
+      }
91
+      else {
92
+        model.style.display = 'block';
93
+        btn.addEventListener('click', play);
94
+      }
95
+    }
96
+    play()
97
+
98
+  }
99
+
100
+  render() {
101
+    const { changGif } = this.state;
102
+    return (
103
+      <div class="video_box video_box_hide gvc_video animate__animated animate__fadeOut animate__delay-2s animate__slower">
104
+        <div className="alls">
105
+        <video src={require("@assets/imgs/gvc/video1.mp4").default} autoplay="autoplay" class="video1"></video>
106
+        </div>
107
+      </div>
108
+    )
109
+  }
110
+}
111
+export default MapViewTwo;

+ 203 - 8
src/pages/gvc/mod.js

@@ -14,14 +14,209 @@ import { message } from 'antd';
14 14
 
15 15
 // 默认状态
16 16
 const defaultState = {
17
-  totalValue:0,
18
-  yearDecline:0,
19
-  yearSend:0,
20
-  productInventory:0,
21
-  list:[{name:'营运数据大屏'},{name:'经营大盘'},{name:'到家专题'},{name:'门店大盘'},{name:'自助跑数SQL平台'},{name:'月度包材预警跑数模板'}],
22
-  rightlist:[],
23
-  bumen:'数字化中心/数据工程部',
24
-  gw:'数据产品经理',
17
+  imgMsgData: [
18
+    {
19
+      total: 4500,
20
+      totalName: "累计运输锂辉石",
21
+      styles: { left: "0%", top: "19%" },
22
+      cumulativeProduction: "",
23
+      inventory: 0,
24
+    },
25
+    {
26
+      total: 3233,
27
+      totalName: "锂辉石库存量",
28
+      styles: { left: "11%", top: "45%" },
29
+      cumulativeProduction: "",
30
+      inventory: 0,
31
+    },
32
+    {
33
+      total: 3578,
34
+      totalName: "锂辉石库存量",
35
+      styles: { left: "32%", top: "27%" },
36
+      cumulativeProduction: "",
37
+      inventory: 0,
38
+    },
39
+    {
40
+      total: 0,
41
+      totalName: "",
42
+      styles: { left: "10%", top: "88%" },
43
+      cumulativeProduction: 1222,
44
+      inventory: 1000,
45
+      day:222,
46
+      mood:333,
47
+      year:444,
48
+      rawMaterial:[
49
+        {
50
+          prodCatgory:"原料-鲤辉石",
51
+          indexValue:22,
52
+        },
53
+        {
54
+          prodCatgory:"产品-碳酸锂",
55
+          indexValue:33,
56
+        },
57
+        {
58
+          prodCatgory:"产品-氯化锂",
59
+          indexValue:44,
60
+        },
61
+        {
62
+          prodCatgory:"产品-氢氧化锂",
63
+          indexValue:66,
64
+        },
65
+        {
66
+          prodCatgory:"产品-金属锂",
67
+          indexValue:88,
68
+        },
69
+        {
70
+          prodCatgory:"产品-98K",
71
+          indexValue:1000,
72
+        },
73
+      ]
74
+    },
75
+    {
76
+      total: 0,
77
+      totalName: "",
78
+      styles: { left: "27%", top: "73%" },
79
+      cumulativeProduction: 1222,
80
+      inventory: 1000,
81
+      day:222,
82
+      mood:333,
83
+      year:444,
84
+      rawMaterial:[
85
+        {
86
+          prodCatgory:"原料-鲤辉石",
87
+          indexValue:22,
88
+        },
89
+        {
90
+          prodCatgory:"产品-碳酸锂",
91
+          indexValue:33,
92
+        },
93
+        {
94
+          prodCatgory:"产品-氯化锂",
95
+          indexValue:44,
96
+        },
97
+        {
98
+          prodCatgory:"产品-氢氧化锂",
99
+          indexValue:66,
100
+        },
101
+        {
102
+          prodCatgory:"产品-金属锂",
103
+          indexValue:88,
104
+        },
105
+        {
106
+          prodCatgory:"产品-98K",
107
+          indexValue:1000,
108
+        },
109
+      ]
110
+    },
111
+    {
112
+      total: 0,
113
+      totalName: "",
114
+      styles: { left: "49%", top: "56%" },
115
+      cumulativeProduction: 1222,
116
+      inventory: 1000,
117
+      day:222,
118
+      mood:333,
119
+      year:444,
120
+      rawMaterial:[
121
+        {
122
+          prodCatgory:"原料-鲤辉石",
123
+          indexValue:22,
124
+        },
125
+        {
126
+          prodCatgory:"产品-碳酸锂",
127
+          indexValue:33,
128
+        },
129
+        {
130
+          prodCatgory:"产品-氯化锂",
131
+          indexValue:44,
132
+        },
133
+        {
134
+          prodCatgory:"产品-氢氧化锂",
135
+          indexValue:66,
136
+        },
137
+        {
138
+          prodCatgory:"产品-金属锂",
139
+          indexValue:88,
140
+        },
141
+        {
142
+          prodCatgory:"产品-98K",
143
+          indexValue:1000,
144
+        },
145
+      ]
146
+    },
147
+    {
148
+      total: 0,
149
+      totalName: "",
150
+      styles: { left: "66%", top: "42%" },
151
+      cumulativeProduction: 1222,
152
+      inventory: 1000,
153
+      day:222,
154
+      mood:333,
155
+      year:444,
156
+      rawMaterial:[
157
+        {
158
+          prodCatgory:"原料-鲤辉石",
159
+          indexValue:22,
160
+        },
161
+        {
162
+          prodCatgory:"产品-碳酸锂",
163
+          indexValue:33,
164
+        },
165
+        {
166
+          prodCatgory:"产品-氯化锂",
167
+          indexValue:44,
168
+        },
169
+        {
170
+          prodCatgory:"产品-氢氧化锂",
171
+          indexValue:66,
172
+        },
173
+        {
174
+          prodCatgory:"产品-金属锂",
175
+          indexValue:88,
176
+        },
177
+        {
178
+          prodCatgory:"产品-98K",
179
+          indexValue:1000,
180
+        },
181
+      ]
182
+    },
183
+    {
184
+      total: 0,
185
+      totalName: "",
186
+      styles: { left: "83%", top: "28%" },
187
+      cumulativeProduction: 1222,
188
+      inventory: 1000,
189
+      day:222,
190
+      mood:333,
191
+      year:444,
192
+      rawMaterial:[
193
+        {
194
+          prodCatgory:"原料-鲤辉石",
195
+          indexValue:22,
196
+        },
197
+        {
198
+          prodCatgory:"产品-碳酸锂",
199
+          indexValue:33,
200
+        },
201
+        {
202
+          prodCatgory:"产品-氯化锂",
203
+          indexValue:44,
204
+        },
205
+        {
206
+          prodCatgory:"产品-氢氧化锂",
207
+          indexValue:66,
208
+        },
209
+        {
210
+          prodCatgory:"产品-金属锂",
211
+          indexValue:88,
212
+        },
213
+        {
214
+          prodCatgory:"产品-98K",
215
+          indexValue:1000,
216
+        },
217
+      ]
218
+    },
219
+  ],
25 220
 }
26 221
 
27 222
 // 严格模式

+ 115 - 1
src/pages/gvc/style.less

@@ -3,13 +3,127 @@
3 3
 @assetUrl: "../../assets/imgs/home";
4 4
 
5 5
 .home_box {
6
-  background: url(../../assets/imgs/gvc/homeBgDataV.png) no-repeat 0 -10em / 100% 120% #041b40;
6
+  // background: url(../../assets/imgs/gvc/homeBgDataV.png) no-repeat 0 -10em / 100% 120% #041b40;
7
+  background: #000;
7 8
 
8 9
   :global {
9 10
     .all_box {
10 11
       width: 100%;
11 12
       height: 100%;
12 13
 
14
+      .gvc_video {
15
+        align-items: flex-start;
16
+        background: #000;
17
+
18
+        video {
19
+          width: 100%;
20
+          height: unset;
21
+          padding: 0;
22
+        }
23
+
24
+        .alls {
25
+
26
+          width: 64%;
27
+          height: unset;
28
+          padding: 2% 0 0 0;
29
+          position: relative;
30
+        }
31
+
32
+        .imgMsg {
33
+          width: 100%;
34
+          position: absolute;
35
+          left: 0;
36
+          top: 0;
37
+          height: 100%;
38
+          color: #fff;
39
+
40
+          li {
41
+            position: absolute;
42
+            width: 14em;
43
+            height: 4em;
44
+            opacity: 1;
45
+            background: linear-gradient(0deg, #42ca9840 0%, #42ca9800 98%);
46
+            ;
47
+            border-radius: 0.5em;
48
+            padding: 0.5em;
49
+            box-sizing: border-box;
50
+            font-size: 0.9em;
51
+            color: #CDF1FF;
52
+
53
+            .nums {
54
+              font-size: 1.3em;
55
+              color: #69FFDE;
56
+              display: inline-block !important;
57
+            }
58
+
59
+            .topMsg_number_2 {
60
+              display: inline-block !important;
61
+            }
62
+
63
+            .sma {
64
+              font-size: 0.7em;
65
+              color: #CDF1FF;
66
+              display: inline-block;
67
+              margin-left: 0.2em;
68
+            }
69
+
70
+            .chanL {
71
+              background: unset;
72
+              font-size: 0.9em;
73
+              color: #CDF1FF;
74
+              height: 4em;
75
+              box-sizing: border-box;
76
+              padding: 0 0.5em;
77
+              display: flex;
78
+              justify-content: space-between;
79
+              >div {
80
+                width: 50%;
81
+              }
82
+            }
83
+            .hoverR{
84
+              width: 100%;
85
+              height: 12em;
86
+              position: absolute;
87
+              left: 0;
88
+              top: -7em;
89
+              padding-top: 11em;
90
+              &:hover {
91
+                background-color: red;
92
+              }
93
+              .hoverDiv{
94
+                // display: none;
95
+              }
96
+            }
97
+            .hoverR:hover{
98
+              background-color: red;
99
+              .hoverDiv{
100
+                display: flex;
101
+              }
102
+            }
103
+
104
+            .hoverDiv {
105
+              display: flex;
106
+              align-items: center;
107
+              justify-content: space-between;
108
+              padding: 0 1em;
109
+              background: linear-gradient(0deg, #ffffff00 20%, #ffffff29 100%);
110
+              width:100%;
111
+              border-radius: 0.5em;
112
+              box-sizing: border-box;
113
+              margin-top: 0.1em;
114
+              font-size: 0.8em;
115
+              padding: 0.7em 1em 0;
116
+              color: #d7d7d7;
117
+              align-items: flex-start;
118
+
119
+              >div>span {
120
+                display: block;
121
+              }
122
+            }
123
+          }
124
+        }
125
+      }
126
+
13 127
       .gvcHome {
14 128
         height: 100%;
15 129
 

+ 78 - 14
src/pages/gvc/view.jsx

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm  产供销价值链
3 3
  * @Date: 2023-11-10 10:19:34 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-11-10 16:43:06
5
+ * @Last Modified time: 2023-11-14 17:32:45
6 6
  */
7 7
 
8 8
 import React, { useState, useEffect, Component } from "react";
@@ -19,8 +19,10 @@ import {
19 19
   checkToken,
20 20
   updateTimeService
21 21
 } from "./api";
22
+import MapViewTwo from "./component/mapView2.jsx";
22 23
 
23 24
 import 'animate.css';
25
+import { get } from "lodash";
24 26
 @withRouter
25 27
 
26 28
 class Gvc extends Component {
@@ -82,18 +84,19 @@ class Gvc extends Component {
82 84
     }
83 85
   }
84 86
   componentDidMount() {
85
-    this.fontMsgChange();
86
-    this.getUrl();
87
-    this.getUrl2()
88
-    this.getUrl3();
87
+    // this.fontMsgChange();
88
+    // this.getUrl();
89
+    // this.getUrl2()
90
+    // this.getUrl3();
89 91
     setTimeout(() => {
92
+
90 93
       this.videoStart();
91 94
     }, 200)
92 95
     setTimeout(() => {
93 96
       //替换gif
94 97
       this.setState({ changGif: true });
95
-
96
-    }, 2000)
98
+      $(".shu1").numScroll();
99
+    }, 3000)
97 100
   }
98 101
   videoStart() {
99 102
     /*     Chrome 浏览器的视频自动播放策略
@@ -187,9 +190,6 @@ class Gvc extends Component {
187 190
           }
188 191
         });
189 192
         this.store.saveState({ totalValue, yearDecline, yearSend, productInventory });
190
-        setTimeout(() => {
191
-          $(".shu1").numScroll();
192
-        }, 2500)
193 193
       }
194 194
     });
195 195
   }
@@ -261,13 +261,77 @@ class Gvc extends Component {
261 261
 
262 262
   render() {
263 263
     const stores = this.store.state;
264
-    let { totalValue, yearDecline, yearSend, productInventory } = this.store.state;
265
-    let { LeftHtml, } = this.state;
264
+    let { totalValue, yearDecline, yearSend, imgMsgData } = this.store.state;
265
+    let { LeftHtml } = this.state;
266 266
     return (
267 267
       <div className={[styles.home_box + ' home_box']}>
268 268
         <div className={"all_box"}>
269
-          <div className={"video_box"}>
270
-            <video src={require("@assets/imgs/dataVImg/homeVideo2.mp4").default} autoplay="autoplay" loop="loop" class="video2 center_box2 animate__animated animate__fadeIn animate__delay-2s"></video>
269
+          {/* 视频播放器 */}
270
+          <MapViewTwo></MapViewTwo>
271
+          <div className={"video_box gvc_video"}>
272
+            <div className="alls">
273
+              <video src={require("@assets/imgs/gvc/video2.mp4").default} autoplay="autoplay" loop="loop" class="video2 center_box2 animate__animated animate__fadeIn animate__delay-2s">
274
+              </video>
275
+              <ul className="imgMsg">
276
+                {
277
+                  toJS(imgMsgData).map((item, index) => {
278
+                    return (
279
+                      <li style={{ ...item.styles }}>
280
+                        {/* 矿产 */}
281
+                        {
282
+                          item.totalName && <p className="name">{item.totalName}</p>
283
+                        }
284
+                        {
285
+                          item.totalName && <span class="shu1 nums">{item.total}</span>
286
+                        }
287
+                        {
288
+                          item.totalName && <span className="sma">吨</span>
289
+                        }
290
+                        {/* 基地 */}
291
+                        {
292
+                          item.cumulativeProduction && <div className="hoverR">
293
+                            <div className="hoverDiv chanL">
294
+                              <div style={{ width: "38%" }}>
295
+                                <p className="title">
296
+                                  产量/吨
297
+                                </p>
298
+                                <span>日:{item.day}</span>
299
+                                <span>月:{item.mood}</span>
300
+                                <span>年:{item.year}</span>
301
+                              </div>
302
+                              <div style={{ width: "62%" }}>
303
+                                <p className="title">
304
+                                  库存/吨
305
+                                </p>
306
+                                {
307
+                                  get(item, "rawMaterial", []).map((ra, rai) => {
308
+                                    return <span>{ra.prodCatgory}:{ra.indexValue}</span>
309
+                                  })
310
+                                }
311
+                              </div>
312
+                            </div>
313
+                          </div>
314
+                        }
315
+                        {
316
+                          item.cumulativeProduction && <div className="chanL text">
317
+                            <div>
318
+                              <p>累计产量</p>
319
+                              <span class="nums shu1">{item.cumulativeProduction}</span><span class="topMsg_number_2" style={{ fontSize: "0.75em", color: "#fff" }}>吨</span>
320
+                            </div>
321
+                            <div>
322
+                              <p>产品库存</p>
323
+                              <span class="nums shu1">{item.inventory}</span><span class="topMsg_number_2" style={{ fontSize: "0.75em", color: "#fff" }}>吨</span>
324
+                            </div>
325
+
326
+                          </div>
327
+                        }
328
+                      </li>
329
+                    )
330
+                  })
331
+                }
332
+              </ul>
333
+            </div>
334
+
271 335
           </div>
272 336
           <div className={"gvcHome home cbHome"}>
273 337
             <div className="leftContent">