liyongli 3 years ago
parent
commit
e572942bb4

+ 1 - 0
components/table/filter.wxs

@@ -1,6 +1,7 @@
 // fliter
 function valueFormat(val) {
   var out = val;
+  if(!out) return "-"
   if (val >= 10000 && val < 100000000) {
     out = (val / 10000).toFixed(2) - 0 + '万';
   } else if (val >= 100000000) {

+ 22 - 12
pages/home/components/topic/topic.wxml

@@ -3,22 +3,32 @@
 
 <view class="topic">
   <view class="topicTable">
-    <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 wx:if="{{headData.total_pv != -1}}" class="topicItem">总浏览量:</view>
+    <view wx:if="{{headData.total_pv != -1}}" class="topicItem">{{filter.valueFormat(headData.total_pv)}}</view>
+    <view wx:if="{{headData.total_ori != -1}}" class="topicItem">原创量:</view>
+    <view wx:if="{{headData.total_ori != -1}}" class="topicItem">{{filter.valueFormat(headData.total_ori)}}</view>
   </view>
   <view class="topicTable">
-    <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 wx:if="{{headData.total_digg != -1}}" class="topicItem">总点赞数:</view>
+    <view wx:if="{{headData.total_digg != -1}}" class="topicItem">{{filter.valueFormat(headData.total_digg)}}</view>
+    <view wx:if="{{headData.total_comment != -1}}" class="topicItem">总评论数:</view>
+    <view wx:if="{{headData.total_comment != -1}}" class="topicItem">{{filter.valueFormat(headData.total_comment)}}</view>
   </view>
   <view class="topicTable">
-    <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 wx:if="{{headData.total_comment != -1}}"  class="topicItem">总转发量:</view>
+    <view wx:if="{{headData.total_comment != -1}}"  class="topicItem">{{filter.valueFormat(headData.total_forward)}}</view>
+    <view class="topicItem">
+      <view wx:if="{{headData.live_uv != -1}}">观看人数:</view>
+    </view>
+    <view class="topicItem">
+      <view wx:if="{{headData.live_uv != -1}}">{{filter.valueFormat(headData.live_uv)}}</view>
+    </view>
+  </view>
+  <view class="topicTable">
+    <view wx:if="{{headData.live_digg != -1}}"  class="topicItem">直播点赞:</view>
+    <view wx:if="{{headData.live_digg != -1}}"  class="topicItem">{{filter.valueFormat(headData.live_digg)}}</view>
+    <view wx:if="{{headData.live_comment != -1}}"  class="topicItem">直播弹幕:</view>
+    <view wx:if="{{headData.live_comment != -1}}"  class="topicItem">{{filter.valueFormat(headData.live_comment)}}</view>
   </view>
   <view class="pKvm">
     <view class="kvm" bindtap="toSecond" wx:if="{{sonList && sonList.length}}">

+ 8 - 3
pages/home/home.js

@@ -6,6 +6,7 @@ Page({
    * 页面的初始数据
    */
   data: {
+    actName: "第一季",
     activityList: ["第一季", "第二季"],
     select: "1",
     pageName: "话题",
@@ -109,7 +110,7 @@ Page({
               worldImgURL: v.word_cloud_url
             }
           })
-          if (_this.data.select === "0")
+          if (_this.data.select == "0")
             tab.unshift({
               name: "话题对比",
               type: -1
@@ -151,9 +152,13 @@ Page({
     })
   },
   bindPickerChange(r) {
+    // let v = r.detail.value;
+    let v = this.data.select == 0 ? 1: 0;
+    let actName = v === 1 ? "第一季" : "第二季"
     this.setData({
-      select: r.detail.value,
-      type: 0
+      select: v,
+      type: 0,
+      actName
     }, () => {
       this.getData()
     })

+ 5 - 4
pages/home/home.wxml

@@ -2,15 +2,16 @@
 <view class="basePage home">
   <view class="activity">
     <view class="actbtn">
-      <picker bindchange="bindPickerChange" value="{{select}}" range="{{activityList}}">
-          <button style="color: #fff;width:90%;background-color: #1989fa;" class="mini-btn" type="default" size="mini">{{activityList[select]}}</button>
-      </picker>
+      <!-- <picker bindchange="bindPickerChange" value="{{select}}" range="{{activityList}}">
+          <button style="color: #fff;width:90%;background-color: #1989fa;" class="mini-btn" type="default" size="mini">{{actName}}</button>
+      </picker> -->
+      <button bindtap="bindPickerChange" style="color: #fff;width:90%;background-color: #1989fa;" class="mini-btn" type="default" size="mini">{{actName}}</button>
     </view>
     <view class="btnGrounp">
       <tab tabList="{{tabList}}" type="{{type}}" bindchangeBar="changeBar"></tab>
     </view>
   </view>
   <home wx:if="{{ type === -1 }}" tablelist="{{tablelist}}" select="{{select}}" />
-  <topic wx:if="{{ type !== -1 }}" isUpdata="{{isUpdata}}" select="{{select}}" isShow="{{isShow}}" type="{{type}}" title="{{title}}"
+  <topic wx:if="{{ type > -1 }}" isUpdata="{{isUpdata}}" select="{{select}}" isShow="{{isShow}}" type="{{type}}" title="{{title}}"
     jsonURL="{{jsonURL}}" imgURL="{{imgURL}}" sonList="{{tabList[indexNum].childList || []}}" />
 </view>

+ 10 - 10
pages/sonTopic/sonTopic.wxml

@@ -4,20 +4,20 @@
   <view class="mainTitle">{{pTitle}}</view>
   <tab tabList="{{tabList}}" type="{{type}}" bindchangeBar="changeBar"></tab>
   <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 != -1}}" class="topicItem">总浏览量:</view>
+    <view wx:if="{{headData.total_pv != -1}}" class="topicItem">{{filter.valueFormat(headData.total_pv)}}</view>
+    <view wx:if="{{headData.total_ori != -1}}" class="topicItem">原创量:</view>
+    <view wx:if="{{headData.total_ori != -1}}" 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 != -1}}" class="topicItem">总点赞数:</view>
+    <view wx:if="{{headData.total_digg != -1}}" class="topicItem">{{filter.valueFormat(headData.total_digg)}}</view>
+    <view wx:if="{{headData.total_comment != -1}}" class="topicItem">总评论数:</view>
+    <view wx:if="{{headData.total_comment != -1}}" 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_forward != -1}}" class="topicItem">总转发量:</view>
+    <view wx:if="{{headData.total_forward != -1}}" class="topicItem">{{filter.valueFormat(headData.total_forward)}}</view>
     <view class="topicItem"></view>
     <view class="topicItem"></view>
   </view>