Selaa lähdekoodia

开发资源模块

bayi 1 vuosi sitten
vanhempi
commit
0239b5663f

+ 4 - 4
app.json

@@ -1,7 +1,7 @@
 {
     "pages": [
         "pages/index/index",
-        "pages/activity/index",
+        "pages/resource/index",
         "pages/message/index",
         "pages/like/index",
         "pages/chat/index",
@@ -31,12 +31,12 @@
     "tabBar": {
         "custom": true,
         "list": [{
-            "pagePath": "pages/activity/index",
-            "text": "活动"
-        }, {
             "pagePath": "pages/works/index",
             "text": "作品"
         }, {
+            "pagePath": "pages/resource/index",
+            "text": "资源"
+        }, {
             "pagePath": "pages/index/index",
             "text": "推荐"
         }, {

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

@@ -30,8 +30,8 @@ Component({
             "iconPath": "/static/message.png",
             "selectedIconPath": "/static/message2.png"
         }, {
-            "pagePath": "/pages/activity/index",
-            "text": "活动",
+            "pagePath": "/pages/resource/index",
+            "text": "资源",
             "iconPath": "/static/activity.png",
             "selectedIconPath": "/static/activity2.png"
         }, {

+ 0 - 67
pages/activity/index.js

@@ -1,67 +0,0 @@
-import {
-  getBannerList
-} from '~/api/global'
-import {
-  createStoreBindings
-} from 'mobx-miniprogram-bindings'
-import {
-  store
-} from '~/store/index'
-Page({
-  data: {
-    activityList: false,
-    bannerList: []
-  },
-  onShow() {
-    if (typeof this.getTabBar === 'function') {
-      this.getTabBar().setData({
-        selected: 1
-      })
-      this.getLocUserInfo()
-      if (Object.keys(this.data.userInfo).length > 0) {
-        this.getBannerList()
-        this.setData({
-          activityList: true
-        })
-      } else {
-        getApp().callBack = (res) => {
-          this.getLocUserInfo()
-          this.getBannerList()
-          this.setData({
-            activityList: true
-          })
-        }
-      }
-
-    }
-  },
-  onHide() {
-    this.setData({
-      activityList: false
-    })
-  },
-  async getBannerList() {
-    let bannerList = await getBannerList({
-      grade: this.data.userInfo.grade,
-    })
-    this.setData({
-      bannerList,
-    })
-  },
-  resetData() {
-    this.selectComponent('#activityList').getActivities()
-    this.getBannerList()
-  },
-  async getLocUserInfo() {
-    this.storeBindings = createStoreBindings(this, {
-      store,
-      fields: {
-        userInfo: 'userInfo'
-      },
-    })
-    this.storeBindings.updateStoreBindings()
-  },
-  onUnload() {
-    this.storeBindings.destroyStoreBindings()
-  },
-})

+ 0 - 9
pages/activity/index.json

@@ -1,9 +0,0 @@
-{
-  "usingComponents": {
-    "navigationBar": "/components/navigationBar/index",
-    "banner": "/components/banner/index",
-    "activityList": "/components/activityList/index"
-  },
-  "navigationStyle": "custom",
-  "enablePullDownRefresh": false
-}

+ 0 - 3
pages/activity/index.less

@@ -1,3 +0,0 @@
-.activityList{
-  margin-top: 30rpx;
-}

+ 0 - 5
pages/activity/index.wxml

@@ -1,5 +0,0 @@
-<navigationBar bind:reload='resetData'></navigationBar>
-<view class="activityBox">
-  <!-- <banner bannerList="{{bannerList}}" /> -->
-  <activityList id="activityList" class="activityList" wx:if="{{activityList}}" />
-</view>

+ 0 - 3
pages/activity/index.wxss

@@ -1,3 +0,0 @@
-.activityList {
-  margin-top: 30rpx;
-}

+ 3 - 14
pages/index/index.js

@@ -1,7 +1,6 @@
 const app = getApp()
 import {
     getHotrecommendList,
-    getAuthorityList,
     getCategoryList
 } from "~/api/works"
 import {
@@ -24,7 +23,6 @@ Page({
         // 控制一级分类是否固定
         isFixed: false,
         desktopTips: app.globalData.desktopTips,
-        isIOS: app.globalData.isIOS,
         categoryList: [],
         bannerList: []
     },
@@ -84,14 +82,6 @@ Page({
                 grade: this.data.userInfo.grade
             })
         }
-        /* else if (this.data.currentType == '1') {
-                   let list = await getAuthorityList({
-                       grade: this.data.userInfo.grade
-                   })
-                   this.setData({
-                       list
-                   })
-               } */
     },
     jumpChildClassify({
         currentTarget
@@ -151,9 +141,9 @@ Page({
         this.resetData()
         this.getCategoryList()
         this.getBannerList()
-        /*  if (this.data.currentType != 3) {
-             this.selectComponent('#activityList').getActivities()
-         } */
+        if (this.data.currentType != 3) {
+            this.selectComponent('#activityList').getActivities()
+        }
     },
     selectType({
         target
@@ -164,7 +154,6 @@ Page({
             }
             this.setData({
                 currentType: target.dataset.type,
-                list: [],
             })
             if (target.dataset.type != 3) {
                 this.selectComponent('#activityList').getActivities()

+ 2 - 4
pages/index/index.wxml

@@ -9,18 +9,17 @@
     <!-- 滚动定位 -->
     <view class="scrollBox {{isFixed?'isFixed':''}}" style="top:{{navBarHeight}}px;">
         <!-- 一级分类区域 -->
-        <scroll-view class="firstClassify" scroll-x="true" enhanced show-scrollbar="{{false}}">
+        <!-- <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>
+        </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" />
@@ -35,6 +34,5 @@
     <view hidden="{{currentType=='3'}}">
         <activityList id="activityList" classify='{{currentType}}' />
     </view>
-    <!--   <authority worksList="{{list}}" wx:if="{{currentType=='1'}}" /> -->
 </view>
 <canvas id='share' type="2d"> </canvas>

+ 61 - 0
pages/resource/index.js

@@ -0,0 +1,61 @@
+import {
+    createStoreBindings
+} from 'mobx-miniprogram-bindings'
+import {
+    getAuthorityList,
+} from "~/api/works"
+import share from '~/mixins/share'
+import reachBottom from '~/mixins/reachBottom'
+import {
+    store
+} from '~/store/index'
+Page({
+    behaviors: [reachBottom, share],
+    data: {},
+
+    onShow() {
+        if (typeof this.getTabBar === 'function') {
+            this.getTabBar().setData({
+                selected: 1
+            })
+        }
+        this.getLocUserInfo()
+        if (Object.keys(this.data.userInfo).length > 0) {
+            this.resetData()
+        } else {
+            getApp().callBack = (res) => {
+                this.getLocUserInfo()
+                this.resetData()
+            }
+        }
+    },
+    async loadMore() {
+        if (!this.data.userInfo.grade) {
+            return
+        }
+        let list = await getAuthorityList({
+            grade: this.data.userInfo.grade
+        })
+        this.setData({
+            list
+        })
+    },
+    onReachBottom() {
+        this.loadMore()
+    },
+    onUnload() {
+        this.storeBindings.destroyStoreBindings()
+    },
+    async getLocUserInfo() {
+        this.storeBindings = createStoreBindings(this, {
+            store,
+            fields: {
+                userInfo: 'userInfo'
+            },
+        })
+        this.storeBindings.updateStoreBindings()
+    },
+    onUnload() {
+        this.storeBindings.destroyStoreBindings()
+    },
+})

+ 8 - 0
pages/resource/index.json

@@ -0,0 +1,8 @@
+{
+    "usingComponents": {
+        "authority": "/components/authority/index",
+        "navigationBar": "/components/navigationBar/index"
+    },
+    "navigationStyle": "custom",
+    "enablePullDownRefresh": false
+}

+ 0 - 0
pages/resource/index.less


+ 4 - 0
pages/resource/index.wxml

@@ -0,0 +1,4 @@
+<navigationBar bind:reload='resetData'></navigationBar>
+<view>
+    <authority worksList="{{list}}" />
+</view>

+ 0 - 0
pages/resource/index.wxss