Sfoglia il codice sorgente

1.banner调整2.图片详情

bayi 2 anni fa
parent
commit
e63524cb47

+ 1 - 1
components/activityList/index.wxml

@@ -1,6 +1,6 @@
 <wxs src="../../utils/filter.wxs" module="filters" />
 <view class="activityList">
-  <!--  <view class="activityBox" wx:for="{{activityList}}" wx:key="id">
+  <!-- <view class="activityBox" wx:for="{{activityList}}" wx:key="id">
     <image src="" class="cover" />
     <view class="footer">
       <view class="info">

+ 46 - 43
components/banner/index.js

@@ -1,49 +1,52 @@
 import {
-    getBannerList
+  getBannerList
 } from '~/api/global'
 Component({
-    properties: {
-        classify: {
-            type: Number,
-            value: 1
-        }
-    },
-    data: {
-        bannerList: []
+  properties: {
+    // banner的classify是:1:官方推荐;2:作品展播;3:官方活动;4:关注作品;5:我的作品;
+    classify: {
+      type: Number,
+      value: 1,
+      observer(newVal) {
+        this.getBannerList()
+      }
+    }
+  },
+  data: {
+    bannerList: [],
+    current: 0
+  },
+  methods: {
+    async getBannerList() {
+      let bannerList = await getBannerList(this.properties.classify)
+      this.setData({
+        bannerList,
+        current: 0
+      })
     },
-    lifetimes: {
-        attached() {
-            this.getBannerList()
-        },
+    bannelEvent({
+      currentTarget
+    }) {
+      console.log(currentTarget);
+      //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章
+      let {
+        type,
+        id,
+        content
+      } = currentTarget.dataset
+      if ([2, 3, 4].includes(type)) {
+        wx.navigateTo({
+          url: `/pages/ranking/index?id=${id}&type=${type}`,
+        })
+      } else if (type == 5) {
+        wx.navigateTo({
+          url: '/pages/match/index',
+        })
+      } else if (type == 1) {
+        wx.navigateTo({
+          url: `/pages/rankIntro/index?img=${content}`,
+        })
+      }
     },
-    /**
-     * 组件的方法列表
-     */
-    methods: {
-        async getBannerList() {
-            let bannerList = await getBannerList(this.properties.classify)
-            this.setData({
-                bannerList
-            })
-        },
-        bannelEvent({
-            currentTarget
-        }) {
-            //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章
-            let {
-                type,
-                id
-            } = currentTarget.dataset
-            if ([2, 3, 4].includes(type)) {
-                wx.navigateTo({
-                    url: `/pages/ranking/index?id=${id}&type=${type}`,
-                })
-            }
-            if (type == 5) {
-                wx.navigateTo({
-                    url: '/pages/match/index',
-                })
-            }
-        },
-    }
+  }
 })

+ 9 - 8
components/banner/index.wxml

@@ -1,10 +1,11 @@
 <view class="header">
-    <view class="headerBg"></view>
-    <swiper class="swiper" autoplay circular indicator-dots indicator-active-color="#fff" indicator-color='#ecececa1'>
-        <block wx:for="{{bannerList}}" wx:key="id">
-            <swiper-item bindtap='bannelEvent' data-type='{{item.type}}' data-id="{{item.content}}">
-                <image src="{{item.icon}}" class="swiper-item" mode="" />
-            </swiper-item>
-        </block>
-    </swiper>
+  <view class="headerBg"></view>
+  <swiper class="swiper" autoplay circular indicator-dots="{{bannerList.length>1}}" indicator-active-color="#fff"
+    indicator-color='#ecececa1' current="{{current}}">
+    <block wx:for="{{bannerList}}" wx:key="id">
+      <swiper-item bindtap='bannelEvent' data-type='{{item.type}}' data-id="{{item.id}}" data-content="{{item.content}}">
+        <image src="{{item.icon}}" class="swiper-item" mode="" />
+      </swiper-item>
+    </block>
+  </swiper>
 </view>

+ 3 - 3
pages/index/index.js

@@ -17,7 +17,7 @@ Page({
   data: {
     navBarHeight: app.globalData.navBarHeight,
     background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
-    currentType: '1',
+    currentType: '2',
     // 控制一级分类是否固定
     isFixed: false,
     desktopTips: app.globalData.desktopTips,
@@ -70,11 +70,11 @@ Page({
     if (!this.data.userInfo.grade) {
       return
     }
-    if (this.data.currentType == '1') {
+    if (this.data.currentType == '2') {
       this.getData(getHotrecommendList, {
         grade: this.data.userInfo.grade
       })
-    } else if (this.data.currentType == '2') {
+    } else if (this.data.currentType == '1') {
       this.getData(getAuthorityList, {
         grade: this.data.userInfo.grade
       })

+ 3 - 3
pages/index/index.wxml

@@ -1,6 +1,6 @@
 <navigationBar bind:reload='resetData'></navigationBar>
 <view class="recommend">
-  <banner classify='1' />
+  <banner classify='{{currentType}}' />
   <!-- 加桌提示 -->
   <view class="desktopTips" wx:if="{{desktopTips}}" style="top:{{navBarHeight+3}}px" bindtap="closeDesktop">
     <view class="triangle"></view>
@@ -19,8 +19,8 @@
     </scroll-view>
     <!-- 展示类型选择 -->
     <view class="selectType {{isFixed?'isFixed2':''}}" bindtap="selectType">
-      <view class="type {{currentType=='1'?'currentType':''}}" data-type='1'>作品展播</view>
-      <view class="type {{currentType=='2'?'currentType':''}}" data-type='2'>官方推荐</view>
+      <view class="type {{currentType=='2'?'currentType':''}}" data-type='2'>作品展播</view>
+      <view class="type {{currentType=='1'?'currentType':''}}" data-type='1'>官方推荐</view>
       <view class="type {{currentType=='3'?'currentType':''}}" data-type='3'>官方活动</view>
       <view class="search" bindtap="jumpSearch">
         <image src="/static/search.png" class="searchImg" />

+ 0 - 3
pages/rankIntro/index.js

@@ -1,13 +1,10 @@
-// pages/rankIntro/index.js
 Page({
-
     /**
      * 页面的初始数据
      */
     data: {
         explain: ""
     },
-
     /**
      * 生命周期函数--监听页面加载
      */

+ 1 - 1
pages/rankIntro/index.json

@@ -1,4 +1,4 @@
 {
     "usingComponents": {},
-    "navigationBarTitleText": "说明"
+    "navigationBarTitleText": ""
 }

+ 1 - 2
pages/rankIntro/index.wxml

@@ -1,4 +1,3 @@
 <view class="rankInfoBox">
-  <image src="{{explain}}" mode="widthFix" />
-  <!-- <image src="/static/ewm.png" mode="widthFix" show-menu-by-longpress="{{true}}" /> -->
+  <image src="{{explain}}" mode="widthFix" show-menu-by-longpress="{{true}}" />
 </view>

+ 4 - 8
pages/works/index.js

@@ -15,8 +15,8 @@ Page({
   data: {
     navBarHeight: app.globalData.navBarHeight,
     bannerList: [],
-    // 1关注的人的作品,2是自己的作品
-    currentType: '1',
+    // 4关注作品,5我的作品
+    currentType: '4',
     isFixed: false
   },
   onShow() {
@@ -35,16 +35,12 @@ Page({
     }
   },
   loadMore() {
-    if (this.data.currentType == '1') {
+    if (this.data.currentType == '4') {
       this.getData(getFollowWorks, {})
-    } else if (this.data.currentType == '2') {
+    } else if (this.data.currentType == '5') {
       this.getData(getSelfRead, {})
     }
   },
-  async getFollowWorks() {
-    let res = await getFollowWorks()
-    console.log(res);
-  },
   changeType({
     target
   }) {

+ 5 - 5
pages/works/index.wxml

@@ -1,15 +1,15 @@
 <navigationBar bind:reload='resetData'></navigationBar>
 <view class="worksBox">
   <!-- 轮播图 -->
-  <banner classify='1' />
+  <banner classify='{{currentType}}' />
   <!-- 切换类型 -->
   <view class="selectType {{isFixed?'isFixed isFixed2':''}}" style="top:{{navBarHeight}}px;" bindtap="changeType">
-    <view class="type {{currentType=='1'?'currentType':''}}" data-type='1'>关注作品</view>
-    <view class="type {{currentType=='2'?'currentType':''}}" data-type='2'>我的作品</view>
+    <view class="type {{currentType=='4'?'currentType':''}}" data-type='4'>关注作品</view>
+    <view class="type {{currentType=='5'?'currentType':''}}" data-type='5'>我的作品</view>
   </view>
   <!-- 优秀作品展播及官方推荐列表组件 -->
-  <worksList id="worksList" videoType="{{currentType=='1'?'pk':'my'}}" worksList="{{list}}" tabBarPadding='true'
+  <worksList id="worksList" videoType="{{currentType=='4'?'pk':'my'}}" worksList="{{list}}" tabBarPadding='true'
     autoPlay='{{false}}' />
-  <emptyBg wx:if="{{nullList}}" message="{{currentType=='1'?'您还没有关注的用户哦':'您还没有作品哦,赶快去发表吧'}}"></emptyBg>
+  <emptyBg wx:if="{{nullList}}" message="{{currentType=='4'?'您还没有关注的用户哦':'您还没有作品哦,赶快去发表吧'}}"></emptyBg>
 </view>
 <canvas id='share' type="2d"> </canvas>