|
|
@ -5,7 +5,7 @@ |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<el-card class="statistics-card"> |
|
|
<el-card class="statistics-card"> |
|
|
<div class="statistics-item"> |
|
|
<div class="statistics-item"> |
|
|
<div class="statistics-icon" style="background-color: #409EFF;"> |
|
|
<div class="statistics-icon" style="background-color: #409eff"> |
|
|
<el-icon size="24"> |
|
|
<el-icon size="24"> |
|
|
<User /> |
|
|
<User /> |
|
|
</el-icon> |
|
|
</el-icon> |
|
|
@ -20,7 +20,7 @@ |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<el-card class="statistics-card"> |
|
|
<el-card class="statistics-card"> |
|
|
<div class="statistics-item"> |
|
|
<div class="statistics-item"> |
|
|
<div class="statistics-icon" style="background-color: #67C23A;"> |
|
|
<div class="statistics-icon" style="background-color: #67c23a"> |
|
|
<el-icon size="24"> |
|
|
<el-icon size="24"> |
|
|
<ChatDotRound /> |
|
|
<ChatDotRound /> |
|
|
</el-icon> |
|
|
</el-icon> |
|
|
@ -35,7 +35,7 @@ |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<el-card class="statistics-card"> |
|
|
<el-card class="statistics-card"> |
|
|
<div class="statistics-item"> |
|
|
<div class="statistics-item"> |
|
|
<div class="statistics-icon" style="background-color: #E6A23C;"> |
|
|
<div class="statistics-icon" style="background-color: #e6a23c"> |
|
|
<el-icon size="24"> |
|
|
<el-icon size="24"> |
|
|
<Timer /> |
|
|
<Timer /> |
|
|
</el-icon> |
|
|
</el-icon> |
|
|
@ -50,7 +50,7 @@ |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<el-card class="statistics-card"> |
|
|
<el-card class="statistics-card"> |
|
|
<div class="statistics-item"> |
|
|
<div class="statistics-item"> |
|
|
<div class="statistics-icon" style="background-color: #909399;"> |
|
|
<div class="statistics-icon" style="background-color: #909399"> |
|
|
<el-icon size="24"> |
|
|
<el-icon size="24"> |
|
|
<Clock /> |
|
|
<Clock /> |
|
|
</el-icon> |
|
|
</el-icon> |
|
|
@ -67,34 +67,32 @@ |
|
|
<!-- 统计图表 --> |
|
|
<!-- 统计图表 --> |
|
|
<div class="chart-section"> |
|
|
<div class="chart-section"> |
|
|
<el-row :gutter="20"> |
|
|
<el-row :gutter="20"> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="24"> |
|
|
<el-card> |
|
|
<el-card> |
|
|
<template #header> |
|
|
<template #header> |
|
|
<span>用户注册</span> |
|
|
<span>用户注册</span> |
|
|
<el-select v-model="registrationSelectedDays" @change="loadRegistrationChartData" |
|
|
<el-select v-model="registrationSelectedDays" @change="loadRegistrationChartData" style="width: 100px; float: right" size="small"> |
|
|
style="width: 100px; float: right;" size="small"> |
|
|
|
|
|
<el-option label="7天" :value="7"></el-option> |
|
|
<el-option label="7天" :value="7"></el-option> |
|
|
<el-option label="15天" :value="15"></el-option> |
|
|
<el-option label="15天" :value="15"></el-option> |
|
|
<el-option label="30天" :value="30"></el-option> |
|
|
<el-option label="30天" :value="30"></el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</template> |
|
|
</template> |
|
|
<div ref="registrationChartContainer" style="width: 100%; height: 300px;"></div> |
|
|
<div ref="registrationChartContainer" style="width: 100%; height: 300px"></div> |
|
|
</el-card> |
|
|
</el-card> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12"> |
|
|
<!-- <el-col :span="12"> |
|
|
<el-card> |
|
|
<el-card> |
|
|
<template #header> |
|
|
<template #header> |
|
|
<span>消息统计</span> |
|
|
<span>消息统计</span> |
|
|
<el-select v-model="selectedDays" @change="loadChartData" style="width: 100px; float: right;" |
|
|
<el-select v-model="selectedDays" @change="loadChartData" style="width: 100px; float: right" size="small"> |
|
|
size="small"> |
|
|
|
|
|
<el-option label="7天" :value="7"></el-option> |
|
|
<el-option label="7天" :value="7"></el-option> |
|
|
<el-option label="15天" :value="15"></el-option> |
|
|
<el-option label="15天" :value="15"></el-option> |
|
|
<el-option label="30天" :value="30"></el-option> |
|
|
<el-option label="30天" :value="30"></el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</template> |
|
|
</template> |
|
|
<div ref="chartContainer" style="width: 100%; height: 300px;"></div> |
|
|
<div ref="chartContainer" style="width: 100%; height: 300px"></div> |
|
|
</el-card> |
|
|
</el-card> |
|
|
</el-col> |
|
|
</el-col> --> |
|
|
</el-row> |
|
|
</el-row> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
@ -165,7 +163,6 @@ const loadActiveUserStats = async () => { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 加载图表数据 |
|
|
// 加载图表数据 |
|
|
const loadChartData = async () => { |
|
|
const loadChartData = async () => { |
|
|
try { |
|
|
try { |
|
|
@ -217,11 +214,11 @@ const processChartData = (privateData: any[], groupData: any[]) => { |
|
|
dates.push(dateStr); |
|
|
dates.push(dateStr); |
|
|
|
|
|
|
|
|
// 查找对应日期的私聊数据 |
|
|
// 查找对应日期的私聊数据 |
|
|
const privateDayData = privateData.find(item => item.date === dateStr); |
|
|
const privateDayData = privateData.find((item) => item.date === dateStr); |
|
|
privateCounts.push(privateDayData ? parseInt(privateDayData.count) : 0); |
|
|
privateCounts.push(privateDayData ? parseInt(privateDayData.count) : 0); |
|
|
|
|
|
|
|
|
// 查找对应日期的群聊数据 |
|
|
// 查找对应日期的群聊数据 |
|
|
const groupDayData = groupData.find(item => item.date === dateStr); |
|
|
const groupDayData = groupData.find((item) => item.date === dateStr); |
|
|
groupCounts.push(groupDayData ? parseInt(groupDayData.count) : 0); |
|
|
groupCounts.push(groupDayData ? parseInt(groupDayData.count) : 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -243,9 +240,11 @@ const loadRegistrationChartData = async () => { |
|
|
xAxis: { |
|
|
xAxis: { |
|
|
data: chartData.dates |
|
|
data: chartData.dates |
|
|
}, |
|
|
}, |
|
|
series: [{ |
|
|
series: [ |
|
|
data: chartData.counts |
|
|
{ |
|
|
}] |
|
|
data: chartData.counts |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
@ -267,7 +266,7 @@ const processRegistrationChartData = (data: any[]) => { |
|
|
dates.push(dateStr); |
|
|
dates.push(dateStr); |
|
|
|
|
|
|
|
|
// 查找对应日期的数据 |
|
|
// 查找对应日期的数据 |
|
|
const dayData = data.find(item => item.date === dateStr); |
|
|
const dayData = data.find((item) => item.date === dateStr); |
|
|
counts.push(dayData ? parseInt(dayData.count) : 0); |
|
|
counts.push(dayData ? parseInt(dayData.count) : 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -328,11 +327,16 @@ const initChart = async () => { |
|
|
y: 0, |
|
|
y: 0, |
|
|
x2: 0, |
|
|
x2: 0, |
|
|
y2: 1, |
|
|
y2: 1, |
|
|
colorStops: [{ |
|
|
colorStops: [ |
|
|
offset: 0, color: 'rgba(64, 158, 255, 0.3)' |
|
|
{ |
|
|
}, { |
|
|
offset: 0, |
|
|
offset: 1, color: 'rgba(64, 158, 255, 0.1)' |
|
|
color: 'rgba(64, 158, 255, 0.3)' |
|
|
}] |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
offset: 1, |
|
|
|
|
|
color: 'rgba(64, 158, 255, 0.1)' |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
@ -351,11 +355,16 @@ const initChart = async () => { |
|
|
y: 0, |
|
|
y: 0, |
|
|
x2: 0, |
|
|
x2: 0, |
|
|
y2: 1, |
|
|
y2: 1, |
|
|
colorStops: [{ |
|
|
colorStops: [ |
|
|
offset: 0, color: 'rgba(103, 194, 58, 0.3)' |
|
|
{ |
|
|
}, { |
|
|
offset: 0, |
|
|
offset: 1, color: 'rgba(103, 194, 58, 0.1)' |
|
|
color: 'rgba(103, 194, 58, 0.3)' |
|
|
}] |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
offset: 1, |
|
|
|
|
|
color: 'rgba(103, 194, 58, 0.1)' |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -415,29 +424,36 @@ const initRegistrationChart = async () => { |
|
|
type: 'value', |
|
|
type: 'value', |
|
|
name: '注册用户数' |
|
|
name: '注册用户数' |
|
|
}, |
|
|
}, |
|
|
series: [{ |
|
|
series: [ |
|
|
name: '注册用户', |
|
|
{ |
|
|
type: 'line', |
|
|
name: '注册用户', |
|
|
data: [], |
|
|
type: 'line', |
|
|
smooth: true, |
|
|
data: [], |
|
|
itemStyle: { |
|
|
smooth: true, |
|
|
color: '#E6A23C' |
|
|
itemStyle: { |
|
|
}, |
|
|
color: '#E6A23C' |
|
|
areaStyle: { |
|
|
}, |
|
|
color: { |
|
|
areaStyle: { |
|
|
type: 'linear', |
|
|
color: { |
|
|
x: 0, |
|
|
type: 'linear', |
|
|
y: 0, |
|
|
x: 0, |
|
|
x2: 0, |
|
|
y: 0, |
|
|
y2: 1, |
|
|
x2: 0, |
|
|
colorStops: [{ |
|
|
y2: 1, |
|
|
offset: 0, color: 'rgba(230, 162, 60, 0.3)' |
|
|
colorStops: [ |
|
|
}, { |
|
|
{ |
|
|
offset: 1, color: 'rgba(230, 162, 60, 0.1)' |
|
|
offset: 0, |
|
|
}] |
|
|
color: 'rgba(230, 162, 60, 0.3)' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
offset: 1, |
|
|
|
|
|
color: 'rgba(230, 162, 60, 0.1)' |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}], |
|
|
], |
|
|
grid: { |
|
|
grid: { |
|
|
left: '3%', |
|
|
left: '3%', |
|
|
right: '4%', |
|
|
right: '4%', |
|
|
|