Browse Source

feat:home 002

0235711 1 day ago
parent
commit
fe0ae98d36

+ 15 - 18
manager-web/src/modules/manager/mobile/page-home/page-home.html

@@ -168,25 +168,22 @@
       </div>
       
       <div class="chart-container">
-        <div class="chart-header">
-          <div class="chart-title">
-            <i class="fas fa-chart-bar"></i>
-            <span>销售团队业绩分析</span>
-          </div>
-          <div class="chart-actions">
-            <button class="btn btn-outline" (click)="exportChart()">
-              <i class="fas fa-download"></i> 导出
-            </button>
-            <button class="btn btn-primary" (click)="refreshChart()">
-              <i class="fas fa-sync-alt"></i> 更新
-            </button>
-          </div>
-        </div>
-        <div class="chart-wrapper">
-          <div echarts [options]="chartOptions" class="echarts-chart"></div>
-        </div>
-      </div>
+  <div class="chart-header">
+    <div class="chart-title">
+      <i class="fas fa-chart-bar"></i>
+      <span>销售团队业绩分析</span>
     </div>
+    <div class="chart-actions">
+      <button class="btn btn-outline" (click)="exportChart()">
+        <i class="fas fa-download"></i> 导出
+      </button>
+      <button class="btn btn-primary" (click)="refreshChart()">
+        <i class="fas fa-sync-alt"></i> 更新
+      </button>
+    </div>
+  </div>
+  <div class="chart-wrapper">
+    <div echarts [options]="chartOptions" class="echarts-chart" style="height: 350px;"></div>
   </div>
 </div>
 

+ 15 - 4
manager-web/src/modules/manager/mobile/page-home/page-home.scss

