diff --git a/src/views/PlatformData/UserActivityStats.vue b/src/views/PlatformData/UserActivityStats.vue
index 9bc6664..a6c532d 100644
--- a/src/views/PlatformData/UserActivityStats.vue
+++ b/src/views/PlatformData/UserActivityStats.vue
@@ -140,6 +140,11 @@
/>
+
+
+
+ 数据刷新时间:{{ lastUpdateTime }}
+
@@ -158,6 +163,7 @@ const chartDateRange = ref('');
const chartMode = ref(route.query.mode || 'day'); // day, week, month
const chartRef = ref(null);
let chartInstance = null;
+const lastUpdateTime = ref('');
// 初始化 URL 参数
const initQueryParams = () => {
@@ -208,6 +214,13 @@ const formatDate = (date) => {
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
};
+const formatDateTime = (date) => {
+ if (!date) return '';
+ const d = new Date(date);
+ const pad = (n) => n < 10 ? '0' + n : n;
+ return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
+};
+
const fetchChartData = async () => {
const params = {
mode: chartMode.value
@@ -226,6 +239,7 @@ const fetchChartData = async () => {
if (Array.isArray(data)) {
updateChart(data);
}
+ lastUpdateTime.value = formatDateTime(new Date());
} catch (e) {
console.error('获取DeepChart趋势数据失败:', e);
}
@@ -479,6 +493,7 @@ const fetchTableData = async () => {
tableData.value = [];
total.value = 0;
}
+ lastUpdateTime.value = formatDateTime(new Date());
} catch (e) {
console.error('获取DeepChart活跃用户明细失败:', e);
}
@@ -602,4 +617,17 @@ onMounted(() => {
color: #606266;
margin-right: 20px;
}
+
+.refresh-time {
+ position: fixed;
+ bottom: 20px;
+ right: 20px;
+ background: rgba(0, 0, 0, 0.6);
+ color: #fff;
+ padding: 8px 15px;
+ border-radius: 20px;
+ font-size: 12px;
+ z-index: 2000;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+}
diff --git a/src/views/PlatformData/UserLoginStats.vue b/src/views/PlatformData/UserLoginStats.vue
index b3ea850..87ebefc 100644
--- a/src/views/PlatformData/UserLoginStats.vue
+++ b/src/views/PlatformData/UserLoginStats.vue
@@ -231,6 +231,11 @@
+
+
+
+ 数据刷新时间:{{ lastUpdateTime }}
+
@@ -251,6 +256,7 @@ const searchRegion = ref('');
const dateRangeRegion = ref('');
const loading = ref(false);
const loadingRegion = ref(false);
+const lastUpdateTime = ref('');
const chartTrendRef = ref(null);
let chartTrendInstance = null;
@@ -352,6 +358,13 @@ const formatDate = (date) => {
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
};
+const formatDateTime = (date) => {
+ if (!date) return '';
+ const d = new Date(date);
+ const pad = (n) => n < 10 ? '0' + n : n;
+ return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
+};
+
const fetchLoginData = async () => {
let params = {};
if (dateRange.value && dateRange.value.length === 2) {
@@ -552,6 +565,7 @@ const fetchAllLoginData = async () => {
fetchLoginChannelMemberData(),
fetchLoginChannelNoMemberData()
]);
+ lastUpdateTime.value = formatDateTime(new Date());
} catch (error) {
console.error('获取登录数据失败:', error);
} finally {
@@ -647,6 +661,7 @@ const fetchAllRegionData = async () => {
fetchRegionHistogramData(),
fetchRegionDistributionData()
]);
+ lastUpdateTime.value = formatDateTime(new Date());
} catch (error) {
console.error('获取地区数据失败:', error);
} finally {
@@ -1289,4 +1304,17 @@ onMounted(() => {
width: 100%;
height: 300px;
}
+
+.refresh-time {
+ position: fixed;
+ bottom: 20px;
+ right: 20px;
+ background: rgba(0, 0, 0, 0.6);
+ color: #fff;
+ padding: 8px 15px;
+ border-radius: 20px;
+ font-size: 12px;
+ z-index: 2000;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+}
diff --git a/src/views/PlatformData/UserOverview.vue b/src/views/PlatformData/UserOverview.vue
index bd06649..00be3e4 100644
--- a/src/views/PlatformData/UserOverview.vue
+++ b/src/views/PlatformData/UserOverview.vue
@@ -183,6 +183,10 @@
+
+
+ 数据刷新时间:{{ lastUpdateTime }}
+
@@ -199,6 +203,7 @@ const router = useRouter();
const activeTab = ref(route.query.tab || 'overview');
const dateRange = ref('');
const loading = ref(false);
+const lastUpdateTime = ref('');
const hasDateRange = computed(() => {
return dateRange.value && dateRange.value.length === 2;
@@ -277,6 +282,7 @@ const fetchData = async () => {
overviewData.value = res.list;
initCharts();
isOverviewLoaded.value = true;
+ lastUpdateTime.value = formatDate(new Date());
}
} catch (error) {
console.error('获取用户概览数据失败:', error);
@@ -352,6 +358,7 @@ const fetchDetailData = async (forceUpdate = false) => {
}
isDetailLoaded.value = true;
+ lastUpdateTime.value = formatDate(new Date());
}
} catch(e) {
console.error('获取数据明细失败:', e);
@@ -849,4 +856,17 @@ onMounted(() => {
width: 100%;
height: 350px;
}
+
+.refresh-time {
+ position: fixed;
+ bottom: 20px;
+ right: 20px;
+ background: rgba(0, 0, 0, 0.6);
+ color: #fff;
+ padding: 8px 15px;
+ border-radius: 20px;
+ font-size: 12px;
+ z-index: 2000;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+}