Browse Source

推荐页改版

bayi 1 year atrás
parent
commit
f8b95d91c9
5 changed files with 59 additions and 51 deletions
  1. 0 1
      components/authority/index.js
  2. 5 5
      custom-tab-bar/index.js
  3. 18 14
      pages/index/index.js
  4. 35 30
      pages/index/index.wxml
  5. 1 1
      pages/works/index.js

+ 0 - 1
components/authority/index.js

@@ -6,7 +6,6 @@ Component({
     },
   },
   data: {
-
   },
   methods: {
     jumpReading({

+ 5 - 5
custom-tab-bar/index.js

@@ -35,16 +35,16 @@ Component({
             "iconPath": "/static/activity.png",
             "selectedIconPath": "/static/activity2.png"
         }, {
-            "pagePath": "/pages/works/index",
-            "text": "作品",
-            "iconPath": "/static/zp.png",
-            "selectedIconPath": "/static/zp2.png"
-        }, {
             "pagePath": "/pages/index/index",
             "text": "推荐",
             "iconPath": "/static/tj.png",
             "selectedIconPath": "/static/tj2.png"
         }, {
+            "pagePath": "/pages/works/index",
+            "text": "作品",
+            "iconPath": "/static/zp.png",
+            "selectedIconPath": "/static/zp2.png"
+        }, {
             "pagePath": "/pages/my/index",
             "text": "我的",
             "iconPath": "/static/my.png",

+ 18 - 14
pages/index/index.js

@@ -20,7 +20,7 @@ Page({
     data: {
         navBarHeight: app.globalData.navBarHeight,
         background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
-        currentType: '2',
+        currentType: '3',
         // 控制一级分类是否固定
         isFixed: false,
         desktopTips: app.globalData.desktopTips,
@@ -56,7 +56,7 @@ Page({
     onShow() {
         if (typeof this.getTabBar === 'function') {
             this.getTabBar().setData({
-                selected: 3
+                selected: 2
             })
         }
     },
@@ -79,18 +79,19 @@ Page({
         if (!this.data.userInfo.grade) {
             return
         }
-        if (this.data.currentType == '2') {
+        if (this.data.currentType == '3') {
             this.localGetData(getHotrecommendList, {
                 grade: this.data.userInfo.grade
             })
-        } else if (this.data.currentType == '1') {
-            let list = await getAuthorityList({
-                grade: this.data.userInfo.grade
-            })
-            this.setData({
-                list
-            })
         }
+        /* else if (this.data.currentType == '1') {
+                   let list = await getAuthorityList({
+                       grade: this.data.userInfo.grade
+                   })
+                   this.setData({
+                       list
+                   })
+               } */
     },
     jumpChildClassify({
         currentTarget
@@ -150,9 +151,9 @@ Page({
         this.resetData()
         this.getCategoryList()
         this.getBannerList()
-        if (this.data.currentType == 7) {
-            this.selectComponent('#activityList').getActivities()
-        }
+        /*  if (this.data.currentType != 3) {
+             this.selectComponent('#activityList').getActivities()
+         } */
     },
     selectType({
         target
@@ -165,7 +166,10 @@ Page({
                 currentType: target.dataset.type,
                 list: [],
             })
-            if (target.dataset.type != '7') {
+            if (target.dataset.type != 3) {
+                this.selectComponent('#activityList').getActivities()
+            }
+            if (target.dataset.type == '3') {
                 this.resetData()
             }
         }

+ 35 - 30
pages/index/index.wxml

@@ -1,35 +1,40 @@
 <navigationBar bind:reload='requestAgain'></navigationBar>
 <view class="recommend">
-  <banner bannerList="{{bannerList}}" />
-  <!-- 加桌提示 -->
-  <view class=" desktopTips" wx:if="{{desktopTips}}" style="top:{{navBarHeight+3}}px" bindtap="closeDesktop">
-    <view class="triangle"></view>
-    <image src="http://reader-wx.ai160.com/images/reader/v3/desktop-android.png" class="tipsImg" />
-  </view>
-  <!-- 滚动定位 -->
-  <view class="scrollBox {{isFixed?'isFixed':''}}" style="top:{{navBarHeight}}px;">
-    <!-- 一级分类区域 -->
-    <scroll-view class="firstClassify" scroll-x="true" enhanced show-scrollbar="{{false}}">
-      <view class="firstBox" wx:for="{{categoryList}}" wx:key="id" data-item='{{item}}' bindtap="jumpChildClassify">
-        <image class="icon" src="{{item.icon}}" />
-        <view class="name">{{item.title}}</view>
-      </view>
-    </scroll-view>
-    <!-- 展示类型选择 -->
-    <view class="selectType {{isFixed?'isFixed2':''}}" bindtap="selectType">
-      <view class="type {{currentType=='7'?'currentType':''}}" data-type='7'>排行榜</view>
-      <view class="type {{currentType=='2'?'currentType':''}}" data-type='2'>作品展播</view>
-      <view class="type {{currentType=='1'?'currentType':''}}" data-type='1'>官方推荐</view>
-      <view class="search" bindtap="jumpSearch">
-        <image src="/static/search.png" class="searchImg" />
-      </view>
+    <banner bannerList="{{bannerList}}" />
+    <!-- 加桌提示 -->
+    <view class=" desktopTips" wx:if="{{desktopTips}}" style="top:{{navBarHeight+3}}px" bindtap="closeDesktop">
+        <view class="triangle"></view>
+        <image src="http://reader-wx.ai160.com/images/reader/v3/desktop-android.png" class="tipsImg" />
     </view>
-  </view>
-  <!-- 当一级分类固定定位时占位用的元素 -->
-  <view class="{{isFixed?'brace':''}}" />
-  <!-- 优秀作品展播及官方推荐列表组件 -->
-  <worksList id="worksList" wx:if="{{currentType=='2'}}" worksList="{{list}}" videoType="public" tabBarPadding='true' />
-  <activityList id="activityList" classify='2' wx:if="{{currentType=='7'}}" />
-  <authority worksList="{{list}}" wx:if="{{currentType=='1'}}" />
+    <!-- 滚动定位 -->
+    <view class="scrollBox {{isFixed?'isFixed':''}}" style="top:{{navBarHeight}}px;">
+        <!-- 一级分类区域 -->
+        <scroll-view class="firstClassify" scroll-x="true" enhanced show-scrollbar="{{false}}">
+            <view class="firstBox" wx:for="{{categoryList}}" wx:key="id" data-item='{{item}}'
+                bindtap="jumpChildClassify">
+                <image class="icon" src="{{item.icon}}" />
+                <view class="name">{{item.title}}</view>
+            </view>
+        </scroll-view>
+        <!-- 展示类型选择 -->
+        <view class="selectType {{isFixed?'isFixed2':''}}" bindtap="selectType">
+            <view class="type {{currentType=='2'?'currentType':''}}" data-type='2'>排行榜</view>
+            <view class="type {{currentType=='3'?'currentType':''}}" data-type='3'>作品展播</view>
+            <!-- <view class="type {{currentType=='1'?'currentType':''}}" data-type='1'>官方推荐</view> -->
+            <view class="type {{currentType=='1'?'currentType':''}}" data-type='1'>官方活动</view>
+            <view class="search" bindtap="jumpSearch">
+                <image src="/static/search.png" class="searchImg" />
+            </view>
+        </view>
+    </view>
+    <!-- 当一级分类固定定位时占位用的元素 -->
+    <view class="{{isFixed?'brace':''}}" />
+    <!-- 优秀作品展播及官方推荐列表组件 -->
+    <worksList id="worksList" wx:if="{{currentType=='3'}}" worksList="{{list}}" videoType="public" tabBarPadding='true'
+        autoPlay='{{false}}' />
+    <view hidden="{{currentType=='3'}}">
+        <activityList id="activityList" classify='{{currentType}}' />
+    </view>
+    <!--   <authority worksList="{{list}}" wx:if="{{currentType=='1'}}" /> -->
 </view>
 <canvas id='share' type="2d"> </canvas>

+ 1 - 1
pages/works/index.js

@@ -29,7 +29,7 @@ Page({
   onShow() {
     if (typeof this.getTabBar === 'function') {
       this.getTabBar().setData({
-        selected: 2
+        selected: 3
       })
     }
     this.getLocUserInfo()