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