// pages/stock/index.js const util = require('../../../utils/util') import { userPushFollowMill } from "../../../api/ztb" import { getMillPaperList } from "../../../api/moment" const app = getApp() var requesting = false Component({ options: { addGlobalClass: true, multipleSlots: true }, properties: { item: { type: Object, value: null }, mclick: { type: Boolean, value: true } }, data: { unflod: false, loading: false, itemList: [2] }, methods: { onFlodTap: function(){ this.setData({ unflod: !this.data.unflod }) if(!this.data.itemList.length){ this.fetchItemList() } }, attention: function(){ if (this.data.loading) { return } if(!app.globalData.userInfo){ util.navigateTo('/pages/login/index') return } this.setData({ loading: true }) userPushFollowMill({ paperMillId: 1, follow: true }).then(result => { this.setData({ loading: false }) }).catch(err => { this.setData({ loading: false }) }) }, lookItem: function(e){ util.navigateTo('/pages/article/detail/index?id=' + this.data.item.id) }, fetchItemList: function(){ if (requesting) { return } requesting = true getMillPaperList({ paperMillId: 1, date: '' }).then(result => { if (result.data.records.length) { this.setData({ orderList: result.data.records }) } else { requesting = false } }).catch(err => { requesting = false }) }, agentOrder: function(e){ } } })