liyongli 2 gadi atpakaļ
vecāks
revīzija
949c132911
1 mainītis faili ar 68 papildinājumiem un 23 dzēšanām
  1. 68 23
      src/views/report/Mobile/index.vue

+ 68 - 23
src/views/report/Mobile/index.vue

@@ -9,9 +9,9 @@
           <van-row>
             <van-col span="3" class="td"> 排名 </van-col>
             <van-col span="5" class="td"> 部门 </van-col>
-            <van-col span="7" class="td"> 传播量 </van-col>
+            <van-col span="7" class="td"> 传播量(次) </van-col>
             <!-- td2 :style="width > 667 ? 'line-height: 2.5em' : 'line-height: 1.5em'" -->
-            <van-col span="5" class="td"> 发稿量 </van-col>
+            <van-col span="5" class="td"> 发稿量(件) </van-col>
             <van-col span="4" class="td">
               <img
                 src="../../../assets/image/shou.gif"
@@ -119,6 +119,43 @@
                 >{{ ratios.read_countWei }}
               </van-col>
             </van-row>
+            <van-cell-group border title="平台账号">
+              <van-tabs v-model="active">
+                <van-tab
+                  :title="index"
+                  v-for="(item, index) in ratios.detail"
+                  :key="index"
+                >
+                  <van-cell
+                    v-for="(v, i) in item || []"
+                    :key="i + v.nick_name"
+                    title-style="flex: 3"
+                    :title="v.nick_name"
+                    :label="ratios.channelname"
+                  >
+                    <template #label>
+                      <div style="font-size: 14px; color: #000">
+                        发稿量:{{ timeFormat(v.publish_count) }}件 阅读量:{{
+                          timeFormat(v.read_count)
+                        }}次 环比:<counto
+                          :startVal="0"
+                          :endVal="v.huanbi1 || 0"
+                          :duration="1000"
+                        ></counto>
+                        <span v-if="v.huanbi1P">.</span>
+                        <counto
+                          v-if="v.huanbi1P"
+                          :startVal="0"
+                          :endVal="v.huanbi1P || 0"
+                          :duration="1000"
+                        ></counto
+                        >%
+                      </div>
+                    </template>
+                  </van-cell>
+                </van-tab>
+              </van-tabs>
+            </van-cell-group>
             <van-cell-group border title="爆款稿件">
               <van-cell
                 v-for="(v, i) in ratios.article"
@@ -127,7 +164,7 @@
                 :title="v.title"
               >
                 <template #label>
-                  <van-tag type="primary"
+                  <van-tag size="“large”" type="primary"
                     >播放量:{{ timeFormat(v.play_count) }}</van-tag
                   >
                   {{ v.dep_name + "-" + v.nick_name }}
@@ -145,7 +182,7 @@
           :title="v.title"
         >
           <template #label>
-            <van-tag type="primary"
+            <van-tag size="“large”" type="primary"
               >播放量:{{ timeFormat(v.play_count) }}</van-tag
             >
             {{ v.dep_name + "-" + v.nick_name }}
@@ -186,8 +223,12 @@ import {
   Popup as vanPopup,
   Cell as vanCell,
   Tag as vanTag,
+  Tab as vanTab,
+  Tabs as vanTabs,
   cellGroup as vanCellGroup,
 } from "vant";
+import "vant/lib/tab/style/index";
+import "vant/lib/tabs/style/index";
 import "vant/lib/tag/style/index";
 import "vant/lib/cell/style/index";
 import "vant/lib/cell-group/style/index";
@@ -204,6 +245,7 @@ export default {
   name: "tv-list",
   data() {
     return {
+      active: "",
       fontSize: 17,
       show: false,
       charts: undefined,
@@ -229,21 +271,11 @@ export default {
     });
     jsonZhouMobile({
       date: this.$route.query.date,
-    })
-      .then(res => {
-        this.article = res.article || [];
-        this.dep = res.dep || [];
-        this.$emit("start", {
-          status: 200,
-        });
-      })
-      .catch(err => {
-        this.$emit("start", {
-          status: err,
-        });
-      });
+    }).then(res => {
+      this.article = res.article || [];
+      this.dep = res.dep || [];
+    });
   },
-
   computed: {},
   methods: {
     valueDate(v) {
@@ -259,14 +291,14 @@ export default {
       if (isNaN(num)) return 0;
       return Number(num).toFixed(w || 4) - 0;
     },
-    formatType(num, W) {
+    formatType(num) {
       let N = this.formatNum(num, 2);
       let wei = "";
       if (N >= 100000000) {
-        N = (N / 100000000).toFixed(W || 2);
+        N = (N / 100000000).toFixed(0);
         wei = "亿";
       } else if (N >= 10000) {
-        N = (N / 10000).toFixed(W || 2);
+        N = (N / 10000).toFixed(1);
         wei = "万";
       }
       N = N.toString().split(".");
@@ -284,7 +316,7 @@ export default {
     },
     showPopup(i) {
       this.show = true;
-      const ratios = this.dep[i] || {};
+      const ratios = JSON.parse(JSON.stringify(this.dep[i] || {}));
       let publish_count = this.formatType(ratios.publish_count, 2);
       ratios.publish_count = publish_count.N;
       ratios.publish_countP = publish_count.P;
@@ -293,8 +325,19 @@ export default {
       ratios.read_count = read_count.N;
       ratios.read_countP = read_count.P;
       ratios.read_countWei = read_count.wei;
+      const detail = ratios.detail || [];
+      const new_detail = {};
+      for (let i = 0; i < detail.length; i++) {
+        const v = detail[i];
+        const huanbi = this.formatType(v.huanbi * 100, 2);
+        v.huanbi1 = huanbi.N;
+        v.huanbi1P = huanbi.P;
+        v.huanbi1Wei = huanbi.wei;
+        if (new_detail[v.platform]) new_detail[v.platform].push(v);
+        else new_detail[v.platform] = [v];
+      }
+      ratios.detail = new_detail;
       this.ratios = ratios;
-      console.log(ratios);
       this.$nextTick(() => {});
     },
   },
@@ -308,6 +351,8 @@ export default {
     vanCell,
     vanTag,
     vanCellGroup,
+    vanTab,
+    vanTabs,
   },
 };
 </script>