usertab.vue
2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template>
<div class="user-tab flex">
<template v-for="(tab, index) in userData">
<div class="tab-item" :key="index" @click="getTrend(tab.view, tab.text)">
<div class="tab-title">{{ tab.text }}</div>
<div class="tab-count text-linear">{{ numAddSymbol(dataList[tab.value]) }}</div>
<div class="tab-increase flex-between">
<div class="increase-text">当年新增</div>
<div class="increase-count">{{ numAddSymbol(dataList[tab.key]) }}</div>
</div>
</div>
</template>
</div>
</template>
<script>
export default {
name: 'UserTab',
data() {
return {
dataList: {},
userData: [
{
text: '用户数',
value: 'totalnum',
key: 'increnum',
view: 'total'
},
{
text: '企微客户数',
value: 'totalwechatnum',
key: 'increwechatnum',
view: 'wechat'
},
{
text: '企微群数',
value: 'totalwechatgroupnum',
key: 'increwechatgroupnum',
view: 'wechatgroup'
},
{
text: '小程序',
value: 'totalappletnum',
key: 'increappletnum',
view: 'applet'
},
{
text: '个微客户数',
value: 'totalsinglewechantnum',
key: 'incresinglewechantnum',
view: 'individual'
}
]
}
},
async created() {
await this.getoverview()
this.getTrend('total', '用户数')
},
methods: {
getoverview() {
this.api.user.getoverview().then(res => {
if (res.code == 0) {
this.dataList = res.data.dataList[0]
}
})
},
getTrend(queryItem, name) {
const params = { req: { queryItem } }
this.api.user.getTrend(params).then(res => {
if (res.code == 0) {
const dataList = res.data.dataList
const obj = {
dataList,
name
}
this.$bus.$emit('drawPrivateChart', obj)
}
})
}
}
}
</script>
<style scoped lang="scss">
.user-tab {
height: 9.02vh;
margin: 1.46vh 0 0.98vh 0;
.tab-item {
cursor: pointer;
width: 9.65vw;
height: 9.02vh;
background: #0b0e31;
margin-right: 0.28vw;
padding: 0.28vh 0;
box-sizing: border-box;
.tab-title {
font-weight: 400;
font-size: 12px;
color: #e8e8e8;
margin: 0 0.69vw;
height: 2.07vh;
}
.tab-count {
font-weight: 700;
font-size: 22px;
margin: 0 0.69vw;
height: 3.8vh;
line-height: 3.8vh;
}
.tab-increase {
height: 2.44vh;
border-top: 1px solid #171f60;
padding: 0 0.69vw;
}
.increase-text {
font-size: 9px;
color: #dddddd;
}
.increase-count {
font-weight: 700;
font-size: 12px;
color: #ffffff;
}
}
}
</style>