1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import {
- getBannerList
- } from '~/api/global'
- import {
- createStoreBindings
- } from 'mobx-miniprogram-bindings'
- import {
- store
- } from '~/store/index'
- Page({
- data: {
- activityList: true,
- bannerList: []
- },
- onShow() {
- if (typeof this.getTabBar === 'function') {
- this.getTabBar().setData({
- selected: 1
- })
- this.storeBindings = createStoreBindings(this, {
- store,
- fields: {
- userInfo: 'userInfo'
- },
- })
- this.storeBindings.updateStoreBindings()
- this.setData({
- activityList: true
- })
- this.getBannerList()
- }
- },
- 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()
- },
- onUnload() {
- this.storeBindings.destroyStoreBindings()
- },
- })
|