|
@@ -1,11 +1,11 @@
|
|
|
const app = getApp()
|
|
|
import {
|
|
|
- getHotrecommendList,
|
|
|
+ getCategoryList,
|
|
|
+ getResourceList
|
|
|
} from "~/api/works"
|
|
|
import {
|
|
|
getBannerList
|
|
|
} from '~/api/global'
|
|
|
-import reachBottom from '~/mixins/reachBottom'
|
|
|
import event from '~/mixins/event'
|
|
|
import share from '~/mixins/share'
|
|
|
import {
|
|
@@ -15,15 +15,13 @@ import {
|
|
|
store
|
|
|
} from '~/store/index'
|
|
|
Page({
|
|
|
- behaviors: [reachBottom, share,event],
|
|
|
+ behaviors: [share, event],
|
|
|
data: {
|
|
|
navBarHeight: app.globalData.navBarHeight,
|
|
|
- background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
|
|
|
- currentType: '3',
|
|
|
- // 控制一级分类是否固定
|
|
|
- isFixed: false,
|
|
|
desktopTips: app.globalData.desktopTips,
|
|
|
- bannerList: []
|
|
|
+ bannerList: [],
|
|
|
+ categoryList: [],
|
|
|
+ listOptions: {},
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
this.getLocUserInfo()
|
|
@@ -57,11 +55,10 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- onUnload() {
|
|
|
- this.storeBindings.destroyStoreBindings()
|
|
|
- },
|
|
|
- onReachBottom() {
|
|
|
- this.loadMore()
|
|
|
+ requestAgain() {
|
|
|
+ this.getBannerList()
|
|
|
+ this.getResource()
|
|
|
+ this.getCategoryList()
|
|
|
},
|
|
|
async getLocUserInfo() {
|
|
|
this.storeBindings = createStoreBindings(this, {
|
|
@@ -72,43 +69,21 @@ Page({
|
|
|
})
|
|
|
this.storeBindings.updateStoreBindings()
|
|
|
},
|
|
|
- async loadMore() {
|
|
|
- if (!this.data.userInfo.grade) {
|
|
|
- return
|
|
|
- }
|
|
|
- if (this.data.currentType == '3') {
|
|
|
- this.localGetData(getHotrecommendList, {
|
|
|
- grade: this.data.userInfo.grade
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- jumpSearch() {
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/childClassify/index?type=search',
|
|
|
+ async getCategoryList() {
|
|
|
+ let grade = this.data.userInfo.grade
|
|
|
+ let categoryList = await getCategoryList({
|
|
|
+ grade
|
|
|
})
|
|
|
- },
|
|
|
- /**
|
|
|
- * 监听页面滚动事件
|
|
|
- */
|
|
|
- onPageScroll(e) {
|
|
|
- if (e.scrollTop >= 103 && !this.data.isFixed) {
|
|
|
- this.setData({
|
|
|
- isFixed: true
|
|
|
- })
|
|
|
- } else if (e.scrollTop < 103 && this.data.isFixed) {
|
|
|
- this.setData({
|
|
|
- isFixed: false
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- closeDesktop() {
|
|
|
this.setData({
|
|
|
- desktopTips: false
|
|
|
+ categoryList
|
|
|
})
|
|
|
- wx.setStorage({
|
|
|
- key: "preDesktopTime",
|
|
|
- data: new Date()
|
|
|
+ },
|
|
|
+ async getResource() {
|
|
|
+ let data = await getResourceList({
|
|
|
+ grade: this.data.userInfo.grade
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ listOptions: data,
|
|
|
})
|
|
|
},
|
|
|
async getBannerList() {
|
|
@@ -119,30 +94,31 @@ Page({
|
|
|
bannerList,
|
|
|
})
|
|
|
},
|
|
|
- requestAgain() {
|
|
|
- this.resetData()
|
|
|
- this.getBannerList()
|
|
|
- if (this.data.currentType != 3) {
|
|
|
- this.selectComponent('#activityList').getActivities()
|
|
|
- }
|
|
|
- },
|
|
|
- selectType({
|
|
|
- target
|
|
|
+ jumpChildClassify({
|
|
|
+ currentTarget
|
|
|
}) {
|
|
|
- if (target.dataset.type) {
|
|
|
- if (this.selectComponent('#worksList')) {
|
|
|
- this.selectComponent('#worksList').resetAudio()
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- currentType: target.dataset.type,
|
|
|
- })
|
|
|
- if (target.dataset.type != 3) {
|
|
|
- this.selectComponent('#activityList').getActivities()
|
|
|
- }
|
|
|
- if (target.dataset.type == '3') {
|
|
|
- this.resetData()
|
|
|
- }
|
|
|
- }
|
|
|
+ let firstInfo = currentTarget.dataset.item
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/pages/childClassify/index?type=class&title=${firstInfo.title}&id=${firstInfo.id}`,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showTips() {
|
|
|
+ wx.showModal({
|
|
|
+ title: '新栏目更新中',
|
|
|
+ content: '敬请期待….',
|
|
|
+ showCancel: false,
|
|
|
+ confirmColor: '#333333',
|
|
|
+ success(res) {}
|
|
|
+ })
|
|
|
+ },
|
|
|
+ closeDesktop() {
|
|
|
+ this.setData({
|
|
|
+ desktopTips: false
|
|
|
+ })
|
|
|
+ wx.setStorage({
|
|
|
+ key: "preDesktopTime",
|
|
|
+ data: new Date()
|
|
|
+ })
|
|
|
},
|
|
|
onUnload() {
|
|
|
this.storeBindings.destroyStoreBindings()
|