import { makeAutoObservable, runInAction } from 'mobx'; import * as req from '../utils/request'; import { isEmpty } from '../utils/commons'; /** * 计算变化值 */ const calcRate = (r1, r2) => { // 的 }; class Trade { constructor(rootStore) { this.rootStore = rootStore; makeAutoObservable(this); } fetchSummaryData() { this.summaryData.loading = true; req.fetchJSON('/service-web/QueryData/GetTradeSummary').then((json) => { if (json.errcode === 0) { runInAction(() => { this.summaryData = { loading: false, ...json }; }); } }); } fetchTradeData() { this.yearlyData.loading = true; req.fetchJSON('/service-web/QueryData/GetYJ').then((json) => { if (json.errcode === 0) { runInAction(() => { this.yearlyData = { loading: false, ...json }; }); } }); } summaryData = { loading: false }; yearlyData = { loading: false }; } export default Trade;