Commit 163b55d6 by 姜雷

Merge branch 'develop' into 'test'

修改首页用户活跃展示 See merge request !121
parents f47261e1 a441ba89
<template> <template>
<div <div
class="Dashboard-Row Dashboard-DataCard" class="Dashboard-Row Dashboard-DataCard Dashboard-Register"
v-loading="loading.regist" v-loading="loading.regist"
> >
<div class="Dashboard-SearchBar"> <div class="Dashboard-SearchBar">
<search-item label="年份"> <search-item label="年份">
<el-date-picker <el-date-picker
v-model.trim="campusFilters.year" v-model.trim="campusFilters.year"
@change="changeReportYearHandle"
type="year" type="year"
value-format="yyyy" value-format="yyyy"
placeholder="请选择" placeholder="请选择"
...@@ -17,10 +16,15 @@ ...@@ -17,10 +16,15 @@
<search-item label="校区"> <search-item label="校区">
<area-select <area-select
v-model.trim="campusFilters.areaId" v-model.trim="campusFilters.areaId"
@input="changeReportAreaHandle"
:accessType="isAdmin?0:1" :accessType="isAdmin?0:1"
/> />
</search-item> </search-item>
<search-item label="">
<el-button
@click="searchList"
type="primary"
>搜索</el-button>
</search-item>
</div> </div>
<div class="Dashboard-CampusData"> <div class="Dashboard-CampusData">
<div class="Dashboard-CampusItem"> <div class="Dashboard-CampusItem">
...@@ -36,10 +40,14 @@ ...@@ -36,10 +40,14 @@
</div> </div>
<RegisterByDay :data="registePerDay" /> <RegisterByDay :data="registePerDay" />
</div> </div>
</div>
<div class="Dashboard-CampusData">
<div class="Dashboard-CampusItem"> <div class="Dashboard-CampusItem">
<div class="Dashboard-title">{{ reportYear }}年每月活跃数据</div> <div class="Dashboard-title">{{ reportYear }}年每月活跃数据</div>
<ActiveUserByMonth :data="activeUser" /> <ActiveUserByMonth :data="activeUser" />
</div> </div>
<div class="Dashboard-CampusItem">
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -111,12 +119,24 @@ export default { ...@@ -111,12 +119,24 @@ export default {
month: month, month: month,
}); });
}, },
searchList() {
let year = this.campusFilters.year;
let areaId = this.campusFilters.areaId;
this.fetchReportList({
isAdmin: this.isAdmin ? 1 : 0,
year: year ? year : null,
areaId: areaId ? areaId : null,
});
},
}, },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.Dashboard { .Dashboard {
.Dashboard-Row.Dashboard-Register {
height: auto;
}
.Dashboard-DataCard { .Dashboard-DataCard {
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
......
...@@ -16,6 +16,7 @@ export default { ...@@ -16,6 +16,7 @@ export default {
{ value: 'monthAppActive', name: 'APP活跃用户' }, { value: 'monthAppActive', name: 'APP活跃用户' },
{ value: 'monthHardActive', name: '硬件活跃用户' }, { value: 'monthHardActive', name: '硬件活跃用户' },
{ value: 'allActive', name: '两者兼具' }, { value: 'allActive', name: '两者兼具' },
{ value: 'total', name: '全部活跃' },
], ],
}; };
}, },
...@@ -25,14 +26,12 @@ export default { ...@@ -25,14 +26,12 @@ export default {
container: 'ActiveUserByMonth', container: 'ActiveUserByMonth',
forceFit: true, forceFit: true,
height: this.height, height: this.height,
padding: [50, 40], padding: [30, 20, 30, 20],
}); });
this.chart this.chart
.source(this.data, { .source(this.data, {
month: { month: {
min: 1, type: 'cat',
max: 12,
tickCount: 12,
}, },
mark: { mark: {
type: 'cat', type: 'cat',
...@@ -46,22 +45,28 @@ export default { ...@@ -46,22 +45,28 @@ export default {
showTitle: false, showTitle: false,
}); });
// 图例 // 图例
this.chart.legend({
position: 'top',
title: null,
marker: 'square',
});
// .axis('count', false)
// .axis('mark', {
// formatter: value => {
// let service = this.serviceList.find(item => item.value === value);
// return service ? `${service.name}` : '';
// },
// });
this.chart this.chart
.legend({ .interval()
position: 'top',
title: null,
marker: 'square',
})
.axis('count', false)
.axis('mark', {
formatter: value => {
let service = this.serviceList.find(item => item.value === value);
return service ? `${service.name}` : '';
},
})
.intervalStack()
.position('month*count') .position('month*count')
.color('mark', ['#4e82fb', '#ffc934', '#26c9a8']); .color('mark', ['#4e82fb', '#ffc934', '#26c9a8'])
.adjust([
{
type: 'dodge',
marginRatio: 1 / 32,
},
]);
this.chart.render(); this.chart.render();
}, },
......
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
container: 'RegisterByMonth', container: 'RegisterByMonth',
forceFit: true, forceFit: true,
height: this.height, height: this.height,
padding: [0, 20, 30, 20], padding: [30, 20, 30, 20],
}); });
this.chart this.chart
.source(this.data, { .source(this.data, {
......
...@@ -210,6 +210,7 @@ const mutations = { ...@@ -210,6 +210,7 @@ const mutations = {
[GET_REPORT_DATA]: (state, data) => { [GET_REPORT_DATA]: (state, data) => {
state.report.year = data.year; state.report.year = data.year;
state.report.month = data.month; state.report.month = data.month;
let dayList = new Array(31).fill({ count: 0 }); let dayList = new Array(31).fill({ count: 0 });
dayList = dayList.map((v, idx) => ({ ...v, days: idx + 1 })); dayList = dayList.map((v, idx) => ({ ...v, days: idx + 1 }));
data.dayVos.map(val => { data.dayVos.map(val => {
...@@ -218,7 +219,20 @@ const mutations = { ...@@ -218,7 +219,20 @@ const mutations = {
}); });
state.report.registePerDay = dayList; state.report.registePerDay = dayList;
state.report.registePerMonth = data.list; state.report.registePerMonth = data.list;
state.report.activeUser = data.listCount;
let activeList = new Array(12).fill({ count: 0, mark: 'total' });
activeList = activeList.map((v, idx) => ({ ...v, month: idx + 1 }));
data.listCount.map(val => {
let idx = val.month - 1;
if (val.mark === 'monthAppActive' || val.mark === 'monthHardActive') {
activeList[idx].count += val.count;
}
});
let activeAppList = data.listCount.filter(
val => val.mark === 'monthAppActive'
);
activeList.push.apply(activeList, activeAppList);
state.report.activeUser = activeList;
}, },
[GET_TITLE_DATA](state, data) { [GET_TITLE_DATA](state, data) {
state.title = data; state.title = data;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<div class="Dashboard Home-Dashboard"> <div class="Dashboard Home-Dashboard">
<CustomerRegister <CustomerRegister
v-if="show" v-if="show"
class="Dashboard-Row Dashboard-DataCard"
:isAdmin="isAdmin" :isAdmin="isAdmin"
/> />
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment