diff --git a/packages/3.0.0/AppVillageActivity/components/Statistics.vue b/packages/3.0.0/AppVillageActivity/components/Statistics.vue index 03b2f0a5..ee94c522 100644 --- a/packages/3.0.0/AppVillageActivity/components/Statistics.vue +++ b/packages/3.0.0/AppVillageActivity/components/Statistics.vue @@ -1,5 +1,5 @@ - + @@ -30,27 +30,60 @@ - - - - 居民总数 - {{ info.total }} - - - 今日新增 - {{ info.increase }} - - - 今日流失 - {{ info.decrease }} - - - + + - + + + + + + + + + + + 活动发布数量 + + {{ info['活动发布数量'] }} + + + + 活动报名人数 + + {{ info['活动报名人数'] || 0 }} + + + + 发布动态条数 + + {{ info['发布动态条数'] }} + + + + 发布动态人员占比 + + {{ info['发布动态人员占比'] }}% + + + + + 居民参与类型占比 + + + + + + + @@ -68,7 +101,7 @@ data () { return { - chart: null, + chart1: null, info: {}, chartWidth: '', loading: false, @@ -79,6 +112,8 @@ children: 'children', label: 'name' }, + time1: '', + chart2: '', areaId: '', currIndex: -1, areaList: [], @@ -107,7 +142,8 @@ this.getAreaList() this.loading = true this.$nextTick(() => { - this.chart = echarts.init(document.querySelector('.chart')) + this.chart1 = echarts.init(document.querySelector('.chart1')) + this.chart2 = echarts.init(document.querySelector('.chart2')) window.addEventListener('resize', this.onResize) this.getInfo() }) @@ -119,7 +155,7 @@ methods: { onResize () { - this.chart.resize() + this.chart1.resize() }, onTreeChange (e) { @@ -128,7 +164,8 @@ this.search.current = 1 this.$nextTick(() => { - this.getList() + this.loading = true + this.getInfo() }) }, @@ -180,10 +217,11 @@ }, getInfo () { - this.instance.post(`/app/wxcp/wxcustomerlog/customerStatistic`).then(res => { + this.instance.post(`/app/appvillageactivityinfo/statistic?time1=${this.time1}`).then(res => { if (res.code == 0) { - this.info = res.data.today - this.initChart(res.data.list) + this.info = res.data.total + this.initChart1(res.data.twelve) + this.initChart2(res.data.gender) this.loading = false } else { this.loading = false @@ -191,9 +229,65 @@ }) }, - initChart (data) { - const x = Object.keys(data) - const y = Object.values(data) + initChart2 (data) { + const values = Object.keys(data).map(v => { + return { + value: data[v], + name: v + } + }) + let option = { + tooltip: { + trigger: 'item' + }, + legend: { + right: '5%', + top: 'center', + orient: 'vertical' + }, + series: [ + { + type: 'pie', + radius: ['40%', '70%'], + avoidLabelOverlap: false, + label: { + show: false, + position: 'center' + }, + emphasis: { + label: { + show: true, + fontSize: '20', + color: '#2266FF' + } + }, + itemStyle: { + emphasis: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + }, + normal:{ + label:{ + show: true, + formatter: '{b} : {c} ({d}%)' + }, + labelLine :{show:true} + } + }, + labelLine: { + show: false + }, + color: ['#2266FF', '#22AA99', '#F8B425'], + data: values + } + ] + } + this.chart2.setOption(option) + }, + + initChart1 (data) { + const x = data.map(v => v.time) let option = { tooltip: { trigger: 'axis' @@ -202,8 +296,8 @@ type: "plain" }, grid: { - left: '20px', - right: '38px', + left: '10px', + right: '28px', bottom: '14px', top: '30px', containLabel: true @@ -253,41 +347,24 @@ }, series: [ { - name: '居民总数', + name: '活动报名人数', type: 'line', - data: y.map(v => v.total) + data: data.map(v => v.active) }, { - name: '新增居民数', + name: '发布动态人数', type: 'line', - data: y.map(v => v.increase) - }, - { - name: '流失居民数', - type: 'line', - data: y.map(v => v.decrease) + data: data.map(v => v.total) } ] } - this.chart.setOption(option) + this.chart1.setOption(option) } } }