diff --git a/src/api/platformData.js b/src/api/platformData.js
index 4e1ae62..c0fd908 100644
--- a/src/api/platformData.js
+++ b/src/api/platformData.js
@@ -246,3 +246,48 @@ export function getUserDeepChartTrend(params) {
data: formData
})
}
+
+// 获取DeepChart活跃用户明细
+export function getDeepChartActiveUserList(params) {
+ const formData = new FormData();
+ formData.append('token', localStorage.getItem('token'));
+ if (params) {
+ if (params.page) formData.append('page', params.page);
+ if (params.page_size) formData.append('page_size', params.page_size);
+ if (params.jwcode) formData.append('jwcode', params.jwcode);
+ if (params.region && params.region !== 'all') formData.append('region', params.region);
+ if (params.startTime) formData.append('startTime', params.startTime);
+ if (params.endTime) formData.append('endTime', params.endTime);
+ if (params.isExport) formData.append('isExport', params.isExport);
+ }
+
+ return request({
+ url: 'https://16866f84.r7.cpolar.top/admin/user/active/list',
+ method: 'post',
+ headers: {
+ 'token': localStorage.getItem('token'),
+ 'client': 'ios',
+ 'version': '1',
+ 'Content-Type': 'multipart/form-data'
+ },
+ data: formData
+ })
+}
+
+// 获取地区列表
+export function getRegionsList() {
+ const formData = new FormData();
+ formData.append('token', localStorage.getItem('token'));
+
+ return request({
+ url: 'https://16866f84.r7.cpolar.top/admin/regions/list',
+ method: 'post',
+ headers: {
+ 'token': localStorage.getItem('token'),
+ 'client': 'ios',
+ 'version': '1',
+ 'Content-Type': 'multipart/form-data'
+ },
+ data: formData
+ })
+}
diff --git a/src/views/PlatformData/UserActivityStats.vue b/src/views/PlatformData/UserActivityStats.vue
index faeb1c3..46c7a12 100644
--- a/src/views/PlatformData/UserActivityStats.vue
+++ b/src/views/PlatformData/UserActivityStats.vue
@@ -43,6 +43,12 @@
+
- 搜索
- 重置
+ 搜索
+ 重置
数据导出
查看导出列表
@@ -69,19 +75,23 @@
-
-
+
+
+
+
@@ -92,7 +102,7 @@
import { ref, onMounted, nextTick, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import * as echarts from 'echarts';
-import { getUserDeepChartTrend } from '../../api/platformData';
+import { getUserDeepChartTrend, getDeepChartActiveUserList, getRegionsList } from '../../api/platformData';
const route = useRoute();
const router = useRouter();
@@ -256,21 +266,106 @@ const tableAccount = ref('');
const tableRegion = ref('');
const tableDateRange = ref('');
const currentPage = ref(1);
-const pageSize = ref(50);
+const pageSize = ref(10);
+const total = ref(0);
+const regionOptions = ref([]);
+
+// 获取地区列表
+const fetchRegionOptions = async () => {
+ try {
+ const res = await getRegionsList();
+ console.log("获取地区列表响应:", res);
+ const data = res.data || res;
+ if (data && data.list) {
+ regionOptions.value = data.list.map(region => ({ label: region, value: region }));
+ }
+ } catch (e) {
+ console.error('获取地区列表失败:', e);
+ }
+};
// 表格数据
-const tableData = ref([
- { index: 1, account: 'DC900480004', name: 'Thea Elowen Hale', region: '中国', loginCount: 99, totalDuration: '99小时99分钟99秒', avgDuration: '99小时99分钟99秒', deepMate: '99小时99分钟99秒', deepExplore: '99小时99分钟99秒' },
- { index: 2, account: 'DC900480004', name: '欧帝三萃', region: '美国', loginCount: 99, totalDuration: '99小时99分钟99秒', avgDuration: '99小时99分钟99秒', deepMate: '99小时99分钟99秒', deepExplore: '99小时99分钟99秒' },
- { index: 3, account: 'DC900480004', name: 'Thea Elowen Hale', region: '新加坡', loginCount: 99, totalDuration: '99小时99分钟99秒', avgDuration: '99小时99分钟99秒', deepMate: '99小时99分钟99秒', deepExplore: '99小时99分钟99秒' },
- { index: 4, account: 'DC900480004', name: 'viên แก้ว หลาว', region: '泰国', loginCount: 99, totalDuration: '99小时99分钟99秒', avgDuration: '99小时99分钟99秒', deepMate: '99小时99分钟99秒', deepExplore: '99小时99分钟99秒' },
- { index: 5, account: 'DC900480004', name: 'viên แก้ว หลาว', region: '越南', loginCount: 99, totalDuration: '99小时99分钟99秒', avgDuration: '99小时99分钟99秒', deepMate: '99小时99分钟99秒', deepExplore: '99小时99分钟99秒' },
- { index: 6, account: 'DC900480004', name: 'Cien Yong Hao', region: '中国', loginCount: 9999, totalDuration: '99小时99分钟99秒', avgDuration: '99小时99分钟99秒', deepMate: '99小时99分钟99秒', deepExplore: '99小时99分钟99秒' },
- { index: 7, account: 'DC900480004', name: 'Cien Yong Hao', region: '美国', loginCount: 999, totalDuration: '99小时99分钟99秒', avgDuration: '99小时99分钟99秒', deepMate: '99小时99分钟99秒', deepExplore: '99小时99分钟99秒' },
- { index: 8, account: 'DC900480004', name: 'Tiên Linh Vinh Hảo', region: '新加坡', loginCount: 999, totalDuration: '99小时99分钟99秒', avgDuration: '99小时99分钟99秒', deepMate: '99小时99分钟99秒', deepExplore: '99小时99分钟99秒' },
- { index: 9, account: 'DC900480004', name: 'Tiên Linh Vinh Hảo', region: '新加坡', loginCount: 999, totalDuration: '99小时99分钟99秒', avgDuration: '99小时99分钟99秒', deepMate: '99小时99分钟99秒', deepExplore: '99小时99分钟99秒' },
- { index: 10, account: 'DC900480004', name: 'Tiên Linh Vinh Hảo', region: '香港', loginCount: 999, totalDuration: '99小时99分钟99秒', avgDuration: '99小时99分钟99秒', deepMate: '99小时99分钟99秒', deepExplore: '99小时99分钟99秒' },
-]);
+const tableData = ref([]);
+
+const handleTableSearch = () => {
+ currentPage.value = 1;
+ fetchTableData();
+};
+
+const handleTableReset = () => {
+ tableAccount.value = '';
+ tableRegion.value = '';
+ tableDateRange.value = '';
+ currentPage.value = 1;
+ fetchTableData();
+};
+
+const handlePageChange = (page) => {
+ currentPage.value = page;
+ fetchTableData();
+};
+
+const handleSizeChange = (size) => {
+ pageSize.value = size;
+ currentPage.value = 1;
+ fetchTableData();
+};
+
+const fetchTableData = async () => {
+ const params = {
+ page: currentPage.value,
+ page_size: pageSize.value
+ };
+
+ if (tableAccount.value) params.jwcode = tableAccount.value;
+ if (tableRegion.value && tableRegion.value !== 'all') params.region = tableRegion.value;
+
+ if (tableDateRange.value && tableDateRange.value.length === 2) {
+ params.startTime = formatDate(tableDateRange.value[0]);
+ params.endTime = formatDate(tableDateRange.value[1]);
+ }
+
+ try {
+ const res = await getDeepChartActiveUserList(params);
+ console.log("获取DeepChart活跃用户明细响应:", res);
+ const data = res.data || res; // 兼容处理
+
+ if (data && data.list) {
+ tableData.value = data.list.map((item, index) => ({
+ index: (currentPage.value - 1) * pageSize.value + index + 1,
+ account: item.jwcode,
+ name: item.username,
+ region: item.region,
+ loginCount: item.login_count,
+ totalDuration: formatDuration(item.stay_time),
+ avgDuration: formatDuration(item.avg_stay_time),
+ deepMate: item.deepmate_count,
+ deepExplore: item.dive_seek_count,
+ marketInfo: item.market_info_count, // 行情登录次数
+ updateTime: item.update_time // 使用 update_time
+ }));
+ total.value = data.total || 0;
+ } else {
+ tableData.value = [];
+ total.value = 0;
+ }
+ } catch (e) {
+ console.error('获取DeepChart活跃用户明细失败:', e);
+ }
+};
+
+// 格式化时长 (秒 -> 时分秒)
+const formatDuration = (seconds) => {
+ if (!seconds) return '0秒';
+ const h = Math.floor(seconds / 3600);
+ const m = Math.floor((seconds % 3600) / 60);
+ const s = seconds % 60;
+ let str = '';
+ if (h > 0) str += `${h}小时`;
+ if (m > 0) str += `${m}分钟`;
+ if (s > 0) str += `${s}秒`;
+ return str || '0秒';
+};
const headerCellStyle = {
background: '#f5f7fa',
@@ -292,6 +387,8 @@ const initChart = () => {
onMounted(() => {
nextTick(() => {
initChart();
+ fetchTableData();
+ fetchRegionOptions();
});
});