소스 검색

第二季

liyongli 4 년 전
부모
커밋
172ced7767
7개의 변경된 파일86개의 추가작업 그리고 75개의 파일을 삭제
  1. 2 2
      components/tab/tab.wxss
  2. 21 25
      pages/home/components/topic/topic.js
  3. 10 10
      pages/home/components/topic/topic.wxml
  4. 12 6
      pages/home/home.js
  5. 9 9
      pages/home/home.wxml
  6. 13 4
      pages/home/home.wxss
  7. 19 19
      pages/sonTopic/sonTopic.js

+ 2 - 2
components/tab/tab.wxss

@@ -17,7 +17,7 @@
   padding-bottom: 2px;
 }
 .Tab .active .item{
-  border-bottom-color:red;
-  color: red;
+  border-bottom-color:#1989fa;
+  color: #1989fa;
   padding-bottom: 2px;
 }

+ 21 - 25
pages/home/components/topic/topic.js

@@ -27,12 +27,16 @@ Component({
         let n = this.data.title;
         this.isUp && clearInterval(this.isUp);
         this.isUp = setInterval(() => {
-          this.getData({ topic_name: n });
-          this.getPing({ topic_name: n });
-          this.getAccount({ topic_name: n, platform: "ALL", type: "all" });
+          this.getData({ topic_name: n, season: this.data.select - 0 + 1 });
+          this.getPing({ topic_name: n, season: this.data.select - 0 + 1 });
+          this.getAccount({ topic_name: n, platform: "ALL", type: "all", season: this.data.select - 0 + 1 });
         }, 3000);
       }
     },
