|
@@ -1,94 +0,0 @@
|
|
|
-const app = getApp()
|
|
|
-import {
|
|
|
- createStoreBindings
|
|
|
-} from 'mobx-miniprogram-bindings'
|
|
|
-import {
|
|
|
- getCategoryList,
|
|
|
- getResourceList
|
|
|
-} from "~/api/works"
|
|
|
-import share from '~/mixins/share'
|
|
|
-import event from '~/mixins/event'
|
|
|
-import reachBottom from '~/mixins/reachBottom'
|
|
|
-import {
|
|
|
- store
|
|
|
-} from '~/store/index'
|
|
|
-Page({
|
|
|
- behaviors: [reachBottom, share, event],
|
|
|
- data: {
|
|
|
- navBarHeight: app.globalData.navBarHeight,
|
|
|
- categoryList: [],
|
|
|
- listOptions: {},
|
|
|
- },
|
|
|
- onShow() {
|
|
|
- if (typeof this.getTabBar === 'function') {
|
|
|
- this.getTabBar().setData({
|
|
|
- selected: 0
|
|
|
- })
|
|
|
- }
|
|
|
- this.getLocUserInfo()
|
|
|
- if (Object.keys(this.data.userInfo).length > 0) {
|
|
|
- this.requestAgain()
|
|
|
- } else {
|
|
|
- getApp().callBack = (res) => {
|
|
|
- this.getLocUserInfo()
|
|
|
- this.requestAgain()
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- requestAgain() {
|
|
|
- this.resetData()
|
|
|
- this.getCategoryList()
|
|
|
- },
|
|
|
- async loadMore() {
|
|
|
- if (!this.data.userInfo.grade) {
|
|
|
- return
|
|
|
- }
|
|
|
- let data = await getResourceList({
|
|
|
- grade: this.data.userInfo.grade
|
|
|
- })
|
|
|
- this.setData({
|
|
|
- listOptions: data,
|
|
|
- })
|
|
|
- },
|
|
|
- async getCategoryList() {
|
|
|
- let grade = this.data.userInfo.grade
|
|
|
- let categoryList = await getCategoryList({
|
|
|
- grade
|
|
|
- })
|
|
|
- this.setData({
|
|
|
- categoryList
|
|
|
- })
|
|
|
- },
|
|
|
- jumpChildClassify({
|
|
|
- currentTarget
|
|
|
- }) {
|
|
|
- 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) {}
|
|
|
- })
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
- this.storeBindings.destroyStoreBindings()
|
|
|
- },
|
|
|
- async getLocUserInfo() {
|
|
|
- this.storeBindings = createStoreBindings(this, {
|
|
|
- store,
|
|
|
- fields: {
|
|
|
- userInfo: 'userInfo'
|
|
|
- },
|
|
|
- })
|
|
|
- this.storeBindings.updateStoreBindings()
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
- this.storeBindings.destroyStoreBindings()
|
|
|
- },
|
|
|
-})
|