张延森 3 년 전
부모
커밋
af42dd5a2b
2개의 변경된 파일12개의 추가작업 그리고 92개의 파일을 삭제
  1. 1
    1
      config/prod.js
  2. 11
    91
      src/subpackages/pages/consultant/customerAnalyse/index.jsx

+ 1
- 1
config/prod.js 파일 보기

10
     OSS_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
10
     OSS_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
11
     OSS_FAST_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
11
     OSS_FAST_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',
12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',
13
-    Version: '"V0.0.86-20211220"'
13
+    Version: '"V0.0.87-20211220"'
14
   },
14
   },
15
   mini: {},
15
   mini: {},
16
   h5: {
16
   h5: {

+ 11
- 91
src/subpackages/pages/consultant/customerAnalyse/index.jsx 파일 보기

8
 // import dayjs from 'dayjs'
8
 // import dayjs from 'dayjs'
9
 import './index.scss'
9
 import './index.scss'
10
 
10
 
11
+const round100 = x => Number(x * 100).toFixed(2);
12
+
11
 export default withLayout((props) => {
13
 export default withLayout((props) => {
12
   const { person } = props
14
   const { person } = props
13
   const PersonId = person.personId
15
   const PersonId = person.personId
25
   ])
27
   ])
26
   const [CurrentChartMenuId, setCurrentChartMenuId] = useState(1)
28
   const [CurrentChartMenuId, setCurrentChartMenuId] = useState(1)
27
 
29
 
28
-  const [ChartList, setChartList] = useState([])
29
   const [SexList, setSexList] = useState([])
30
   const [SexList, setSexList] = useState([])
30
 
31
 
31
   const [dimensions, setDimensions] = useState(['day', 'customerNum'])
32
   const [dimensions, setDimensions] = useState(['day', 'customerNum'])
33
 
34
 
34
   useEffect(() => {
35
   useEffect(() => {
35
     if (CurrentChartMenuId && CurrentMenuId) {
36
     if (CurrentChartMenuId && CurrentMenuId) {
36
-      setChartList([])
37
       GetSexInfo()
37
       GetSexInfo()
38
       GetChartInfo()
38
       GetChartInfo()
39
     }
39
     }
40
   }, [CurrentChartMenuId, CurrentMenuId])
40
   }, [CurrentChartMenuId, CurrentMenuId])
41
 
41
 
42
-  useEffect(() => {
43
-    if (!ChartList.length) {
44
-      GetChartInfo()
45
-    } else {
46
-      // const chart = echarts.init(canvas, null, { width: '100%', height: '100%' })
47
-      // canvas.setChart(chart)
48
-    }
49
-  }, [ChartList])
50
-
51
   const GetSexInfo = () => {
42
   const GetSexInfo = () => {
52
     fetch({ url: `${API_SEX_INFO}/${CurrentMenuId === 1 ? 'new' : CurrentMenuId === 2 ? 'follow' : 'visite'}`, method: 'get' }).then((res) => {
43
     fetch({ url: `${API_SEX_INFO}/${CurrentMenuId === 1 ? 'new' : CurrentMenuId === 2 ? 'follow' : 'visite'}`, method: 'get' }).then((res) => {
53
       const SexRes = (res || []).map((item) => {
44
       const SexRes = (res || []).map((item) => {
62
   }
53
   }
63
 
54
 
64
   const GetChartInfo = () => {
55
   const GetChartInfo = () => {
65
-    fetch({ url: `${CurrentChartMenuId === 1 ? API_ECHERTS_DAILY : API_ECHERTS_MONTH}/${CurrentMenuId === 1 ? 'new' : CurrentMenuId === 2 ? 'follow' : 'visite'}`, method: 'get' }).then((res) => {
56
+    const url = `${CurrentChartMenuId === 1 ? API_ECHERTS_DAILY : API_ECHERTS_MONTH}/${CurrentMenuId === 1 ? 'new' : CurrentMenuId === 2 ? 'follow' : 'visite'}`
57
+    fetch({ url, method: 'get' }).then((res) => {
66
       const Arr = (res || []).reverse()
58
       const Arr = (res || []).reverse()
67
-      setChartList(Arr.map(x => ({ name: x.day, value: x.customerNum })))
68
       setSource(Arr)
59
       setSource(Arr)
69
     })
60
     })
70
   }
61
   }
78
   const CutChartMenu = (item) => {
69
   const CutChartMenu = (item) => {
79
     return () => {
70
     return () => {
80
       setCurrentChartMenuId(item.id)
71
       setCurrentChartMenuId(item.id)
72
+      if (item.id === 1) {
73
+        setDimensions(['day', 'customerNum'])
74
+      } else {
75
+        setDimensions(['month', 'customerNum'])
76
+      }
81
     }
77
     }
82
   }
78
   }
83
 
79
 
84
-  // const createLineOptions = (source = []) => {
85
-  //   const colorWithOpacity = op => `rgba(187,156,121, ${op})`
86
-
87
-  //   const defaultOpt = {
88
-  //     color: [colorWithOpacity(1)],
89
-  //     xAxis: {
90
-  //       type: 'category',
91
-  //       boundaryGap: false,
92
-  //       axisLabel: {
93
-  //         textStyle: {
94
-  //           color: '#666'
95
-  //         }
96
-  //       }
97
-
98
-  //     },
99
-  //     yAxis: {
100
-  //       type: 'value',
101
-  //       axisLabel: {
102
-  //         textStyle: {
103
-  //           color: '#666'
104
-  //         }
105
-  //       }
106
-  //     },
107
-  //     grid: {
108
-  //       left: '10%',
109
-  //       right: '8%',
110
-  //       bottom: '12%',
111
-  //       top: '15%',
112
-  //     },
113
-  //     series: [],
114
-  //   }
115
-  //   // 数据展示只展示 5 个
116
-  //   const endValue = source.length - 1 > 0 ? source.length - 1 : 0
117
-  //   const startValue = endValue - 5 > 0 ? endValue - 5 : 0
118
-
119
-  //   return {
120
-  //     ...defaultOpt,
121
-  //     dataset: { source },
122
-  //     dataZoom: [{
123
-  //       type: 'inside',
124
-  //       startValue, endValue,
125
-  //       show: true,
126
-  //     }],
127
-  //     series: [{
128
-  //       type: 'line',
129
-  //       dimensions: ['name', 'value'],
130
-  //       symbolSize: 6,
131
-  //       smooth: true,
132
-  //       label: {
133
-  //         show: true,
134
-  //         formatter: '{@value}人'
135
-  //       },
136
-  //       lineStyle: {
137
-  //         shadowColor: colorWithOpacity(0.5),
138
-  //         shadowBlur: 5,
139
-  //         shadowOffsetY: 7
140
-  //       },
141
-  //       areaStyle: {
142
-  //         color: {
143
-  //           type: 'linear',
144
-  //           x: 0,
145
-  //           y: 0,
146
-  //           x2: 0,
147
-  //           y2: 1,
148
-  //           colorStops: [{
149
-  //             offset: 0, color: colorWithOpacity(0.2) // 0% 处的颜色
150
-  //           }, {
151
-  //             offset: 1, color: colorWithOpacity(0) // 100% 处的颜色
152
-  //           }],
153
-  //           global: false,
154
-  //         }
155
-  //       },
156
-  //     }],
157
-  //   }
158
-  // }
159
-
160
   return (
80
   return (
161
     <view className='Page customerAnalyse flex-v'>
81
     <view className='Page customerAnalyse flex-v'>
162
 
82
 
197
                     <view className='flex-h' key={`SexItem-${index}`}>
117
                     <view className='flex-h' key={`SexItem-${index}`}>
198
                       <text>{item.name}</text>
118
                       <text>{item.name}</text>
199
                       <view className='flex-item'>
119
                       <view className='flex-item'>
200
-                        <view style={{ width: `${Math.floor(item.per * 100)}%` }}></view>
120
+                        <view style={{ width: `${round100(item.per)}%` }}></view>
201
                       </view>
121
                       </view>
202
-                      <text>{Math.floor(item.per * 100)}%</text>
122
+                      <text>{round100(item.per)}%</text>
203
                     </view>
123
                     </view>
204
                   ))
124
                   ))
205
                 }
125
                 }