فهرست منبع

直播页展示修改

liyongli 3 سال پیش
والد
کامیت
c953a4beb1

+ 1 - 2
app.json

@@ -2,8 +2,7 @@
   "pages": [
     "pages/home/home",
     "pages/sonTopic/sonTopic",
-    "pages/liveData/liveData",
-    "pages/liveData_kuaishou/index"
+    "pages/live/live"
   ],
   "window": {
     "backgroundTextStyle": "light",

BIN
assets/douyin.png


BIN
assets/kuaishou.png


BIN
assets/man.png


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
assets/man.svg


BIN
assets/woman.png


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
assets/woman.svg


+ 36 - 17
pages/home/components/topic/topic.js

@@ -73,7 +73,7 @@ Component({
   data: {
     error: "",
     detail: "",
-    nameTitle:"",
+    nameTitle: "",
     diglogTitle: "",
     headData: {},
     contrast: [],
@@ -129,7 +129,7 @@ Component({
             _this.setData({
               headData: res.data || {}
             })
-          } else  wx.showToast({
+          } else wx.showToast({
             title: '请重启小程序',
             icon: "error"
           })
@@ -155,14 +155,35 @@ Component({
         url: app.baseUrl + '/platform',
         success: function (res) {
           if (res.statusCode === 200) {
-            let contrast = res.data && res.data.length ? [res.data] : [];
-            let oldContrast = JSON.stringify(_this.data.contrast);
-            let newContrast = JSON.stringify(contrast);
-            if (oldContrast != newContrast)
-              _this.setData({
-                contrast
+            let list = [];
+            for (let i = 0; i < (res.data || []).length; i++) {
+              const v = (res.data || [])[i];
+              list.push({
+                value: v.total_pv,
+                name: v.platform
               })
-          } else  wx.showToast({
+            }
+            let contrast = [
+              {
+                type: 'pie',
+                label: {
+                  show:false
+                },
+                data: list,
+                emphasis: {
+                  itemStyle: {
+                    shadowBlur: 10,
+                    shadowOffsetX: 0,
+                    shadowColor: 'rgba(0, 0, 0, 0.5)'
+                  }
+                }
+              }
+            ];
+
+            _this.setData({
+              contrast
+            })
+          } else wx.showToast({
             title: '请重启小程序',
             icon: "error"
           })
@@ -214,7 +235,7 @@ Component({
             let newType = JSON.stringify(list);
             if (oldType != newType)
               _this.setData(setD)
-          } else  wx.showToast({
+          } else wx.showToast({
             title: '请重启小程序',
             icon: "error"
           })
@@ -242,7 +263,7 @@ Component({
             _this.setData({
               wordList: res.data || []
             })
-          } else  wx.showToast({
+          } else wx.showToast({
             title: '请重启小程序',
             icon: "error"
           })
@@ -300,7 +321,7 @@ Component({
               }
             }
             _this.setData(p)
-          } else  wx.showToast({
+          } else wx.showToast({
             title: '请重启小程序',
             icon: "error"
           })
@@ -337,10 +358,8 @@ Component({
     toLive: function (e) {
       if (!toUrl) return;
       toUrl = false;
-      let title = encodeURIComponent(this.data.title);
-      let platform = e.currentTarget.dataset.platform || '';
-      let url = "/pages/liveData/liveData?title=" +title + "&platform=" + platform;
-      if(platform === "kuaishou") url = "/pages/liveData_kuaishou/index?title=" +title + "&platform=" + platform;
+      let title = this.data.title;
+      let url = "/pages/live/live?title=" + title + "&season=" + (this.data.select - 0 + 1) + "&isdou=" + this.data.headData.has_live_douyin_data + "&iskuai=" + this.data.headData.has_live_kuaishou_data;
       wx.navigateTo({
         url,
         complete: function (res) {
@@ -353,7 +372,7 @@ Component({
       let detail = app.introduce[this.data.title + "_" + introduce] || {}
       this.setData({
         detail: (detail.value || ""),
-        diglogTitle:  (detail.content_desc || "")
+        diglogTitle: (detail.content_desc || "")
       })
     }
   }

+ 1 - 0
pages/home/components/topic/topic.json

@@ -7,6 +7,7 @@
     "mp-dialog": "weui-miniprogram/dialog/dialog",
     "mp-toptips": "weui-miniprogram/toptips/toptips",
     "wordCloud": "/components/wordCloud/wordCloud",
+    "pie": "/components/pie/pie",
     "lineChart": "/components/lineChart/lineChart"
   }
 }

+ 5 - 7
pages/home/components/topic/topic.wxml

@@ -54,11 +54,8 @@
   </view>
 
   <view class="pKvm">
-    <view class="kvm" bindtap="toLive" data-platform="kuaishou" wx:if="{{headData.has_live_kuaishou_data}}">
-      <view class="kvmText">快手直播</view>
-    </view>
-    <view class="kvm" bindtap="toLive" data-platform="douyin" wx:if="{{headData.has_live_douyin_data}}">
-      <view class="kvmText">抖音直播</view>
+    <view class="kvm" bindtap="toLive" wx:if="{{headData.has_live_douyin_data || headData.has_live_kuaishou_data}}">
+      <view class="kvmText" style="line-height: 3.5em;padding: 0" >直播</view>
     </view>
     <view class="kvm" bindtap="toSecond" wx:if="{{sonList && sonList.length}}">
       <view class="kvmText">二次传播</view>
@@ -66,8 +63,9 @@
   </view>
   <view class="itemView" wx:if="{{contrast.length}}">
     <view class="localCells">平台对比</view>
-    <chart list="{{contrast}}" id="{{'id' + 1}}" canvasId="{{'canvasId' + 1}}" wx:if="{{contrast && contrast.length}}"
-      yType="total_pv" xType="platform" />
+    <!-- <chart list="{{contrast}}" id="{{'id' + 1}}" canvasId="{{'canvasId' + 1}}" wx:if="{{contrast && contrast.length}}"
+      yType="total_pv" xType="platform" /> -->
+      <pie id="pie001" wx:if="{{contrast.length}}" canvasId="pie002" list="{{contrast}}" />
   </view>
   <view class="itemView" wx:if="{{all.length}}">
     <view class="localCells">账号排名</view>

+ 204 - 0
pages/live/components/douyin/douyin.js

@@ -0,0 +1,204 @@
+// pages/live/components/douyin/douyin.js
+const app = getApp();
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    title: {
+      type: String,
+      value: ""
+    },
+    season:{
+      type: Number,
+      value: 1
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    error: "",
+    detail: "",
+    diglogTitle: "",
+    headData: {},
+    lineList: [],
+    region: [],
+    series: []
+  },
+  ready() {
+    this.getData()
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    formatNumber: function (val) {
+      let out = val;
+      if (val >= 1000 && val < 10000) {
+        out = (val / 1000).toFixed(2) - 0 + "千"
+      } else if (val >= 10000 && val < 100000000) {
+        out = (val / 10000).toFixed(0) - 0 + "万"
+      } else if (val >= 100000000) {
+        out = (val / 100000000).toFixed(2) - 0 + "亿"
+      }
+      return out
+    },
+    getData: function () {
+      let _this = this;
+      wx.showLoading();
+      wx.request({
+        url: app.baseUrl + '/live-result',
+        data: {
+          topic: this.data.title,
+          platform: "douyin",
+          season: this.data.season
+        },
+        success: function (res) {
+          wx.hideLoading()
+          if (res.statusCode !== 200) return wx.showToast({
+            title: '请重启小程序',
+            icon: "error"
+          })
+          let oriData = res.data || {};
+          let region = [];
+          let trend = oriData.trend || {};
+          let RealTimeTraffic = {
+            title: "实时流量",
+            subTitle: "",
+            id: 'id' + 10,
+            canvasId: 'canvasId' + 10,
+            type: "line",
+            yType: "value",
+            xType: "time",
+            peopleList: []
+          };
+          let RealTimePersonTime = {
+            title: "观看人次",
+            subTitle: "",
+            id: 'id' + 11,
+            canvasId: 'canvasId' + 11,
+            type: "line",
+            yType: "value",
+            xType: "time",
+            peopleList: []
+          };
+          let AddUpFans = {
+            title: "累计粉丝量",
+            subTitle: "",
+            id: 'id' + 12,
+            canvasId: 'canvasId' + 12,
+            type: "line",
+            yType: "value",
+            xType: "time",
+            peopleList: []
+          };
+          let LikeTheTrend = {
+            title: "点赞走势",
+            subTitle: "",
+            id: 'id' + 13,
+            canvasId: 'canvasId' + 13,
+            type: "line",
+            yType: "value",
+            xType: "time",
+            peopleList: []
+          };
+          // 实时流量
+          RealTimeTraffic.subTitle = "在线人数峰值:" + _this.formatNumber((trend.user || {}).user_count || 0) + "  出现时间:" + _this.formatNumber((trend.user || {}).crawl_date || "") + " 平均人数:" + _this.formatNumber((trend.user || {}).avg_user_count || 0);
+          // 观看人次
+          RealTimePersonTime.subTitle = _this.formatNumber((trend.user || {}).stats_user_composition_from_my_follow_count || 0) + "人来自关注页面 " + _this.formatNumber((trend.user || {}).stats_user_composition_from_video_detail_count || 0) + "人来自视频推荐";
+          // 累计粉丝量
+          AddUpFans.subTitle = "粉丝峰值:" + _this.formatNumber((trend.fans || {}).club_info_total_fans_count || 0) + " 出现在:" + _this.formatNumber((trend.fans || {}).crawl_date || "");
+          // 点赞走势
+          LikeTheTrend.subTitle = "点赞峰值:" + _this.formatNumber((trend.like || {}).add_like_count || 0) + " 出现在:" + _this.formatNumber((trend.like || {}).crawl_date || "");
+          // 趋势图数据
+          for (let i = 0; i < (trend.webcastTrendList || []).length; i++) {
+            const v = (trend.webcastTrendList || [])[i];
+            let time = v.crawl_date.split(" ")[1] || "";
+            RealTimeTraffic.peopleList.push({
+              value: _this.formatNumber(v.user_count || 0),
+              time: time
+            });
+            RealTimePersonTime.peopleList.push({
+              value: _this.formatNumber(v.stats_total_user || 0),
+              time: time
+            });
+            AddUpFans.peopleList.push({
+              value: _this.formatNumber(v.club_info_total_fans_count || 0),
+              time: time
+            });
+            LikeTheTrend.peopleList.push({
+              value: _this.formatNumber(v.like_count || 0),
+              time: time
+            });
+          }
+          // 基础数据  
+          let base = {
+            msg_count: (oriData.webcastMessageList ? oriData.webcastMessageList.count || 0 : 0),
+            like_count: (trend.like || {}).add_like_count || 0,
+            total_fans_count: (trend.fans || {}).club_info_total_fans_count || 0,
+            peopel_time: (trend.user || {}).stats_total_user || 0
+          }
+          // 来源城市
+          let city = oriData.city || []
+          for (let i = 0; i < city.length; i++) {
+            const element = city[i] || {};
+            region.push({
+              name: element.key || "",
+              value: element.count || 0
+            })
+          }
+          // 性别比
+          let gender = [];
+          let oriGender = oriData.gender || [];
+          for (let i = 0; i < oriGender.length; i++) {
+            const v = oriGender[i];
+            gender.push({
+              name: v.key == "1" ? "男" : "女",
+              value: v.count
+            })
+          }
+          let p = {
+            headData: base,
+            region: [],
+            series: [],
+            lineList: []
+          }
+          region.length && p.region.push(region);
+          if (gender.length)
+            p.series = [
+              {
+                type: 'pie',
+                label: {
+                  position: 'inner',
+                  fontSize: 14,
+                },
+                data: gender,
+                emphasis: {
+                  itemStyle: {
+                    shadowBlur: 10,
+                    shadowOffsetX: 0,
+                    shadowColor: 'rgba(0, 0, 0, 0.5)'
+                  }
+                }
+              }
+            ];
+          AddUpFans && p.lineList.push(AddUpFans);
+          LikeTheTrend && p.lineList.push(LikeTheTrend);
+          RealTimeTraffic && p.lineList.push(RealTimeTraffic);
+          RealTimePersonTime && p.lineList.push(RealTimePersonTime);
+          _this.setData(p)
+
+        },
+        fail: function (err) {
+          wx.hideLoading()
+          wx.showToast({
+            title: '请重启小程序',
+            icon: "error"
+          })
+        },
+      })
+    }
+  }
+})

+ 1 - 0
pages/liveData/liveData.json → pages/live/components/douyin/douyin.json

@@ -1,4 +1,5 @@
 {
+  "component": true,
   "usingComponents": {
     "mp-dialog": "weui-miniprogram/dialog/dialog",
     "mp-toptips": "weui-miniprogram/toptips/toptips",

+ 0 - 0
pages/liveData/liveData.wxml → pages/live/components/douyin/douyin.wxml


+ 0 - 0
pages/liveData/liveData.wxss → pages/live/components/douyin/douyin.wxss


+ 209 - 0
pages/live/components/kuaishou/kuaishou.js

@@ -0,0 +1,209 @@
+// pages/live/components/kuaishou/kuaishou.js
+const app = getApp();
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    title:{
+      type: String,
+      value: ""
+    },
+    season:{
+      type: Number,
+      value: 1
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    error: "",
+    detail: "",
+    diglogTitle: "",
+    headData: {},
+    lineList: [],
+    region: [],
+    series: [],
+    oriList: []
+  },
+  ready(){
+      this.getData()
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    formatNumber: function (val) {
+      let out = val;
+      if (val >= 1000 && val < 10000) {
+        out = (val / 1000).toFixed(2) - 0 + "千"
+      } else if (val >= 10000 && val < 100000000) {
+        out = (val / 10000).toFixed(0) - 0 + "万"
+      } else if (val >= 100000000) {
+        out = (val / 100000000).toFixed(2) - 0 + "亿"
+      }
+      return out
+    },
+    getData: function () {
+      let _this = this;
+      wx.showLoading();
+      wx.request({
+        url: app.baseUrl + '/live-result',
+        data: {
+          topic: this.data.title,
+          platform: "kuaishou",
+          season: this.data.season
+        },
+        success: function (res) {
+          wx.hideLoading()
+          if (res.statusCode !== 200) return wx.showToast({
+            title: '请重启小程序',
+            icon: "error"
+          })
+          let oriData = res.data || {};
+          console.log(oriData)
+          let region = [];
+          let trend = oriData.detail || {};
+          let RealTimeWatch = {
+            title: "实时流量",
+            subTitle: "",
+            id: 'id' + 10,
+            canvasId: 'canvasId' + 10,
+            type: "line",
+            yType: "value",
+            xType: "time",
+            peopleList: []
+          };
+          let AddUpBsc = {
+            title: "弹幕数",
+            subTitle: "",
+            id: 'id' + 12,
+            canvasId: 'canvasId' + 12,
+            type: "line",
+            yType: "value",
+            xType: "time",
+            peopleList: []
+          };
+          let LikeTheBsuc = {
+            title: "发弹幕人数",
+            subTitle: "",
+            id: 'id' + 13,
+            canvasId: 'canvasId' + 13,
+            type: "line",
+            yType: "value",
+            xType: "time",
+            peopleList: []
+          };
+          // 趋势图数据
+          console.log(trend.watch)
+          for (let i = 0; i < (trend.watch || []).length; i++) {
+            const v = (trend.watch || [])[i];
+            let time = new Date(v.x || 0);
+            let formatTime = ""
+            time.getHours() > 9 ? formatTime += time.getHours() + ":": formatTime += '0' + time.getHours() + ":";
+            time.getMinutes() + 1 > 9 ? formatTime += (time.getMinutes() + 1) + ":": formatTime += '0' + (time.getMinutes() + 1) + ":";
+            time.getSeconds() > 9 ? formatTime += time.getSeconds(): formatTime += '0' + time.getSeconds();
+            RealTimeWatch.peopleList.push({
+              value: v.watch || 0,
+              time:formatTime
+            });
+            AddUpBsc.peopleList.push({
+              value: v.bsc || 0,
+              time:formatTime
+            });
+            LikeTheBsuc.peopleList.push({
+              value: v.bsuc || 0,
+              time:formatTime
+            });
+          }
+          // 基础数据  
+          let base = {
+            live_time: (oriData.detail ? oriData.detail.time || "" : "")
+          }
+          // 来源城市
+          let city = oriData.fans ? oriData.fans.area ? oriData.fans.area['全部'] || [] : [] : [];
+          for (let i = 0; i < city.length; i++) {
+            const element = city[i] || {};
+            region.push({
+              name: element.Name || "",
+              value: element.Ratio
+            })
+          }
+          // 性别比
+          let gender = [];
+          let oriGender = oriData.fans ? oriData.fans.gender || [] : [];
+          for (let i = 0; i < oriGender.length; i++) {
+            const v = oriGender[i];
+            let value = v.rate.split("%")[0] * 100;
+            gender.push({
+              name: v.gender,
+              value
+            })
+          }
+          // 年龄
+          let age = [];
+          let oriAge = oriData.fans ? oriData.fans.age || [] : [];
+          for (let i = 0; i < oriAge.length; i++) {
+            const v = oriAge[i];
+            let value = v.count;
+            age.push({
+              name: v.item + "岁",
+              value
+            })
+          }
+  
+          let p = {
+            headData: base,
+            region: [],
+            series: [],
+            lineList: [],
+            oriList: []
+          }
+          region.length && p.region.push(region);
+          if (age.length)
+            p.oriList = [
+              {
+                type: 'pie',
+                label: {
+                  show: false
+                },
+                data: age
+              }
+            ]
+          if (gender.length)
+            p.series = [
+              {
+                type: 'pie',
+                label: {
+                  position: 'inner',
+                  fontSize: 14,
+                },
+                data: gender,
+                emphasis: {
+                  itemStyle: {
+                    shadowBlur: 10,
+                    shadowOffsetX: 0,
+                    shadowColor: 'rgba(0, 0, 0, 0.5)'
+                  }
+                }
+              }
+            ];
+          AddUpBsc.peopleList.length && p.lineList.push(AddUpBsc);
+          LikeTheBsuc.peopleList.length && p.lineList.push(LikeTheBsuc);
+          RealTimeWatch.peopleList.length && p.lineList.push(RealTimeWatch);
+          _this.setData(p)
+  
+        },
+        fail: function (err) {
+          wx.hideLoading()
+          wx.showToast({
+            title: '请重启小程序',
+            icon: "error"
+          })
+        },
+      })
+    }
+  }
+})

+ 1 - 0
pages/liveData_kuaishou/index.json → pages/live/components/kuaishou/kuaishou.json

@@ -1,4 +1,5 @@
 {
+  "component": true,
   "usingComponents": {
     "mp-dialog": "weui-miniprogram/dialog/dialog",
     "mp-toptips": "weui-miniprogram/toptips/toptips",

+ 2 - 6
pages/liveData_kuaishou/index.wxml → pages/live/components/kuaishou/kuaishou.wxml

@@ -4,15 +4,13 @@
 <mp-toptips msg="{{error}}" ext-class="toptips" type="error" show="{{error}}"></mp-toptips>
 
 <view class="liveData">
-  <view class="topTable">
+  <!-- <view class="topTable">
     <view class="liveDataTable title">
       <view data-introduce="total_fans_count" bindtap="showDetail" class="liveDataItem">
         粉丝数
-        <!-- <text class="show">?</text> : -->
       </view>
       <view data-introduce="like_count" bindtap="showDetail" class="liveDataItem">
         直播点赞数
-        <!-- <text class="show">?</text> : -->
       </view>
     </view>
     <view class="liveDataTable">
@@ -23,12 +21,10 @@
       <view wx:if="{{ headData.msg_count != -1  }}" data-introduce="msg_count" bindtap="showDetail"
         class="liveDataItem liveDataItemRigh">
         直播评论数
-        <!-- <text class="show">?</text> : -->
       </view>
       <view wx:if="{{ headData.peopel_time != -1  }}" data-introduce="peopel_time" bindtap="showDetail"
         class="liveDataItem liveDataItemRigh">
         直播观看人数
-        <!-- <text class="show">?</text> : -->
       </view>
     </view>
     <view class="liveDataTable">
@@ -37,7 +33,7 @@
       <view wx:if="{{ headData.peopel_time != -1  }}" class="liveDataItem">{{filter.valueFormat(headData.peopel_time)}}
       </view>
     </view>
-  </view>
+  </view> -->
 
   <view class="itemView">
     <view class="subTitle">直播时间:{{headData.live_time}}</view>

+ 1 - 1
pages/liveData_kuaishou/index.wxss → pages/live/components/kuaishou/kuaishou.wxss

@@ -1,4 +1,4 @@
-/* pages/home/components/liveData/liveData.wxss */
+/* pages/live/components/kuaishou/kuaishou.wxss *//* pages/home/components/liveData/liveData.wxss */
 .liveData {
   width: 750rpx;
   color: #bfcbd9;

+ 95 - 0
pages/live/live.js

@@ -0,0 +1,95 @@
+// pages/live/live.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    list: [],
+    select: "douyin",
+    season: 2,
+    title: "",
+    isdou: false,
+    iskuai: false
+  },
+
+  tabChange(e) {
+    this.setData({
+      select: e.currentTarget.dataset.index
+    })
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    let isdou = options.isdou === 'ture' ? true : false,
+    iskuai = options.iskuai === 'ture' ? true : false, list = [];
+    isdou && list.push({
+      "text": "抖音",
+      "img": "douyin",
+      "type": "douyin",
+    })
+    iskuai && list.push({
+      "text": "快手",
+      "img": "kuaishou",
+      "type": "kuaishou",
+    })
+    console.log(options)
+    this.setData({
+      title: options.title,
+      season: options.season - 0,
+      isdou,
+      iskuai,
+      list
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 6 - 0
pages/live/live.json

@@ -0,0 +1,6 @@
+{
+  "usingComponents": {
+    "kuaishou": "./components/kuaishou/kuaishou",
+    "douyin": "./components/douyin/douyin"
+  }
+}

+ 19 - 0
pages/live/live.wxml

@@ -0,0 +1,19 @@
+<!--pages/live/live.wxml-->
+<view>
+  <scroll-view style="height: 92vh" scroll-y="{{true}}">
+    <kuaishou wx:if="{{select === 'kuaishou'}}" title="{{title}}" season="{{season}}"></kuaishou>
+    <douyin wx:if="{{select === 'douyin'}}" title="{{title}}"  season="{{season}}"></douyin>
+  </scroll-view>
+
+  <cover-view class="nabar" wx:if="{{isdou || iskuai}}">
+    <cover-view class="navarItem" wx:for="{{list}}" wx:key="text" data-index="{{item.type}}" bindtap="tabChange">
+      <cover-image style="width: 1.5em;height:1.5em;margin: 0 auto" src="../../assets/{{item.img}}.png"></cover-image>
+      <cover-view wx:if="{{item.type != select}}">
+        {{item.text}}
+      </cover-view>
+      <cover-view wx:if="{{item.type == select}}">
+        <cover-view class="select"></cover-view>
+      </cover-view>
+    </cover-view>
+  </cover-view>
+</view>

+ 32 - 0
pages/live/live.wxss

@@ -0,0 +1,32 @@
+/* pages/live/live.wxss */
+.nabar{
+  position: fixed;
+  height: 8vh;
+  line-height: 3vh;
+  width: 750rpx;
+  bottom: 0;
+  display: flex;
+  box-shadow: 0 0 8px #1989fa;
+}
+
+.nabar .navarItem{
+  flex: 1;
+  font-size: 14px;
+  padding: 10rpx 0;
+  text-align: center;
+  color: #bfcbd9;
+}
+
+.nabar .act{
+  color: #1989fa;
+}
+
+.nabar .select{
+  background-color: red;
+  border-radius: 1em;
+  width: 50rpx;
+  margin-left: auto;
+  margin-right: auto;
+  margin-top: 8px;
+  height: 2px;
+}

+ 0 - 254
pages/liveData/liveData.js

@@ -1,254 +0,0 @@
-// pages/liveData/liveData.js
-const app = getApp();
-let peopleList = [{ "time": "13:00", "value": 9944 }, { "time": "14:00", "value": 8920 }, { "time": "15:00", "value": 14656 }, { "time": "16:00", "value": 13084 }];
-Page({
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    error: "",
-    detail: "",
-    diglogTitle: "",
-    title: "",
-    headData: {},
-    lineList: [],
-    region: [],
-    series: [],
-    oriList: [
-      {
-        type: 'pie',
-        label: {
-          show: false
-        },
-        data: [{ value: 1048, name: '百度' }, { value: 735, name: '谷歌' }, { value: 735, name: '360' }, { value: 735, name: '搜狗' }, { value: 735, name: '其他' }]
-      },
-    ]
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    this.setData({
-      title: decodeURIComponent(options.title),
-      platform: options.platform
-    }, () => {
-      this.getData()
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  },
-  formatNumber: function (val) {
-    let out = val;
-    if (val >= 1000 && val < 10000) {
-      out = (val / 1000).toFixed(2) - 0 + "千"
-    } else if (val >= 10000 && val < 100000000) {
-      out = (val / 10000).toFixed(0) - 0 + "万"
-    } else if (val >= 100000000) {
-      out = (val / 100000000).toFixed(2) - 0 + "亿"
-    }
-    return out
-  },
-  getData: function () {
-    let _this = this;
-    wx.showLoading();
-    wx.request({
-      url: app.baseUrl + '/live-result',
-      data: {
-        topic: this.data.title,
-        platform: this.data.platform
-      },
-      success: function (res) {
-        wx.hideLoading()
-        if (res.statusCode !== 200) return wx.showToast({
-          title: '请重启小程序',
-          icon: "error"
-        })
-        let oriData = res.data || {};
-        let region = [];
-        let trend = oriData.trend || {};
-        let RealTimeTraffic = {
-          title: "实时流量",
-          subTitle: "",
-          id: 'id' + 10,
-          canvasId: 'canvasId' + 10,
-          type: "line",
-          yType: "value",
-          xType: "time",
-          peopleList: []
-        };
-        let RealTimePersonTime = {
-          title: "观看人次",
-          subTitle: "",
-          id: 'id' + 11,
-          canvasId: 'canvasId' + 11,
-          type: "line",
-          yType: "value",
-          xType: "time",
-          peopleList: []
-        };
-        let AddUpFans = {
-          title: "累计粉丝量",
-          subTitle: "",
-          id: 'id' + 12,
-          canvasId: 'canvasId' + 12,
-          type: "line",
-          yType: "value",
-          xType: "time",
-          peopleList: []
-        };
-        let LikeTheTrend = {
-          title: "点赞走势",
-          subTitle: "",
-          id: 'id' + 13,
-          canvasId: 'canvasId' + 13,
-          type: "line",
-          yType: "value",
-          xType: "time",
-          peopleList: []
-        };
-        // 实时流量
-        RealTimeTraffic.subTitle = "在线人数峰值:" + _this.formatNumber((trend.user || {}).user_count || 0) + "  出现时间:" + _this.formatNumber((trend.user || {}).crawl_date || "") + " 平均人数:" + _this.formatNumber((trend.user || {}).avg_user_count || 0);
-        // 观看人次
-        RealTimePersonTime.subTitle = _this.formatNumber((trend.user || {}).stats_user_composition_from_my_follow_count || 0) + "人来自关注页面 " + _this.formatNumber((trend.user || {}).stats_user_composition_from_video_detail_count || 0) + "人来自视频推荐";
-        // 累计粉丝量
-        AddUpFans.subTitle = "粉丝峰值:" + _this.formatNumber((trend.fans || {}).club_info_total_fans_count || 0) + " 出现在:" + _this.formatNumber((trend.fans || {}).crawl_date || "");
-        console.log(oriData);
-        // 点赞走势
-        LikeTheTrend.subTitle = "点赞峰值:" + _this.formatNumber((trend.like || {}).add_like_count || 0) + " 出现在:" + _this.formatNumber((trend.like || {}).crawl_date || "");
-        // 趋势图数据
-        for (let i = 0; i < (trend.webcastTrendList || []).length; i++) {
-          const v = (trend.webcastTrendList || [])[i];
-          let time = v.crawl_date.split(" ")[1] || "";
-          RealTimeTraffic.peopleList.push({
-            value: _this.formatNumber(v.user_count || 0),
-            time: time
-          });
-          RealTimePersonTime.peopleList.push({
-            value: _this.formatNumber(v.stats_total_user || 0),
-            time: time
-          });
-          AddUpFans.peopleList.push({
-            value: _this.formatNumber(v.club_info_total_fans_count || 0),
-            time: time
-          });
-          LikeTheTrend.peopleList.push({
-            value: _this.formatNumber(v.like_count || 0),
-            time: time
-          });
-        }
-        console.log(oriData);
-        // 基础数据  
-        let base = {
-          msg_count: (oriData.webcastMessageList ? oriData.webcastMessageList.count || 0 : 0),
-          like_count: (trend.like || {}).add_like_count || 0,
-          total_fans_count: (trend.fans || {}).club_info_total_fans_count || 0,
-          peopel_time: (trend.user || {}).stats_total_user || 0
-        }
-        console.log(base)
-        // 来源城市
-        let city = oriData.city || []
-        for (let i = 0; i < city.length; i++) {
-          const element = city[i] || {};
-          region.push({
-            name: element.key || "",
-            value: element.count || 0
-          })
-        }
-        // 性别比
-        let gender = [];
-        let oriGender = oriData.gender || [];
-        for (let i = 0; i < oriGender.length; i++) {
-          const v = oriGender[i];
-          gender.push({
-            name: v.key == "1" ? "男" : "女",
-            value: v.count
-          })
-        }
-        let p = {
-          headData: base,
-          region: [],
-          series: [],
-          lineList: []
-        }
-        region.length && p.region.push(region);
-        if (gender.length)
-          p.series = [
-            {
-              type: 'pie',
-              label: {
-                position: 'inner',
-                fontSize: 14,
-              },
-              data: gender,
-              emphasis: {
-                itemStyle: {
-                  shadowBlur: 10,
-                  shadowOffsetX: 0,
-                  shadowColor: 'rgba(0, 0, 0, 0.5)'
-                }
-              }
-            }
-          ];
-        AddUpFans && p.lineList.push(AddUpFans);
-        LikeTheTrend && p.lineList.push(LikeTheTrend);
-        RealTimeTraffic && p.lineList.push(RealTimeTraffic);
-        RealTimePersonTime && p.lineList.push(RealTimePersonTime);
-        _this.setData(p)
-
-      },
-      fail: function (err) {
-        wx.hideLoading()
-        wx.showToast({
-          title: '请重启小程序',
-          icon: "error"
-        })
-      },
-    })
-  }
-})

+ 0 - 250
pages/liveData_kuaishou/index.js

@@ -1,250 +0,0 @@
-// pages/liveData/liveData.js
-const app = getApp();
-let peopleList = [{ "time": "13:00", "value": 9944 }, { "time": "14:00", "value": 8920 }, { "time": "15:00", "value": 14656 }, { "time": "16:00", "value": 13084 }];
-Page({
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    error: "",
-    detail: "",
-    diglogTitle: "",
-    title: "",
-    headData: {},
-    lineList: [],
-    region: [],
-    series: [],
-    oriList: []
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    this.setData({
-      title: decodeURIComponent(options.title),
-      platform: options.platform
-    }, () => {
-      this.getData()
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  },
-  formatNumber: function (val) {
-    let out = val;
-    if (val >= 1000 && val < 10000) {
-      out = (val / 1000).toFixed(2) - 0 + "千"
-    } else if (val >= 10000 && val < 100000000) {
-      out = (val / 10000).toFixed(0) - 0 + "万"
-    } else if (val >= 100000000) {
-      out = (val / 100000000).toFixed(2) - 0 + "亿"
-    }
-    return out
-  },
-  getData: function () {
-    let _this = this;
-    wx.showLoading();
-    wx.request({
-      url: app.baseUrl + '/live-result',
-      data: {
-        topic: this.data.title,
-        platform: this.data.platform
-      },
-      success: function (res) {
-        wx.hideLoading()
-        if (res.statusCode !== 200) return wx.showToast({
-          title: '请重启小程序',
-          icon: "error"
-        })
-        let oriData = res.data || {};
-        console.log(oriData)
-        let region = [];
-        let trend = oriData.detail || {};
-        let RealTimeWatch = {
-          title: "实时流量",
-          subTitle: "",
-          id: 'id' + 10,
-          canvasId: 'canvasId' + 10,
-          type: "line",
-          yType: "value",
-          xType: "time",
-          peopleList: []
-        };
-        let AddUpBsc = {
-          title: "弹幕数",
-          subTitle: "",
-          id: 'id' + 12,
-          canvasId: 'canvasId' + 12,
-          type: "line",
-          yType: "value",
-          xType: "time",
-          peopleList: []
-        };
-        let LikeTheBsuc = {
-          title: "发弹幕人数",
-          subTitle: "",
-          id: 'id' + 13,
-          canvasId: 'canvasId' + 13,
-          type: "line",
-          yType: "value",
-          xType: "time",
-          peopleList: []
-        };
-        // 趋势图数据
-        for (let i = 0; i < (trend.watch || []).length; i++) {
-          const v = (trend.watch || [])[i];
-          let time = new Date(v.x || 0);
-          let formatTime = ""
-          time.getHours() > 9 ? formatTime += time.getHours() + ":": formatTime += '0' + time.getHours() + ":";
-          time.getMinutes() + 1 > 9 ? formatTime += (time.getMinutes() + 1) + ":": formatTime += '0' + (time.getMinutes() + 1) + ":";
-          time.getSeconds() > 9 ? formatTime += time.getSeconds(): formatTime += '0' + time.getSeconds();
-          RealTimeWatch.peopleList.push({
-            value: v.watch || 0,
-            time:formatTime
-          });
-          AddUpBsc.peopleList.push({
-            value: v.bsc || 0,
-            time:formatTime
-          });
-          LikeTheBsuc.peopleList.push({
-            value: v.bsuc || 0,
-            time:formatTime
-          });
-        }
-        // 基础数据  
-        let base = {
-          live_time: (oriData.detail ? oriData.detail.time || "" : ""),
-          msg_count: (oriData.webcastMessageList ? oriData.webcastMessageList.count || 0 : 0),
-          like_count: (trend.like || {}).add_like_count || 0,
-          total_fans_count: (trend.fans || {}).club_info_total_fans_count || 0,
-          peopel_time: (trend.user || {}).stats_total_user || 0
-        }
-        // 来源城市
-        let city = oriData.fans ? oriData.fans.area ? oriData.fans.area['全部'] || [] : [] : [];
-        for (let i = 0; i < city.length; i++) {
-          const element = city[i] || {};
-          region.push({
-            name: element.Name || "",
-            value: element.Ratio
-          })
-        }
-        // 性别比
-        let gender = [];
-        let oriGender = oriData.fans ? oriData.fans.gender || [] : [];
-        for (let i = 0; i < oriGender.length; i++) {
-          const v = oriGender[i];
-          let value = v.rate.split("%")[0] * 100;
-          gender.push({
-            name: v.gender,
-            value
-          })
-        }
-        // 年龄
-        let age = [];
-        let oriAge = oriData.fans ? oriData.fans.age || [] : [];
-        for (let i = 0; i < oriAge.length; i++) {
-          const v = oriAge[i];
-          let value = v.count;
-          age.push({
-            name: v.item + "岁",
-            value
-          })
-        }
-
-        let p = {
-          headData: base,
-          region: [],
-          series: [],
-          lineList: [],
-          oriList: []
-        }
-        region.length && p.region.push(region);
-        if (age.length)
-          p.oriList = [
-            {
-              type: 'pie',
-              label: {
-                show: false
-              },
-              data: age
-            }
-          ]
-        if (gender.length)
-          p.series = [
-            {
-              type: 'pie',
-              label: {
-                position: 'inner',
-                fontSize: 14,
-              },
-              data: gender,
-              emphasis: {
-                itemStyle: {
-                  shadowBlur: 10,
-                  shadowOffsetX: 0,
-                  shadowColor: 'rgba(0, 0, 0, 0.5)'
-                }
-              }
-            }
-          ];
-        AddUpBsc.peopleList.length && p.lineList.push(AddUpBsc);
-        LikeTheBsuc.peopleList.length && p.lineList.push(LikeTheBsuc);
-        RealTimeWatch.peopleList.length && p.lineList.push(RealTimeWatch);
-        _this.setData(p)
-
-      },
-      fail: function (err) {
-        wx.hideLoading()
-        wx.showToast({
-          title: '请重启小程序',
-          icon: "error"
-        })
-      },
-    })
-  }
-})

+ 39 - 15
pages/sonTopic/sonTopic.js

@@ -57,14 +57,14 @@ Page({
       sonTitle: second_name,
       select: app.select - 0
     })
-    this.getData({ topic_name: second_name || title, season: app.select - 0 + 1  });
-    this.getPing({ topic_name: second_name || title, season: app.select - 0 + 1  });
-    this.getAccount({ topic_name: second_name || title, platform: "ALL", type: "all", season: app.select - 0 + 1  });
-    this.getAccount({ topic_name: second_name || title, platform: "douyin", type: "douyin", season: app.select - 0 + 1  });
-    this.getAccount({ topic_name: second_name || title, platform: "kuaishou", type: "kuaishou", season: app.select - 0 + 1  });
-    this.getAccount({ topic_name: second_name || title, platform: "yangshi", type: "yangshi", season: app.select - 0 + 1  });
+    this.getData({ topic_name: second_name || title, season: app.select - 0 + 1 });
+    this.getPing({ topic_name: second_name || title, season: app.select - 0 + 1 });
+    this.getAccount({ topic_name: second_name || title, platform: "ALL", type: "all", season: app.select - 0 + 1 });
+    this.getAccount({ topic_name: second_name || title, platform: "douyin", type: "douyin", season: app.select - 0 + 1 });
+    this.getAccount({ topic_name: second_name || title, platform: "kuaishou", type: "kuaishou", season: app.select - 0 + 1 });
+    this.getAccount({ topic_name: second_name || title, platform: "yangshi", type: "yangshi", season: app.select - 0 + 1 });
     // this.getWorld({ season: app.select - 0 + 1 });
-    this.getWeibo({ topic_name: second_name || title, time: "30d", type: "yangshi", season: app.select - 0 + 1  });
+    this.getWeibo({ topic_name: second_name || title, time: "30d", type: "yangshi", season: app.select - 0 + 1 });
   },
 
   /**
@@ -143,10 +143,11 @@ Page({
       url: app.baseUrl + '/overview',
       success: function (res) {
         if (res.statusCode === 200) {
+
           _this.setData({
             headData: res.data || {}
           })
-        } else  wx.showToast({
+        } else wx.showToast({
           title: '请重启小程序',
           icon: "error"
         })
@@ -171,11 +172,34 @@ Page({
       url: app.baseUrl + '/platform',
       success: function (res) {
         if (res.statusCode === 200) {
-          let contrast = res.data && res.data.length ? [res.data] : [];
+          let list = [];
+          for (let i = 0; i < (res.data || []).length; i++) {
+            const v = (res.data || [])[i];
+            list.push({
+              value: v.total_pv,
+              name: v.platform
+            })
+          }
+          let contrast = [
+            {
+              type: 'pie',
+              label: {
+                show: false
+              },
+              data: list,
+              emphasis: {
+                itemStyle: {
+                  shadowBlur: 10,
+                  shadowOffsetX: 0,
+                  shadowColor: 'rgba(0, 0, 0, 0.5)'
+                }
+              }
+            }
+          ];
           _this.setData({
             contrast
           })
-        } else  wx.showToast({
+        } else wx.showToast({
           title: '请重启小程序',
           icon: "error"
         })
@@ -220,7 +244,7 @@ Page({
             setD.userSort = userSort;
           setD[data.type] = list;
           _this.setData(setD)
-        } else  wx.showToast({
+        } else wx.showToast({
           title: '请重启小程序',
           icon: "error"
         })
@@ -244,7 +268,7 @@ Page({
           _this.setData({
             wordList: res.data || []
           })
-        } else  wx.showToast({
+        } else wx.showToast({
           title: '请重启小程序',
           icon: "error"
         })
@@ -301,7 +325,7 @@ Page({
             }
           }
           _this.setData(p)
-        } else  wx.showToast({
+        } else wx.showToast({
           title: '请重启小程序',
           icon: "error"
         })
@@ -346,10 +370,10 @@ Page({
   showDetail: function (e) {
     let introduce = e.currentTarget.dataset.introduce || "";
     let detail = app.introduce[introduce] || {}
-    console.log(introduce,detail)
+    console.log(introduce, detail)
     this.setData({
       detail: detail.value || "",
-      diglogTitle:  detail.content_desc || ""
+      diglogTitle: detail.content_desc || ""
     })
   }
 })

+ 1 - 0
pages/sonTopic/sonTopic.json

@@ -4,6 +4,7 @@
     "chart" : "/components/Chart/Chart",
     "table" : "/components/table/table",
     "mp-toptips": "weui-miniprogram/toptips/toptips",
+    "pie": "/components/pie/pie",
     "wordCloud": "/components/wordCloud/wordCloud",
     "lineChart": "/components/lineChart/lineChart"
   }

+ 3 - 2
pages/sonTopic/sonTopic.wxml

@@ -47,8 +47,9 @@
   </view>
   <view class="itemView" wx:if="{{contrast.length}}">
     <view class="localCells">平台对比</view>
-    <chart id="{{'id' + 1}}" canvasId="{{'canvasId' + 1}}" list="{{contrast}}" wx:if="{{contrast && contrast.length}}"
-      yType="total_pv" xType="platform" />
+    <!-- <chart id="{{'id' + 1}}" canvasId="{{'canvasId' + 1}}" list="{{contrast}}" wx:if="{{contrast && contrast.length}}"
+      yType="total_pv" xType="platform" /> -->
+      <pie id="pie001" wx:if="{{contrast.length}}" canvasId="pie002" list="{{contrast}}" />
   </view>
   <view class="itemView" wx:if="{{all.length}}">
     <view class="localCells">账号排名</view>

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است