更新welcome

This commit is contained in:
云泽网
2025-05-19 22:38:27 +08:00
parent e65f150df7
commit 1840d6f8aa
5 changed files with 926 additions and 122 deletions
+64 -29
View File
@@ -211,22 +211,22 @@
<div class="stats-container">
<div class="stat-card">
<div class="stat-title">用户总数</div>
<div class="stat-value">{$stats.total_users|number_format}</div>
<div class="stat-value">{$todayStats.total_users|number_format}</div>
<div class="stat-icon">👥</div>
</div>
<div class="stat-card">
<div class="stat-title">今日访问</div>
<div class="stat-value">{$stats.daily_visits|number_format}</div>
<div class="stat-value">{$todayStats.daily_visits|number_format}</div>
<div class="stat-icon">📊</div>
</div>
<div class="stat-card">
<div class="stat-title">文章总数</div>
<div class="stat-value">{$stats.total_articles|number_format}</div>
<div class="stat-value">{$todayStats.total_articles|number_format}</div>
<div class="stat-icon">📝</div>
</div>
<div class="stat-card">
<div class="stat-title">资源总数</div>
<div class="stat-value">{$stats.total_resources|number_format}</div>
<div class="stat-value">{$todayStats.total_resources|number_format}</div>
<div class="stat-icon">📦</div>
</div>
</div>
@@ -504,7 +504,6 @@ function initVisitTrend() {
// 用户增长图表
function initUserGrowth() {
var chart = echarts.init(document.getElementById('userGrowth'));
window.userChart = chart;
var option = {
tooltip: {
trigger: 'axis',
@@ -527,7 +526,7 @@ function initUserGrowth() {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
data: {$chartData.userGrowth.dates|json_encode}
},
yAxis: {
type: 'value'
@@ -536,7 +535,7 @@ function initUserGrowth() {
{
name: '新增用户',
type: 'bar',
data: [],
data: {$chartData.userGrowth.newUsers|json_encode},
itemStyle: {
color: '#3881fd'
}
@@ -545,7 +544,7 @@ function initUserGrowth() {
name: '总用户数',
type: 'line',
smooth: true,
data: [],
data: {$chartData.userGrowth.totalUsers|json_encode},
itemStyle: {
color: '#10b981'
},
@@ -561,7 +560,6 @@ function initUserGrowth() {
// 资源统计图表
function initResourceStats() {
var chart = echarts.init(document.getElementById('resourceStats'));
window.resourceChart = chart;
var option = {
tooltip: {
trigger: 'axis',
@@ -573,7 +571,7 @@ function initResourceStats() {
}
},
legend: {
data: ['新增资源', '总资源数']
data: ['新增资源', '总资源数', '下载量']
},
grid: {
left: '3%',
@@ -584,7 +582,7 @@ function initResourceStats() {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
data: {$chartData.resourceStats.dates|json_encode}
},
yAxis: {
type: 'value'
@@ -593,7 +591,7 @@ function initResourceStats() {
{
name: '新增资源',
type: 'bar',
data: [],
data: {$chartData.resourceStats.newResources|json_encode},
itemStyle: {
color: '#3881fd'
}
@@ -602,13 +600,25 @@ function initResourceStats() {
name: '总资源数',
type: 'line',
smooth: true,
data: [],
data: {$chartData.resourceStats.totalResources|json_encode},
itemStyle: {
color: '#10b981'
},
lineStyle: {
width: 3
}
},
{
name: '下载量',
type: 'line',
smooth: true,
data: {$chartData.resourceStats.downloads|json_encode},
itemStyle: {
color: '#f59e0b'
},
lineStyle: {
width: 3
}
}
]
};
@@ -618,7 +628,6 @@ function initResourceStats() {
// 文章统计图表
function initArticleStats() {
var chart = echarts.init(document.getElementById('articleStats'));
window.articleChart = chart;
var option = {
tooltip: {
trigger: 'axis',
@@ -630,7 +639,7 @@ function initArticleStats() {
}
},
legend: {
data: ['新增文章', '总文章数']
data: ['新增文章', '总文章数', '浏览量']
},
grid: {
left: '3%',
@@ -641,7 +650,7 @@ function initArticleStats() {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
data: {$chartData.articleStats.dates|json_encode}
},
yAxis: {
type: 'value'
@@ -650,7 +659,7 @@ function initArticleStats() {
{
name: '新增文章',
type: 'bar',
data: [],
data: {$chartData.articleStats.newArticles|json_encode},
itemStyle: {
color: '#3881fd'
}
@@ -659,13 +668,25 @@ function initArticleStats() {
name: '总文章数',
type: 'line',
smooth: true,
data: [],
data: {$chartData.articleStats.totalArticles|json_encode},
itemStyle: {
color: '#10b981'
},
lineStyle: {
width: 3
}
},
{
name: '浏览量',
type: 'line',
smooth: true,
data: {$chartData.articleStats.views|json_encode},
itemStyle: {
color: '#f59e0b'
},
lineStyle: {
width: 3
}
}
]
};
@@ -674,18 +695,32 @@ function initArticleStats() {
// 初始化所有图表
document.addEventListener('DOMContentLoaded', function() {
initVisitTrend();
initUserGrowth();
initResourceStats();
initArticleStats();
// 监听窗口大小变化,重绘图表
window.addEventListener('resize', function() {
var charts = document.querySelectorAll('.chart-container');
charts.forEach(function(chart) {
echarts.getInstanceByDom(chart)?.resize();
// 确保ECharts已加载
if (typeof echarts === 'undefined') {
console.error('ECharts未加载');
return;
}
// 初始化图表
try {
initVisitTrend();
initUserGrowth();
initResourceStats();
initArticleStats();
// 监听窗口大小变化,重绘图表
window.addEventListener('resize', function() {
var charts = document.querySelectorAll('.chart-container');
charts.forEach(function(chart) {
var instance = echarts.getInstanceByDom(chart);
if (instance) {
instance.resize();
}
});
});
});
} catch (error) {
console.error('初始化图表失败:', error);
}
});
</script>