Forráskód Böngészése

feat : 库存金额自动轮播

@dayan_hjm 2 év óta
szülő
commit
3dcbedb370

+ 30 - 2
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-10-30 11:14:06
5
+ * @Last Modified time: 2023-10-30 16:42:23
6 6
  */
7 7
 
8 8
 @import url("../../themes/themes.less");
@@ -1109,7 +1109,35 @@
1109 1109
       text-align: right;
1110 1110
     }
1111 1111
   }
1112
-
1112
+  .testDiv{
1113
+    width: 4em;
1114
+    display: flex;
1115
+    align-items: center;
1116
+    justify-self: center;
1117
+    flex-wrap: wrap;
1118
+    margin-left: -2.5em;
1119
+    margin-top: -2em;
1120
+    .p3{
1121
+      font-size: 0.2em;
1122
+    margin-left: 0.2em;
1123
+    display: inline-block;
1124
+    }
1125
+    .p2{
1126
+      font-size: 0.5em;
1127
+      text-align: center;
1128
+      width: 100%;
1129
+      color:#CDF1FF
1130
+    }
1131
+    .p1{
1132
+      text-align: center;
1133
+    width: 100%;
1134
+    display: flex;
1135
+    align-items: baseline;
1136
+    justify-content: center;
1137
+    font-size: 1.6em;
1138
+  
1139
+    }
1140
+  }
1113 1141
   .leftContent .bottomContent {
1114 1142
     height: 100% !important;
1115 1143
 

+ 181 - 106
src/pages/tqcDataVHome/component/leftMenoyView.jsx

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm 库存金额
3 3
  * @Date: 2023-10-23 09:32:12 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-10-30 15:03:36
5
+ * @Last Modified time: 2023-10-30 17:01:39
6 6
  */
7 7
 
8 8
 
@@ -236,139 +236,214 @@ class LeftMenoyView extends Component {
236 236
     setTimeout(() => {
237 237
       // 基于准备好的dom,初始化echarts实例
238 238
       var myChart = echarts.init(document.getElementById('echarts6'));
239
+      const colorList = ['#ffd813', '#08daaa', '#6571fc'];
240
+      let index = 0;
241
+      function fun() {
242
+        var timer = setInterval(function () {
243
+          myChart.dispatchAction({
244
+            type: 'hideTip',
245
+            seriesIndex: 0,
246
+            dataIndex: index,
247
+          });
248
+          // 显示提示框
249
+          myChart.dispatchAction({
250
+            type: 'showTip',
251
+            seriesIndex: 0,
252
+            dataIndex: index,
253
+          });
254
+          // 取消高亮指定的数据图形
255
+          myChart.dispatchAction({
256
+            type: 'downplay',
257
+            seriesIndex: 0,
258
+            dataIndex: index == 0 ? 5 : index - 1,
259
+          });
260
+          myChart.dispatchAction({
261
+            type: 'highlight',
262
+            seriesIndex: 0,
263
+            dataIndex: index,
264
+          });
265
+          index++;
266
+          if (index > 5) {
267
+            index = 0;
268
+          }
269
+        }, 1500);
270
+      }
271
+      fun();
272
+      setTimeout(function () {
273
+        fun();
274
+      }, 5000);
239 275
       var option = {
240
-        title: {
241
-          text: '16%',
242
-          subtext: '氢氧化钠',
243
-          x: 'center',
244
-          y: '40%',
276
+        // //标题
277
+        // title: {
278
+        //   text: '16%',
279
+        //   subtext: '氢氧化钠',
280
+        //   x: 'center',
281
+        //   y: '40%',
282
+        //   textStyle: {
283
+        //     color: '#fff',
284
+        //     fontSize: 20,
285
+        //     lineHeight: 10,
286
+        //   },
287
+        //   subtextStyle: {
288
+        //     color: 'rgba(205, 241, 255, 1)',
289
+        //     fontSize: 14,
290
+        //     lineHeight: 10,
291
+        //     marginTop: 15,
292
+        //   },
293
+        // },
294
+
295
+        //图例组件
296
+
297
+        tooltip: {
298
+          trigger: 'item',
299
+          position: ['50%', '50%'],
300
+          formatter: function (params, ticket, callback) {
301
+            $.get('detail?name=' + params.name, function (content) {
302
+              callback(ticket, toHTML(content));
303
+            });
304
+            return `<div class="testDiv"><p class="p1">
305
+              ${params.percent ? params.percent.toFixed() : 0}<spanp class="p3">%</span>
306
+            </p>
307
+            <p class="p2">${params.name}</p>
308
+            </div>`;
309
+          },
310
+          backgroundColor: 'black',
311
+
245 312
           textStyle: {
246 313
             color: '#fff',
247 314
             fontSize: 20,
248 315
             lineHeight: 10,
249 316
           },
250
-          subtextStyle: {
251
-            color: 'rgba(205, 241, 255, 1)',
252
-            fontSize: 14,
253
-            lineHeight: 10,
254
-            marginTop: 15,
255
-          },
256
-        },
257
-        tooltip: {
258
-          trigger: 'item',
259
-          formatter: "{b} : {c} ({d}%)"
260 317
         },
318
+        series: [
319
+          {
320
+            type: 'pie',
321
+            radius: ['50%', '65%'],
322
+            center: ['50%', '50%'],
323
+            roseType: 'area',
324
+            //标题与数字一行显示
325
+            label: {
326
+              show: false,
261 327
 
262
-        series: [{
263
-          name: '访问来源',
264
-          type: 'pie',
265
-          radius: ['50%', '70%'],
266
-          center: ['50%', '50%'],
267
-          color: ['rgb(131,249,103)', '#8D93FF', '#2FD2FF', '#FFCE00'], //'#FBFE27','rgb(11,228,96)','#FE5050'
268
-          data: [{
269
-            value: 205,
270
-            name: '直接访问',
271
-            itemStyle: {
272
-              normal: {
273
-                color: {
274
-                  // 完成的圆环的颜色
275
-                  colorStops: [
276
-                    {
277
-                      offset: 0,
278
-                      color: 'rgba(141, 147, 255, 0.3)', // 0% 处的颜色
279
-                    },
280
-                    {
281
-                      offset: 1,
282
-                      color: 'rgba(141, 147, 255, 1)', // 100% 处的颜色
283
-                    },
284
-                  ],
328
+            },
329
+
330
+            //标题与数字分二行显示
331
+            // label: {
332
+            //     alignTo: 'edge',
333
+            //     formatter: '{name|{b}}\n{time|{d}%}',
334
+            //     minMargin: 5,
335
+            //     edgeDistance: 10,
336
+            //     lineHeight: 30,
337
+            //     rich: {
338
+            //         time: {
339
+            //             fontSize: 10,
340
+            //             color: 'auto'
341
+            //         }
342
+            //     }
343
+            // },
344
+            labelLine: {
345
+              show: false
346
+            },
347
+
348
+            data: [{
349
+              value: 205,
350
+              name: '碳酸锂',
351
+              itemStyle: {
352
+                normal: {
353
+                  color: {
354
+                    // 完成的圆环的颜色
355
+                    colorStops: [
356
+                      {
357
+                        offset: 0,
358
+                        color: 'rgba(141, 147, 255, 0.3)', // 0% 处的颜色
359
+                      },
360
+                      {
361
+                        offset: 1,
362
+                        color: 'rgba(141, 147, 255, 1)', // 100% 处的颜色
363
+                      },
364
+                    ],
365
+                  },
285 366
                 },
286 367
               },
287 368
             },
288
-          },
289
-          {
290
-            value: 310,
291
-            name: '邮件营销',
292
-            itemStyle: {
293
-              borderCap:'round',
369
+            {
370
+              value: 310,
371
+              name: '氧化锂',
372
+              itemStyle: {
373
+                borderCap: 'round',
294 374
 
295
-              normal: {
296
-                color: {
297
-                  // 完成的圆环的颜色
298
-                  colorStops: [
299
-                    {
300
-                      offset: 0,
301
-                      color: 'rgba(105, 255, 222, 0.3)', // 0% 处的颜色
302
-                    },
303
-                    {
304
-                      offset: 1,
305
-                      color: 'rgba(105, 255, 222, 1)', // 100% 处的颜色
306
-                    },
307
-                  ],
375
+                normal: {
376
+                  color: {
377
+                    // 完成的圆环的颜色
378
+                    colorStops: [
379
+                      {
380
+                        offset: 0,
381
+                        color: 'rgba(105, 255, 222, 0.3)', // 0% 处的颜色
382
+                      },
383
+                      {
384
+                        offset: 1,
385
+                        color: 'rgba(105, 255, 222, 1)', // 100% 处的颜色
386
+                      },
387
+                    ],
388
+                  },
308 389
                 },
309 390
               },
310 391
             },
311
-          },
312
-          {
313
-            value: 234,
314
-            name: '联盟广告',
315
-            itemStyle: {
316
-              borderCap:'round',
392
+            {
393
+              value: 234,
394
+              name: '金属锂',
395
+              itemStyle: {
396
+                borderCap: 'round',
317 397
 
318
-              normal: {
319
-                color: {
320
-                  // 完成的圆环的颜色
321
-                  colorStops: [
322
-                    {
323
-                      offset: 0,
324
-                      color: 'rgba(47, 210, 255, 0.3)', // 0% 处的颜色
325
-                    },
326
-                    {
327
-                      offset: 1,
328
-                      color: 'rgba(47, 210, 255, 1)', // 100% 处的颜色
329
-                    },
330
-                  ],
398
+                normal: {
399
+                  color: {
400
+                    // 完成的圆环的颜色
401
+                    colorStops: [
402
+                      {
403
+                        offset: 0,
404
+                        color: 'rgba(47, 210, 255, 0.3)', // 0% 处的颜色
405
+                      },
406
+                      {
407
+                        offset: 1,
408
+                        color: 'rgba(47, 210, 255, 1)', // 100% 处的颜色
409
+                      },
410
+                    ],
411
+                  },
331 412
                 },
332 413
               },
333 414
             },
334
-          },
335
-          {
336
-            value: 135,
337
-            name: '视频广告学习相',
338
-            itemStyle: {
339
-              borderCap:'round',
415
+            {
416
+              value: 135,
417
+              name: '氢氧化锂',
418
+              itemStyle: {
419
+                borderCap: 'round',
340 420
 
341
-              normal: {
342
-                barBorderRadius: 15,
343
-                color: {
344
-                  // 完成的圆环的颜色
345
-                  colorStops: [
346
-                    {
347
-                      offset: 0,
348
-                      color: 'rgba(255, 206, 0, 0.3)', // 0% 处的颜色
349
-                    },
350
-                    {
351
-                      offset: 1,
352
-                      color: 'rgba(255, 206, 0, 1)', // 100% 处的颜色
353
-                    },
354
-                  ],
421
+                normal: {
422
+                  barBorderRadius: 15,
423
+                  color: {
424
+                    // 完成的圆环的颜色
425
+                    colorStops: [
426
+                      {
427
+                        offset: 0,
428
+                        color: 'rgba(255, 206, 0, 0.3)', // 0% 处的颜色
429
+                      },
430
+                      {
431
+                        offset: 1,
432
+                        color: 'rgba(255, 206, 0, 1)', // 100% 处的颜色
433
+                      },
434
+                    ],
435
+                  },
355 436
                 },
356 437
               },
357 438
             },
358
-          },
359
-          ],
360
-          roseType: 'radius',
439
+            ],
361 440
 
362
-          label: {
363
-            show: false
364 441
           },
365
-          labelLine: {
366
-            show: false
367
-          }
368
-        }]
442
+        ],
369 443
       };
370 444
 
371 445
 
446
+
372 447
       // 使用刚指定的配置项和数据显示图表。
373 448
       myChart.setOption(option);
374 449
       window.addEventListener("resize", function () {