Browse Source

流量分析重构

zq940222 5 months ago
parent
commit
755d0f5d75
1 changed files with 15 additions and 36 deletions
  1. 15 36
      src/views/adweb/data/trafficAnalysis.vue

+ 15 - 36
src/views/adweb/data/trafficAnalysis.vue

@@ -194,16 +194,8 @@
                       {{ record.type.split("/")[1] }}
                     </a-popover>
                   </template>
-                  <template v-if="column.key === 'avgPageNumSlot' ">
-                    <span
-                      style="margin-left: 20px;"></span>{{ record.pageViewsPerSession * record.sessions
-                    }}
-                  </template>
-                  <template v-if="column.key === 'centerSlot' ">
-                    <span style="margin-left: 20px;">{{ text }}</span>
-                  </template>
                   <template v-if="column.key === 'avgSessionDurationSlot' ">
-                    <span style="margin-left: 30px;">{{ text }} s</span>
+                    <span style="margin-left: 30px;">{{ record.avgSessionDuration }} s</span>
                   </template>
                 </template>
 
@@ -293,12 +285,14 @@ const chartDetailDataCol = ref([
 const mediaListColumns = ref([
   {
     title: "来源",
+    key: "typeSlotFirst",
     scopedSlots: {
       customRender: "typeSlotFirst"
     }
   },
   {
     title: "媒介",
+    key: "typeSlotLast",
     scopedSlots: {
       filterDropdown: "filterDropdown",
       filterIcon: "filterIcon",
@@ -307,54 +301,39 @@ const mediaListColumns = ref([
   },
   {
     title: "访客数(UV)",
-    dataIndex: "users",
-    defaultSortOrder: "descend",
-    sorter: (a, b) => a.users - b.users,
-    scopedSlots: {
-      customRender: "centerSlot"
-    }
+    dataIndex: "totalUsers",
   },
   {
     title: "占比",
-    dataIndex: "userProportion"
+    dataIndex: "totalUsersProportion"
   },
   {
     title: "新访客数",
     dataIndex: "newUsers",
-    sortDirections: ["descend", "ascend"],
-    sorter: (a, b) => a.newUsers - b.newUsers,
-    scopedSlots: {
-      customRender: "centerSlot"
-    }
   },
   {
     title: "新客占比",
-    customRender: function(text, record, index) {
-      return (record.newUsers * 100 / record.users).toFixed(2) + " %";
-    }
+    dataIndex: "newUsersRatio"
   },
   {
     title: "浏览量(PV)",
-    scopedSlots: {
-      customRender: "avgPageNumSlot"
-    }
+    dataIndex: "pageViews",
   },
   {
     title: "平均访问页面数",
     dataIndex: "pageViewsPerSession",
-    sortDirections: ["descend", "ascend"],
-    sorter: (a, b) => a.pageviewsPerSession - b.pageviewsPerSession,
-    scopedSlots: {
-      customRender: "centerSlot"
-    }
+  },
+  {
+    title: "会话数",
+    dataIndex: "sessions",
   },
   {
     title: "平均会话时长",
-    dataIndex: "avgSessionDuration",
-    sortDirections: ["descend", "ascend"],
+    key: "avgSessionDurationSlot",
+    sortDirections: ['descend', 'ascend'],
     sorter: (a, b) => a.avgSessionDuration - b.avgSessionDuration,
     scopedSlots: {
-      customRender: "avgSessionDurationSlot"
+      customRender: 'avgSessionDurationSlot',
     }
   }
 ]);
@@ -504,7 +483,7 @@ const mediaDatasource = ref([]);
 //来源媒介列表、最多访问top10列表
 const getMediaList = async () => {
   try {
-    const res = await getAction("/datacenter/sourcemedia/list", queryParam);
+    const res = await getAction("/ga-data/source-medium/stats", queryParam);
     if (res.code == 200) {
       mediaDatasource.value = res.result;
     } else {