Browse Source

推广素材

zhaoxiaohai 2 years ago
parent
commit
20c82c0921

+ 1 - 1
src/HManagement/archives_ad/dataAnalysis/index.vue

@@ -3,7 +3,7 @@
     <el-tabs v-model="activeName" @tab-click="handleClick">
       <el-tab-pane label="经销商分析" name="first">
         <!-- 分享 -->
-        <!-- <share-data></share-data> -->
+        <share-data />
         <!-- 浏览数据 -->
         <read-data type="agency" />
         <!-- 下载数据 -->

+ 0 - 2
src/HManagement/archives_ad/dataAnalysis/modules/adDownloadData.vue

@@ -117,7 +117,6 @@ export default {
             };
 
             this.$api.requested(params).then(res => {
-                console.log(this.type, "下载", res)
                 if (res.msg != '成功') return this.$message.error(res.data);
                 this.download.params = params;
                 this.download.list = res.data;
@@ -138,7 +137,6 @@ export default {
                 }
             };
             this.$api.requested(params).then(res => {
-                console.log(this.type, "未下载", res)
                 if (res.msg != '成功') return this.$message.error(res.data);
                 this.unDownload.params = params;
                 this.unDownload.list = res.data;

+ 3 - 5
src/HManagement/archives_ad/dataAnalysis/modules/adReadData.vue

@@ -97,7 +97,6 @@ export default {
                 }
             };
             this.$api.requested(params).then(res => {
-                console.log(this.type, "read", res)
                 if (res.msg != '成功') return this.$message.error(res.data);
                 this.readData.params = params;
                 this.readData.list = res.data;
@@ -118,8 +117,6 @@ export default {
                 }
             };
             this.$api.requested(params).then(res => {
-                console.log(this.type, "unread", res)
-
                 if (res.msg != '成功') return this.$message.error(res.data);
                 this.unReadData.params = params;
                 this.unReadData.list = res.data;
@@ -145,7 +142,7 @@ export default {
                 angleField: 'value',
                 colorField: 'type',
                 radius: 0.75,
-                color: ['#FBB33B','#F77655'],
+                color: ['#FBB33B', '#F77655'],
                 legend: {
                     position: 'leftTop'
                 },
@@ -178,9 +175,10 @@ export default {
         }).then(res => {
             if (res.msg != '成功') return this.$message.error(res.data);
             const data = [
-                { type: '未浏览', value: res.data.unreadNum },
+                { type: '未浏览', value: res.data.unReadNum },
                 { type: '已浏览', value: res.data.readNum },
             ];
+
             this.renderer(data);
         })
     }

+ 71 - 36
src/HManagement/archives_ad/dataAnalysis/modules/adShareData.vue

@@ -5,10 +5,11 @@
             <div class="box">
                 <div class="title-box">
                     <div class="title">分享次数</div>
-                    <el-radio-group v-model="tabPosition" style="margin-right:33px;" size="small">
-                        <el-radio-button label="year">年</el-radio-button>
-                        <el-radio-button label="month">月</el-radio-button>
-                        <el-radio-button label="day">日</el-radio-button>
+                    <el-radio-group v-model="tabPosition" style="margin-right:33px;" size="small"
+                        @change="getLineChartOfShare">
+                        <el-radio-button label="1">年</el-radio-button>
+                        <el-radio-button label="2">月</el-radio-button>
+                        <el-radio-button label="3">日</el-radio-button>
                     </el-radio-group>
                 </div>
                 <div id="container" style="width: calc(100% - 33px); height: 374px; margin-top: 40px;"></div>
@@ -28,19 +29,34 @@ export default {
     name: "adShareData",
     data() {
         return {
-            tabPosition: "year",
+            tabPosition: 1,//年月日
         }
     },
     mounted() {
         /* 折线图 */
-        fetch('https://gw.alipayobjects.com/os/bmw-prod/1d565782-dde4-4bb6-8946-ea6a38ccf184.json')
-            .then((res) => res.json())
-            .then((data) => {
+        this.getLineChartOfShare();
+        /* 饼状图 */
+        this.getChannel();
+        /* 表格 */
+        this.getShareData();
+    },
+    methods: {
+        getLineChartOfShare() {
+            this.$api.requested({
+                "classname": "webmanage.saletool.sharematerial.statistics.share",
+                "method": "getLineChartOfShare",
+                "content": {
+                    "sat_sharematerialid": this.$route.query.id,
+                    "date": (new Date()).toLocaleDateString(),
+                    "type": this.tabPosition
+                }
+            }).then(res => {
+                document.getElementById('container').innerHTML = ''
                 const line = new Line('container', {
-                    data,
+                    data: res.data,
                     padding: '0',
-                    xField: 'Date',
-                    yField: 'scales',
+                    xField: 'time',
+                    yField: 'sharecount',
                     xAxis: {
                         // type: 'timeCat',
                         tickCount: 12,
@@ -50,32 +66,51 @@ export default {
                     }
                 });
                 line.render();
-            });
-
-        /* 饼状图 */
-        const data = [
-            { type: '分类一', value: 27 },
-            { type: '分类二', value: 25 },
-        ];
-
-        const piePlot = new Pie('pie', {
-            appendPadding: 10,
-            data,
-            angleField: 'value',
-            colorField: 'type',
-            radius: 0.75,
-            legend: {
-                position: 'leftTop'
-            },
-            label: {
-                type: 'spider',
-                labelHeight: 28,
-                content: '{name}\n{percentage}',
-            },
-            interactions: [{ type: 'element-selected' }, { type: 'element-active' }],
-        });
+            })
+        },
+        getChannel() {
+            this.$api.requested({
+                "classname": "webmanage.saletool.sharematerial.statistics.share",
+                "method": "getChannel",
+                "content": {
+                    "sat_sharematerialid": this.$route.query.id
+                }
+            }).then(res => {
+                const piePlot = new Pie('pie', {
+                    appendPadding: 10,
+                    data: res.data,
+                    angleField: 'sharecount',
+                    colorField: 'channel',
+                    radius: 0.75,
+                    color: ['#E263CD', '#F77655'],
+                    legend: {
+                        position: 'leftTop'
+                    },
+                    label: {
+                        type: 'spider',
+                        labelHeight: 28,
+                        content: '{name}\n{percentage}',
+                    },
+                    interactions: [{ type: 'element-selected' }, { type: 'element-active' }],
+                });
 
-        piePlot.render();
+                piePlot.render();
+            })
+        },
+        getShareData() {
+            this.$api.requested({
+                "classname": "webmanage.saletool.sharematerial.statistics.share",
+                "method": "getShareData",
+                "content": {
+                    "sat_sharematerialid": this.$route.query.id,
+                    "isAll": false,
+                    "pageNumber": 1,
+                    "pageSize": 10
+                }
+            }).then(res => {
+                console.log("sdsdsds",res)
+            })
+        }
     }
 }
 </script>