You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
979 B
JavaScript
45 lines
979 B
JavaScript
2 years ago
|
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;
|