+    select: {
+      type: String,
+      value: ""
+    },
     title: {
       type: String,
       value: "",
@@ -44,14 +48,14 @@ Component({
           selectme: "30d",
           selectori: "30d",
         })
-        this.getData({ topic_name: n });
-        this.getPing({ topic_name: n });
-        this.getAccount({ topic_name: n, platform: "ALL", type: "all" });
-        this.getAccount({ topic_name: n, platform: "douyin", type: "douyin" });
-        this.getAccount({ topic_name: n, platform: "kuaishou", type: "kuaishou" });
-        this.getAccount({ topic_name: n, platform: "yangshi", type: "yangshi" });
-        // this.getWorld();
-        this.getWeibo({ topic_name: n, time: "30d" })
+        this.getData({ topic_name: n, season: this.data.select - 0 + 1 });
+        this.getPing({ topic_name: n, season: this.data.select - 0 + 1 });
+        this.getAccount({ topic_name: n, platform: "ALL", type: "all", season: this.data.select - 0 + 1 });
+        this.getAccount({ topic_name: n, platform: "douyin", type: "douyin", season: this.data.select - 0 + 1 });
+        this.getAccount({ topic_name: n, platform: "kuaishou", type: "kuaishou", season: this.data.select - 0 + 1 });
+        this.getAccount({ topic_name: n, platform: "yangshi", type: "yangshi", season: this.data.select - 0 + 1 });
+        // this.getWorld({ season: this.data.select - 0 + 1 });
+        this.getWeibo({ topic_name: n, time: "30d", season: this.data.select - 0 + 1 })
       }
     },
     type: {
@@ -115,37 +119,29 @@ Component({
       this.setData({
         selectread: val.detail
       })
-      this.getWeibo({ topic_name: this.data.title, time: val.detail }, "read")
+      this.getWeibo({ topic_name: this.data.title, time: val.detail, season: this.data.select - 0 + 1 }, "read")
     },
     lineChengeme: function (val) {
       this.setData({
         selectme: val.detail
       })
-      this.getWeibo({ topic_name: this.data.title, time: val.detail }, "me")
+      this.getWeibo({ topic_name: this.data.title, time: val.detail, season: this.data.select - 0 + 1 }, "me")
     },
     lineChengeori: function (val) {
       this.setData({
         selectori: val.detail
       })
-      this.getWeibo({ topic_name: this.data.title, time: val.detail }, "ori")
+      this.getWeibo({ topic_name: this.data.title, time: val.detail, season: this.data.select - 0 + 1 }, "ori")
     },
     getData: function (data) {
       const _this = this;
-      /**
-       * @description
-       * data
-       * topic_name: 聚劲延安
-       */
       wx.request({
         url: app.baseUrl + '/overview',
         success: function (res) {
           if (res.statusCode === 200) {
-            let oldHead = JSON.stringify(_this.data.headData);
-            let newHead = JSON.stringify(res.data || {});
-            if (oldHead != newHead)
-              _this.setData({
-                headData: res.data || {}
-              })
+            _this.setData({
+              headData: res.data || {}
+            })
           } else _this.setData({
             error: '请重启后查看'
           })

+ 10 - 10
pages/home/components/topic/topic.wxml

@@ -3,20 +3,20 @@
 
 <view class="topic">
   <view class="topicTable">
-    <view class="topicItem">总浏览量:</view>
-    <view class="topicItem">{{filter.valueFormat(headData.total_pv)}}</view>
-    <view class="topicItem">原创量:</view>
-    <view class="topicItem">{{filter.valueFormat(headData.total_ori)}}</view>
+    <view wx:if="{{headData.total_pv}}" class="topicItem">总浏览量:</view>
+    <view wx:if="{{headData.total_pv}}" class="topicItem">{{filter.valueFormat(headData.total_pv)}}</view>
+    <view wx:if="{{headData.total_ori}}" class="topicItem">原创量:</view>
+    <view wx:if="{{headData.total_ori}}" class="topicItem">{{filter.valueFormat(headData.total_ori)}}</view>
   </view>
   <view class="topicTable">
-    <view class="topicItem">总点赞数:</view>
-    <view class="topicItem">{{filter.valueFormat(headData.total_digg)}}</view>
-    <view class="topicItem">总评论数:</view>
-    <view class="topicItem">{{filter.valueFormat(headData.total_comment)}}</view>
+    <view wx:if="{{headData.total_digg}}" class="topicItem">总点赞数:</view>
+    <view wx:if="{{headData.total_digg}}" class="topicItem">{{filter.valueFormat(headData.total_digg)}}</view>
+    <view wx:if="{{headData.total_comment}}" class="topicItem">总评论数:</view>
+    <view wx:if="{{headData.total_comment}}" class="topicItem">{{filter.valueFormat(headData.total_comment)}}</view>
   </view>
   <view class="topicTable">
-    <view class="topicItem">总转发量:</view>
-    <view class="topicItem">{{filter.valueFormat(headData.total_forward)}}</view>
+    <view wx:if="{{headData.total_comment}}"  class="topicItem">总转发量:</view>
+    <view wx:if="{{headData.total_comment}}"  class="topicItem">{{filter.valueFormat(headData.total_forward)}}</view>
     <view class="topicItem"></view>
     <view class="topicItem"></view>
   </view>

+ 12 - 6
pages/home/home.js

@@ -82,6 +82,8 @@ Page({
 
   getData: function (data) {
     const _this = this;
+    let params = data || {};
+    params.season = this.data.select - 0 + 1;
     wx.request({
       url: app.baseUrl + '/overview',
       success: function (res) {
@@ -114,16 +116,20 @@ Page({
             })
           const setD = {
             tabList: tab,
-            tablelist
+            tablelist,
+            jsonURL: tab[0].worldURL || "",
+            imgURL: tab[0].worldImgURL || "",
+            indexNum: tab[0].index || 0,
+            isUpdata: tab[0].isUpdata
           }
-          !_this.data.type && (setD.type = tab[0].type);
-          !_this.data.title && (setD.title = tab[0].name);
+          _this.data.type !== tab[0].type && (setD.type = tab[0].type);
+          _this.data.title !== tab[0].name && (setD.title = tab[0].name);
           _this.setData(setD)
         } else _this.setData({
           error: '请重启后查看'
         })
       },
-      data,
+      data:params,
       fail: function (err) {
         this.setData({
           error: '数据错误'
@@ -145,9 +151,9 @@ Page({
     })
   },
   bindPickerChange(r) {
-    console.log(r.detail.value)
     this.setData({
-      select: r.detail.value
+      select: r.detail.value,
+      type: 0
     }, () => {
       this.getData()
     })

+ 9 - 9
pages/home/home.wxml

@@ -1,16 +1,16 @@
 <!--pages/home/home.wxml-->
 <view class="basePage home">
-  <view>
-    <picker bindchange="bindPickerChange" value="{{select}}" range="{{activityList}}">
-      <view class="picker">
-        选择话题:我爱我的家乡-{{activityList[select]}}
-      </view>
-    </picker>
-    <view class="tabScrollBtn">
+  <view class="activity">
+    <view class="actbtn">
+      <picker bindchange="bindPickerChange" value="{{select}}" range="{{activityList}}">
+          <button style="color: #fff;width:100%;background-color: #1989fa" class="mini-btn" type="default" size="mini">{{activityList[select]}}</button>
+      </picker>
+    </view>
+    <view class="btnGrounp">
       <tab tabList="{{tabList}}" type="{{type}}" bindchangeBar="changeBar"></tab>
     </view>
   </view>
-  <home wx:if="{{ type === -1 }}" tablelist="{{tablelist}}" />
-  <topic wx:if="{{ type !== -1 }}" isUpdata="{{isUpdata}}" isShow="{{isShow}}" type="{{type}}" title="{{title}}"
+  <home wx:if="{{ type === -1 }}" tablelist="{{tablelist}}" select="{{select}}" />
+  <topic wx:if="{{ type !== -1 }}" isUpdata="{{isUpdata}}" select="{{select}}" isShow="{{isShow}}" type="{{type}}" title="{{title}}"
     jsonURL="{{jsonURL}}" imgURL="{{imgURL}}" sonList="{{tabList[indexNum].childList || []}}" />
 </view>

+ 13 - 4
pages/home/home.wxss

@@ -16,8 +16,17 @@
   top: 100px;
 }
 
-.picker{
-  padding-left: 10rpx;
-  font-weight: 500;
-  font-size: 16px;
+.activity{
+  width: 750rpx;
+}
+.activity .actbtn{
+  width: 160rpx;
+  vertical-align: middle;
+  padding: 14px 0;
+  display: inline-block;
+}
+.activity .btnGrounp{
+  width: 590rpx;
+  vertical-align: middle;
+  display: inline-block;
 }

+ 19 - 19
pages/sonTopic/sonTopic.js

@@ -53,14 +53,14 @@ Page({
       type,
       sonTitle: second_name
     })
-    this.getData({ topic_name: second_name || title });
-    this.getPing({ topic_name: second_name || title });
-    this.getAccount({ topic_name: second_name || title, platform: "ALL", type: "all" });
-    this.getAccount({ topic_name: second_name || title, platform: "douyin", type: "douyin" });
-    this.getAccount({ topic_name: second_name || title, platform: "kuaishou", type: "kuaishou" });
-    this.getAccount({ topic_name: second_name || title, platform: "yangshi", type: "yangshi" });
-    // this.getWorld();
-    this.getWeibo({ topic_name: second_name || title, time: "30d", type: "yangshi" });
+    this.getData({ topic_name: second_name || title, season: this.data.select - 0 + 1  });
+    this.getPing({ topic_name: second_name || title, season: this.data.select - 0 + 1  });
+    this.getAccount({ topic_name: second_name || title, platform: "ALL", type: "all", season: this.data.select - 0 + 1  });
+    this.getAccount({ topic_name: second_name || title, platform: "douyin", type: "douyin", season: this.data.select - 0 + 1  });
+    this.getAccount({ topic_name: second_name || title, platform: "kuaishou", type: "kuaishou", season: this.data.select - 0 + 1  });
+    this.getAccount({ topic_name: second_name || title, platform: "yangshi", type: "yangshi", season: this.data.select - 0 + 1  });
+    // this.getWorld({ season: this.data.select - 0 + 1 });
+    this.getWeibo({ topic_name: second_name || title, time: "30d", type: "yangshi", season: this.data.select - 0 + 1  });
   },
 
   /**
@@ -118,19 +118,19 @@ Page({
     this.setData({
       selectread: val.detail
     })
-    this.getWeibo({ topic_name: this.data.sonTitle, time: val.detail, type: "weiboread" }, "read")
+    this.getWeibo({ topic_name: this.data.sonTitle, time: val.detail, type: "weiboread", season: this.data.select - 0 + 1 }, "read")
   },
   lineChengeme: function (val) {
     this.setData({
       selectme: val.detail
     })
-    this.getWeibo({ topic_name: this.data.sonTitle, time: val.detail, type: "weibome" }, "me")
+    this.getWeibo({ topic_name: this.data.sonTitle, time: val.detail, type: "weibome", season: this.data.select - 0 + 1 }, "me")
   },
   lineChengeori: function (val) {
     this.setData({
       selectori: val.detail
     })
-    this.getWeibo({ topic_name: this.data.sonTitle, time: val.detail, type: "weiboori" }, "ori")
+    this.getWeibo({ topic_name: this.data.sonTitle, time: val.detail, type: "weiboori", season: this.data.select - 0 + 1 }, "ori")
   },
 
   getData: function (data) {
@@ -324,14 +324,14 @@ Page({
       selectori: "30d",
       sonTitle: second_name
     })
-    this.getData({ topic_name: second_name });
-    this.getPing({ topic_name: second_name });
-    this.getAccount({ topic_name: second_name, platform: "ALL", type: "all" });
-    this.getAccount({ topic_name: second_name, platform: "douyin", type: "douyin" });
-    this.getAccount({ topic_name: second_name, platform: "kuaishou", type: "kuaishou" });
-    this.getAccount({ topic_name: second_name, platform: "yangshi", type: "yangshi" });
-    // this.getWorld();
+    this.getData({ topic_name: second_name, season: this.data.select - 0 + 1 });
+    this.getPing({ topic_name: second_name, season: this.data.select - 0 + 1 });
+    this.getAccount({ topic_name: second_name, platform: "ALL", type: "all", season: this.data.select - 0 + 1 });
+    this.getAccount({ topic_name: second_name, platform: "douyin", type: "douyin", season: this.data.select - 0 + 1 });
+    this.getAccount({ topic_name: second_name, platform: "kuaishou", type: "kuaishou", season: this.data.select - 0 + 1 });
+    this.getAccount({ topic_name: second_name, platform: "yangshi", type: "yangshi", season: this.data.select - 0 + 1 });
+    // this.getWorld({ season: this.data.select - 0 + 1 });
 
-    this.getWeibo({ topic_name: second_name, time: "30d", type: "yangshi" });
+    this.getWeibo({ topic_name: second_name, time: "30d", type: "yangshi", season: this.data.select - 0 + 1 });
   }
 })