|
@@ -288,7 +288,9 @@ const loadRecentEvents = async () => {
|
|
try {
|
|
try {
|
|
const res = await listGameEvent({
|
|
const res = await listGameEvent({
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
- pageSize: 4
|
|
|
|
|
|
+ pageSize: 4,
|
|
|
|
+ orderByColumn: 'update_time',
|
|
|
|
+ isAsc: 'desc'
|
|
});
|
|
});
|
|
if (res.code === 200 && res.total > 0) {
|
|
if (res.code === 200 && res.total > 0) {
|
|
recentEvents.value = res.rows;
|
|
recentEvents.value = res.rows;
|
|
@@ -309,7 +311,9 @@ const loadNotice = async () => {
|
|
noticeTitle: undefined,
|
|
noticeTitle: undefined,
|
|
createByName: undefined,
|
|
createByName: undefined,
|
|
status: undefined,
|
|
status: undefined,
|
|
- noticeType: undefined
|
|
|
|
|
|
+ noticeType: undefined,
|
|
|
|
+ orderByColumn: 'update_time',
|
|
|
|
+ isAsc: 'desc'
|
|
});
|
|
});
|
|
if (res.code === 200 && res.total > 0) {
|
|
if (res.code === 200 && res.total > 0) {
|
|
systemNotices.value = res.rows;
|
|
systemNotices.value = res.rows;
|
|
@@ -324,35 +328,25 @@ const loadNotice = async () => {
|
|
*/
|
|
*/
|
|
const loadEventStatus = async () => {
|
|
const loadEventStatus = async () => {
|
|
try {
|
|
try {
|
|
- const res = await listGameEvent({
|
|
|
|
- pageNum: 1,
|
|
|
|
- pageSize: 1000 // 获取所有数据来统计
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- if (res.code === 200 && res.rows) {
|
|
|
|
- const now = new Date();
|
|
|
|
- let upcoming = 0, ongoing = 0, completed = 0;
|
|
|
|
-
|
|
|
|
- res.rows.forEach(event => {
|
|
|
|
- const startTime = new Date(event.startTime);
|
|
|
|
- const endTime = new Date(event.endTime);
|
|
|
|
-
|
|
|
|
- if (now < startTime) {
|
|
|
|
- upcoming++;
|
|
|
|
- } else if (now >= startTime && now <= endTime) {
|
|
|
|
- ongoing++;
|
|
|
|
- } else {
|
|
|
|
- completed++;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- eventStatus.value = {
|
|
|
|
- upcoming,
|
|
|
|
- ongoing,
|
|
|
|
- completed,
|
|
|
|
- total: res.total || res.rows.length
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
|
|
+ let upcoming = 0,
|
|
|
|
+ ongoing = 0,
|
|
|
|
+ completed = 0,
|
|
|
|
+ total = 0;
|
|
|
|
+ let res = await getEventCount(0);
|
|
|
|
+ total = res.data;
|
|
|
|
+ res = await getEventCount(1);
|
|
|
|
+ upcoming = res.data;
|
|
|
|
+ res = await getEventCount(2);
|
|
|
|
+ ongoing = res.data;
|
|
|
|
+ res = await getEventCount(3);
|
|
|
|
+ completed = res.data;
|
|
|
|
+
|
|
|
|
+ eventStatus.value = {
|
|
|
|
+ upcoming,
|
|
|
|
+ ongoing,
|
|
|
|
+ completed,
|
|
|
|
+ total
|
|
|
|
+ };
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error('加载赛事状态失败:', error);
|
|
console.error('加载赛事状态失败:', error);
|
|
}
|
|
}
|
|
@@ -364,7 +358,7 @@ const loadEventStatus = async () => {
|
|
const loadStatistics = async () => {
|
|
const loadStatistics = async () => {
|
|
try {
|
|
try {
|
|
// 并行请求所有统计接口
|
|
// 并行请求所有统计接口
|
|
- const results = await Promise.allSettled([getArticleCount(), getTeamCount(), getEventCount(), getEventProjectCount(), getRefereeCount()]);
|
|
|
|
|
|
+ const results = await Promise.allSettled([getArticleCount(), getTeamCount(), getEventCount(0), getEventProjectCount(), getRefereeCount()]);
|
|
|
|
|
|
let hasError = false;
|
|
let hasError = false;
|
|
|
|
|
|
@@ -448,7 +442,6 @@ const loadStatistics = async () => {
|
|
|
|
|
|
const initCharts = () => {
|
|
const initCharts = () => {
|
|
initPieChart();
|
|
initPieChart();
|
|
- initLineChart();
|
|
|
|
};
|
|
};
|
|
|
|
|
|
const initPieChart = () => {
|
|
const initPieChart = () => {
|
|
@@ -489,50 +482,6 @@ const initPieChart = () => {
|
|
myChart.setOption(option);
|
|
myChart.setOption(option);
|
|
};
|
|
};
|
|
|
|
|
|
-const initLineChart = () => {
|
|
|
|
- const chartDom = document.getElementById('lineChart');
|
|
|
|
- if (!chartDom) return;
|
|
|
|
-
|
|
|
|
- const myChart = echarts.init(chartDom);
|
|
|
|
- const option = {
|
|
|
|
- tooltip: {
|
|
|
|
- trigger: 'axis'
|
|
|
|
- },
|
|
|
|
- legend: {
|
|
|
|
- data: ['注册数量', '赛事数量']
|
|
|
|
- },
|
|
|
|
- grid: {
|
|
|
|
- left: '3%',
|
|
|
|
- right: '4%',
|
|
|
|
- bottom: '3%',
|
|
|
|
- containLabel: true
|
|
|
|
- },
|
|
|
|
- xAxis: {
|
|
|
|
- type: 'category',
|
|
|
|
- boundaryGap: false,
|
|
|
|
- data: ['1月', '2月', '3月', '4月', '5月', '6月']
|
|
|
|
- },
|
|
|
|
- yAxis: {
|
|
|
|
- type: 'value'
|
|
|
|
- },
|
|
|
|
- series: [
|
|
|
|
- {
|
|
|
|
- name: '注册数量',
|
|
|
|
- type: 'line',
|
|
|
|
- stack: 'Total',
|
|
|
|
- data: [120, 132, 101, 134, 90, 230]
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '赛事数量',
|
|
|
|
- type: 'line',
|
|
|
|
- stack: 'Total',
|
|
|
|
- data: [220, 182, 191, 234, 290, 330]
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- };
|
|
|
|
- myChart.setOption(option);
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
const handleQuickAction = (action: string) => {
|
|
const handleQuickAction = (action: string) => {
|
|
switch (action) {
|
|
switch (action) {
|
|
case 'addEvent':
|
|
case 'addEvent':
|