|
@@ -4,6 +4,9 @@ import {
|
|
|
getAuthorityList,
|
|
|
getCategoryList
|
|
|
} from "~/api/works"
|
|
|
+import {
|
|
|
+ getBannerList
|
|
|
+} from '~/api/global'
|
|
|
import reachBottom from '~/mixins/reachBottom'
|
|
|
import share from '~/mixins/share'
|
|
|
import {
|
|
@@ -17,12 +20,13 @@ 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,
|
|
|
isIOS: app.globalData.isIOS,
|
|
|
- categoryList: []
|
|
|
+ categoryList: [],
|
|
|
+ bannerList: []
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
@@ -35,11 +39,11 @@ Page({
|
|
|
}
|
|
|
this.getLocUserInfo()
|
|
|
if (Object.keys(this.data.userInfo).length > 0) {
|
|
|
- this.resetData()
|
|
|
+ this.requestAgain()
|
|
|
} else {
|
|
|
getApp().callBack = (res) => {
|
|
|
this.getLocUserInfo()
|
|
|
- this.resetData()
|
|
|
+ this.requestAgain()
|
|
|
}
|
|
|
}
|
|
|
let {
|
|
@@ -72,7 +76,7 @@ Page({
|
|
|
})
|
|
|
this.storeBindings.updateStoreBindings()
|
|
|
},
|
|
|
- loadMore() {
|
|
|
+ async loadMore() {
|
|
|
if (!this.data.userInfo.grade) {
|
|
|
return
|
|
|
}
|
|
@@ -81,11 +85,13 @@ Page({
|
|
|
grade: this.data.userInfo.grade
|
|
|
})
|
|
|
} else if (this.data.currentType == '1') {
|
|
|
- this.localGetData(getAuthorityList, {
|
|
|
+ let list = await getAuthorityList({
|
|
|
grade: this.data.userInfo.grade
|
|
|
})
|
|
|
+ this.setData({
|
|
|
+ list
|
|
|
+ })
|
|
|
}
|
|
|
- this.getCategoryList()
|
|
|
},
|
|
|
jumpChildClassify({
|
|
|
currentTarget
|
|
@@ -124,28 +130,44 @@ Page({
|
|
|
categoryList
|
|
|
})
|
|
|
},
|
|
|
+ closeDesktop() {
|
|
|
+ this.setData({
|
|
|
+ desktopTips: false
|
|
|
+ })
|
|
|
+ wx.setStorage({
|
|
|
+ key: "preDesktopTime",
|
|
|
+ data: new Date()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async getBannerList() {
|
|
|
+ let bannerList = await getBannerList({
|
|
|
+ grade: this.data.userInfo.grade,
|
|
|
+ classify: this.data.currentType
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ bannerList,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ requestAgain() {
|
|
|
+ this.resetData()
|
|
|
+ this.getCategoryList()
|
|
|
+ this.getBannerList()
|
|
|
+ },
|
|
|
selectType({
|
|
|
target
|
|
|
}) {
|
|
|
if (target.dataset.type) {
|
|
|
- if (target.dataset.type == '7') {
|
|
|
+ if (this.selectComponent('#worksList')) {
|
|
|
this.selectComponent('#worksList').resetAudio()
|
|
|
}
|
|
|
this.setData({
|
|
|
- currentType: target.dataset.type
|
|
|
+ currentType: target.dataset.type,
|
|
|
+ list: [],
|
|
|
})
|
|
|
if (target.dataset.type != '7') {
|
|
|
this.resetData()
|
|
|
}
|
|
|
+ this.getBannerList()
|
|
|
}
|
|
|
},
|
|
|
- closeDesktop() {
|
|
|
- this.setData({
|
|
|
- desktopTips: false
|
|
|
- })
|
|
|
- wx.setStorage({
|
|
|
- key: "preDesktopTime",
|
|
|
- data: new Date()
|
|
|
- })
|
|
|
- }
|
|
|
})
|