diff --git a/src/api/platformData.js b/src/api/platformData.js
index 8bcd80f..8777821 100644
--- a/src/api/platformData.js
+++ b/src/api/platformData.js
@@ -109,6 +109,29 @@ export function getUserLoginChannel(params) {
})
}
+// 获取会员登录数据(渠道分布)
+export function getUserLoginChannelMember(params) {
+ const formData = new FormData();
+ formData.append('token', localStorage.getItem('token'));
+ if (params) {
+ if (params.region) formData.append('region', params.region);
+ if (params.start_time) formData.append('start_time', params.start_time);
+ if (params.end_time) formData.append('end_time', params.end_time);
+ }
+
+ return request({
+ url: 'http://7a1b8c9e.r40.cpolar.top/admin/user/login/ChannelMember',
+ method: 'post',
+ headers: {
+ 'token': localStorage.getItem('token'),
+ 'client': 'ios',
+ 'version': '1',
+ 'Content-Type': 'multipart/form-data'
+ },
+ data: formData
+ })
+}
+
// 获取用户登录趋势数据
export function getUserLoginTrend(params) {
const formData = new FormData();
diff --git a/src/views/PlatformData/UserLoginStats.vue b/src/views/PlatformData/UserLoginStats.vue
index f813e6f..e2daab9 100644
--- a/src/views/PlatformData/UserLoginStats.vue
+++ b/src/views/PlatformData/UserLoginStats.vue
@@ -109,10 +109,10 @@
-
会员登录数据
+
{{ statsTitle }}会员登录数据
-
+
@@ -223,7 +223,7 @@
import { ref, onMounted, nextTick, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import * as echarts from 'echarts';
-import { getUserLoginList, getUserLoginTrend, getRegionActiveData, getRegionActiveDataHistogram, getUserLoginChannel } from '../../api/platformData';
+import { getUserLoginList, getUserLoginTrend, getRegionActiveData, getRegionActiveDataHistogram, getUserLoginChannel, getUserLoginChannelMember } from '../../api/platformData';
const route = useRoute();
const router = useRouter();
@@ -436,6 +436,37 @@ const fetchLoginChannelData = async () => {
}
};
+const fetchLoginChannelMemberData = async () => {
+ let params = {};
+ if (dateRange.value && dateRange.value.length === 2) {
+ params.start_time = formatDate(dateRange.value[0]);
+ params.end_time = formatDate(dateRange.value[1]);
+ }
+
+ if (selectedRegion.value && selectedRegion.value !== 'all') {
+ params.region = selectedRegion.value;
+ }
+
+ try {
+ const res = await getUserLoginChannelMember(params);
+ console.log("获取会员登录渠道数据响应:", res);
+
+ // 兼容处理拦截器
+ const data = res.list ? res : (res.data && res.data.list ? res.data : null);
+
+ if (data && data.list) {
+ loginTableData2.value = data.list.map(item => ({
+ channel: item.source,
+ total: item.today_count,
+ dailyNew: item.growth_value,
+ rate: item.ratio + '%'
+ }));
+ }
+ } catch (e) {
+ console.error('获取会员登录渠道数据失败:', e);
+ }
+};
+
const handleSearch = () => {
// 更新 URL 参数
const query = { ...route.query };
@@ -458,6 +489,8 @@ const handleSearch = () => {
fetchTrendData();
fetchLoginData();
+ fetchLoginChannelData();
+ fetchLoginChannelMemberData();
};
const handleReset = () => {
@@ -474,6 +507,7 @@ const handleReset = () => {
fetchTrendData();
fetchLoginData();
fetchLoginChannelData();
+ fetchLoginChannelMemberData();
};
const fetchRegionActiveData = async () => {
@@ -683,13 +717,7 @@ const handleResetRegion = () => {
// Tab 1 数据
const loginTableData1 = ref([]);
-const loginTableData2 = [
- { channel: 'App Store', total: '1,245', dailyNew: '', rate: '38%' },
- { channel: 'Play Store', total: '987', dailyNew: '', rate: '30%' },
- { channel: 'H5', total: '543', dailyNew: '', rate: '17%' },
- { channel: 'APK', total: '321', dailyNew: '', rate: '10%' },
- { channel: '总计', total: '3,096', dailyNew: '', rate: '100%' },
-];
+const loginTableData2 = ref([]);
const loginTableData3 = [
{ channel: 'App Store', total: '1,245', dailyNew: '', rate: '38%' },
@@ -832,6 +860,7 @@ onMounted(() => {
if (activeTab.value === 'loginData') {
fetchLoginData();
fetchLoginChannelData();
+ fetchLoginChannelMemberData();
}
initCharts();
});