liyongli 3 年之前
父节点
当前提交
5ef0bcbbcf

+ 2 - 1
app.json

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

+ 2 - 1
components/Chart/Chart.js

@@ -77,7 +77,8 @@ Component({
             sLi.map(val => {
             sLi.map(val => {
               i === 0 && xData.push(val[this.data.xType]);
               i === 0 && xData.push(val[this.data.xType]);
               yData[i].data.push(val[type]);
               yData[i].data.push(val[type]);
-            })
+            console.log(val[this.data.xType])
+          })
           }
           }
         })
         })
         if (this.chart) {
         if (this.chart) {

+ 1 - 1
components/mapChina/index.js

@@ -72,7 +72,7 @@ Component({
       let max = this.data.list[0][0].value - 0;
       let max = this.data.list[0][0].value - 0;
       var option = {
       var option = {
         tooltip: {
         tooltip: {
-          show: true,
+          show: false,
           formatter: "{b}:{c}%"
           formatter: "{b}:{c}%"
         },
         },
         visualMap: {
         visualMap: {

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

@@ -91,7 +91,17 @@ Component({
     weiboBtnListread: [],
     weiboBtnListread: [],
     weiboBtnListme: [],
     weiboBtnListme: [],
     weiboBtnListori: [],
     weiboBtnListori: [],
-    height: 0
+    height: 0,
+    pla: [
+      // {
+      //   name: "抖音",
+      //   type: "douyin"
+      // },
+      // {
+      //   name: "快手",
+      //   type: "kuaishou"
+      // },
+    ]
   },
   },
 
 
   detached: function () {
   detached: function () {
@@ -102,6 +112,11 @@ Component({
    * 组件的方法列表
    * 组件的方法列表
    */
    */
   methods: {
   methods: {
+    platform(e){
+      wx.navigateTo({
+        url: '/pages/platform/index?type=' + e.currentTarget.dataset.id + "&title=" + this.data.title,
+      })
+    },
     lineChengeread: function (val) {
     lineChengeread: function (val) {
       this.setData({
       this.setData({
         selectread: val.detail
         selectread: val.detail
@@ -213,6 +228,7 @@ Component({
             let list = res.data && res.data.length ? [res.data] : [];
             let list = res.data && res.data.length ? [res.data] : [];
             const setD = {};
             const setD = {};
             let isIntUser = {};
             let isIntUser = {};
+            console.log(list)
             let user = {
             let user = {
               'pv': { name: '浏览', type: 'pv' },
               'pv': { name: '浏览', type: 'pv' },
               'digg_count': { name: '点赞', type: 'digg_count' },
               'digg_count': { name: '点赞', type: 'digg_count' },

+ 3 - 0
pages/home/components/topic/topic.wxml

@@ -66,6 +66,9 @@
       <view class="kvmText">二次传播</view>
       <view class="kvmText">二次传播</view>
     </view>
     </view>
   </view>
   </view>
+  <scroll-view scroll-x style="padding: 20rpx 0 0 20rpx">
+  <button size="mini" wx:key="id" wx:for="{{pla}}" style="margin-right: 10rpx;background-color:#1989fa;color: #fff;font-weight: 400" data-id="{{item.type}}" bindtap="platform">{{item.name}}</button>
+  </scroll-view>
   <view class="itemView" wx:if="{{contrast.length}}">
   <view class="itemView" wx:if="{{contrast.length}}">
     <view class="localCells">平台对比</view>
     <view class="localCells">平台对比</view>
     <!-- <chart list="{{contrast}}" id="{{'id' + 1}}" canvasId="{{'canvasId' + 1}}" wx:if="{{contrast && contrast.length}}"
     <!-- <chart list="{{contrast}}" id="{{'id' + 1}}" canvasId="{{'canvasId' + 1}}" wx:if="{{contrast && contrast.length}}"

+ 105 - 0
pages/platform/index.js

@@ -0,0 +1,105 @@
+// pages/platform/index.js
+const app = getApp();
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    list: {},
+    keys: []
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    const that = this;
+    wx.request({
+      url: app.baseUrl + '/article-list?platform=' + options.type + '&topic_name=' + options.title,
+      success(res) {
+        let lists = {};
+        let keys = [];
+        (res.data || []).map(v => {
+          let time = new Date(v.create_time);
+          let year = time.getFullYear();
+          let month = time.getMonth();
+          let day = time.getDate();
+          let T = year;
+          month + 1 > 9 ? T += '-' + (month + 1) : T += '-' + '0' + (month + 1);
+          day + 1 > 9 ? T += '-' + (day + 1) : T += '-' + '0' + day;
+          !lists[T] && keys.push(T);
+          lists[T] ? lists[T].push(v) : lists[T] = [v]
+        })
+        that.setData({
+          list: lists,
+          keys
+        })
+      },
+      fail(err) {
+
+      }
+    })
+  },
+
+  formatter: 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
+  },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 5 - 0
pages/platform/index.json

@@ -0,0 +1,5 @@
+{
+  "usingComponents": {
+    "mp-cell": "weui-miniprogram/cell/cell"
+  }
+}

+ 19 - 0
pages/platform/index.wxml

@@ -0,0 +1,19 @@
+<!--pages/platform/index.wxml-->
+<wxs src="../../wxs/index.wxs" module="utils" />
+<view class="row" wx:for="{{keys}}" wx:key="id">
+  <view class="label">{{item}}</view>
+  <view class="val">
+    <view style="padding: 10rpx 0" wx:for="{{list[item]}}" wx:for-index="o" wx:key="id" wx:for-item="v">
+      <view>{{v.title}}</view>
+      <view class="data" style="overflow: hidden;text-overflow:ellipsis;white-space: nowrap;">
+        <!-- <text class="data"
+          style="vertical-align: middle;display: inline-block;max-width: 50%;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;padding-right:3rpx">{{v.nick_name}} </text> -->
+        <view class="row" style="width: 550rpx">
+          <view class="label" style="vertical-align: middle;width: 35%;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;">{{v.nick_name}}</view>
+          <view class="val" style="vertical-align: middle;width:65%;text-align: right">评论: {{utils.formatter(v.comment_count)}};点赞: {{utils.formatter(v.digg_count)}};转发:{{utils.formatter(v.forward_count)}}</view>
+        </view>
+    
+      </view>
+    </view>
+  </view>
+</view>

+ 25 - 0
pages/platform/index.wxss

@@ -0,0 +1,25 @@
+/* pages/platform/index.wxss */
+.row{
+  width: 750rpx;
+  color: #efefef;
+  box-sizing: border-box;
+}
+.row .label,
+.row .val{
+  display: inline-block;
+  vertical-align: text-top;
+}
+
+.row .label{
+  width: 150rpx;
+  font-size: 12px;
+  padding: 15rpx 5rpx;
+}
+.row .val{
+  width: 570rpx;
+  padding: 0 10rpx;
+}
+.row .data{
+  font-size: 12px;
+  color: #a9a9a9;
+}

+ 7 - 5
project.config.json

@@ -23,16 +23,14 @@
     "compileHotReLoad": false,
     "compileHotReLoad": false,
     "useMultiFrameRuntime": true,
     "useMultiFrameRuntime": true,
     "useApiHook": true,
     "useApiHook": true,
-    "useApiHostProcess": false,
+    "useApiHostProcess": true,
     "babelSetting": {
     "babelSetting": {
       "ignore": [],
       "ignore": [],
       "disablePlugins": [],
       "disablePlugins": [],
       "outputPath": ""
       "outputPath": ""
     },
     },
     "enableEngineNative": false,
     "enableEngineNative": false,
-    "useIsolateContext": true,
-    "useCompilerModule": true,
-    "userConfirmedUseCompilerModuleSwitch": false,
+    "useIsolateContext": false,
     "userConfirmedBundleSwitch": false,
     "userConfirmedBundleSwitch": false,
     "packNpmManually": true,
     "packNpmManually": true,
     "packNpmRelationList": [
     "packNpmRelationList": [
@@ -41,7 +39,11 @@
         "miniprogramNpmDistDir": "./"
         "miniprogramNpmDistDir": "./"
       }
       }
     ],
     ],
-    "minifyWXSS": true
+    "minifyWXSS": true,
+    "disableUseStrict": false,
+    "minifyWXML": true,
+    "showES6CompileOption": false,
+    "useCompilerPlugins": false
   },
   },
   "compileType": "miniprogram",
   "compileType": "miniprogram",
   "libVersion": "2.17.0",
   "libVersion": "2.17.0",

+ 6 - 0
project.private.config.json

@@ -17,6 +17,12 @@
           "pathName": "pages/liveData/liveData",
           "pathName": "pages/liveData/liveData",
           "query": "",
           "query": "",
           "scene": null
           "scene": null
+        },
+        {
+          "name": "pages/platform/index",
+          "pathName": "pages/platform/index",
+          "query": "type=kuaishou&title=%E9%99%95%E8%A5%BF%E9%AA%84%E5%82%B2",
+          "scene": null
         }
         }
       ]
       ]
     }
     }

+ 13 - 0
wxs/index.wxs

@@ -0,0 +1,13 @@
+module.exports = {
+  formatter: function (val) {
+    var 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
+  }
+}