12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- const app = getApp()
- import {
- getBannerList
- } from '~/api/global'
- import {
- getSelfRead
- } from '~/api/user'
- import {
- getFollowWorks
- } from '~/api/works'
- import reachBottom from '~/mixins/reachBottom'
- Page({
- behaviors: [reachBottom],
- data: {
- bannerList: [],
- // 1关注的人的作品,2是自己的作品
- currentType: '1',
- },
- onShow() {
- if (typeof this.getTabBar === 'function') {
- this.getTabBar().setData({
- selected: 2
- })
- }
- let uid = wx.getStorageSync('uid')
- if (uid) {
- this.resetData()
- } else {
- getApp().callBack = (res) => {
- this.resetData()
- }
- }
- },
- loadMore() {
- if (this.data.currentType == '1') {
- this.getData(getFollowWorks, {})
- } else if (this.data.currentType == '2') {
- this.getData(getSelfRead, {})
- }
- },
- async getFollowWorks() {
- let res = await getFollowWorks()
- console.log(res);
- },
- changeType({
- target
- }) {
- if (target.dataset.type) {
- this.setData({
- currentType: target.dataset.type
- })
- this.resetData()
- }
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- this.loadMore()
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|