@@ -661,6 +661,11 @@ header {
   padding: 25px;
   box-shadow: var(--shadow);
   margin-bottom: 30px;
+  transition: var(--transition);
+  
+  &:hover {
+    box-shadow: var(--shadow-hover);
+  }
 }
 
 .chart-header {
@@ -677,10 +682,10 @@ header {
   display: flex;
   align-items: center;
   gap: 10px;
-}
-
-.chart-title i {
-  color: var(--primary);
+  
+  i {
+    color: var(--primary);
+  }
 }
 
 .chart-actions {
@@ -691,11 +696,17 @@ header {
 .chart-wrapper {
   height: 350px;
   position: relative;
+  transition: var(--transition);
+  
+  &:hover {
+    transform: translateY(-2px);
+  }
 }
 
 .echarts-chart {
   width: 100%;
   height: 100%;
+  transition: var(--transition);
 }
 
 /* AI权限管理面板 */

+ 116 - 79
manager-web/src/modules/manager/mobile/page-home/page-home.ts

@@ -1,17 +1,23 @@
 import { Component, OnInit } from '@angular/core';
-import { NgxEchartsModule } from 'ngx-echarts';
 import { CommonModule } from '@angular/common';
 import { FormsModule } from '@angular/forms';
+import { NgxEchartsDirective, provideEchartsCore } from 'ngx-echarts';
 import * as echarts from 'echarts';
 
+
 @Component({
   selector: 'app-page-home',
   standalone: true,
   imports: [
     CommonModule,
-    NgxEchartsModule,
-    FormsModule
+    FormsModule,
+    NgxEchartsDirective // 使用指令而不是模块
   ],
+  providers: [
+  provideEchartsCore({
+    echarts: () => import('echarts')
+  })
+],
   templateUrl: './page-home.html',
   styleUrls: ['./page-home.scss']
 })
@@ -85,92 +91,123 @@ applyAiRecommendation() {
   }
 
   initChart() {
-    this.chartOptions = {
-      tooltip: {
-        trigger: 'axis',
-        axisPointer: {
-          type: 'shadow'
-        },
-        backgroundColor: 'rgba(15, 23, 42, 0.9)',
-        borderColor: 'rgba(255, 255, 255, 0.1)',
-        borderWidth: 1,
-        textStyle: {
-          color: '#e2e8f0'
+  this.chartOptions = {
+    backgroundColor: 'transparent',
+    tooltip: {
+      trigger: 'axis',
+      axisPointer: {
+        type: 'shadow'
+      },
+      backgroundColor: 'rgba(15, 23, 42, 0.9)',
+      borderColor: 'rgba(255, 255, 255, 0.1)',
+      borderWidth: 1,
+      textStyle: {
+        color: '#e2e8f0'
+      },
+      formatter: '{b}: {c}万元'
+    },
+    grid: {
+      left: '3%',
+      right: '4%',
+      bottom: '3%',
+      top: '10%',
+      containLabel: true
+    },
+    xAxis: {
+      type: 'value',
+      axisLine: {
+        lineStyle: {
+          color: 'rgba(0, 0, 0, 0.1)'
         }
       },
-      grid: {
-        left: '3%',
-        right: '4%',
-        bottom: '3%',
-        containLabel: true
+      axisLabel: {
+        color: '#64748b',
+        formatter: '{value}万'
       },
-      xAxis: {
-        type: 'value',
-        axisLine: {
-          lineStyle: {
-            color: 'rgba(0, 0, 0, 0.1)'
-          }
-        },
-        axisLabel: {
-          color: '#64748b'
-        },
-        splitLine: {
-          lineStyle: {
-            color: 'rgba(0, 0, 0, 0.05)'
-          }
+      splitLine: {
+        lineStyle: {
+          color: 'rgba(0, 0, 0, 0.05)'
         }
       },
-      yAxis: {
-        type: 'category',
-        data: ['实习销售', '白银销售', '黄金销售', '铂金销售', '钻石销售'],
-        axisLine: {
-          lineStyle: {
-            color: 'rgba(0, 0, 0, 0.1)'
-          }
-        },
-        axisLabel: {
-          color: '#64748b'
+      name: '平均月业绩',
+      nameTextStyle: {
+        color: '#64748b',
+        padding: [0, 0, 0, 40]
+      }
+    },
+    yAxis: {
+      type: 'category',
+      data: ['实习销售', '白银销售', '黄金销售', '铂金销售', '钻石销售'],
+      axisLine: {
+        lineStyle: {
+          color: 'rgba(0, 0, 0, 0.1)'
         }
       },
-      series: [
-        {
-          name: '平均月业绩 (万元)',
-          type: 'bar',
-          data: [8.2, 22.5, 45.8, 78.3, 125.6],
-          itemStyle: {
-            color: (params: any) => {
-              const colors = [
-                'rgba(59, 130, 246, 0.7)',
-                'rgba(148, 163, 184, 0.7)',
-                'rgba(245, 158, 11, 0.7)',
-                'rgba(129, 140, 248, 0.7)',
-                'rgba(34, 211, 238, 0.7)'
-              ];
-              return colors[params.dataIndex];
-            },
-            borderColor: (params: any) => {
-              const colors = [
-                'rgb(59, 130, 246)',
-                'rgb(148, 163, 184)',
-                'rgb(245, 158, 11)',
-                'rgb(129, 140, 248)',
-                'rgb(34, 211, 238)'
-              ];
-              return colors[params.dataIndex];
-            },
-            borderWidth: 2,
-            borderRadius: [4, 4, 0, 0]
+      axisLabel: {
+        color: '#64748b',
+        fontWeight: 'bold'
+      },
+      axisTick: {
+        show: false
+      }
+    },
+    series: [
+      {
+        name: '平均月业绩',
+        type: 'bar',
+        data: [8.2, 22.5, 45.8, 78.3, 125.6],
+        itemStyle: {
+          color: (params: any) => {
+            const colors = [
+              'rgba(59, 130, 246, 0.8)',
+              'rgba(148, 163, 184, 0.8)',
+              'rgba(245, 158, 11, 0.8)',
+              'rgba(129, 140, 248, 0.8)',
+              'rgba(34, 211, 238, 0.8)'
+            ];
+            return colors[params.dataIndex];
+          },
+          borderColor: (params: any) => {
+            const colors = [
+              'rgb(59, 130, 246)',
+              'rgb(148, 163, 184)',
+              'rgb(245, 158, 11)',
+              'rgb(129, 140, 248)',
+              'rgb(34, 211, 238)'
+            ];
+            return colors[params.dataIndex];
           },
-          label: {
-            show: true,
-            position: 'right',
-            color: '#64748b',
-            formatter: '{c}万'
+          borderWidth: 2,
+          borderRadius: [4, 4, 0, 0],
+          shadowColor: 'rgba(0, 0, 0, 0.1)',
+          shadowBlur: 5,
+          shadowOffsetY: 2
+        },
+        label: {
+          show: true,
+          position: 'right',
+          color: '#64748b',
+          formatter: '{c}万',
+          fontWeight: 'bold'
+        },
+        barWidth: '40%',
+        emphasis: {
+          itemStyle: {
+            shadowColor: 'rgba(0, 0, 0, 0.2)',
+            shadowBlur: 10,
+            shadowOffsetY: 3
           }
+        },
+        animationType: 'scale',
+        animationEasing: 'elasticOut',
+        animationDelay: function (idx: number) {
+          return idx * 100;
         }
-      ]
-    };
-  }
+      }
+    ],
+    animationDuration: 1000
+  };
+}
 
   setFilter(level: string) {
     this.activeFilter = this.activeFilter === level ? null : level;