react-app-shell
Version:
react打包脚本和example, 这里的版本请忽略
46 lines (38 loc) • 1.11 kB
JavaScript
import { observable, action } from 'mobx';
import { feedbackService } from '../service';
import { shareConfig } from '../config';
const defaultShareOptions = shareConfig.feedback;
/**
* 团购状态管理
*/
class FeedBackStore {
feedback = {};
shareOptions = {};
serviceError = {
isError: false,
code: 'OK',
msg: ''
};
getFeedBackData = async (id, isShare) => {
try {
const data = await feedbackService.getReportData(id, isShare);
this.feedback = data;
this.shareOptions = {
...defaultShareOptions,
title: `我家${data.studentName}刚刚完成一节魔力耳朵外教课,快来围观吧~`,
link: `${window.location.protocol}//${window.location.host}${
window.location.pathname
}?feedbacksharing=${true}`
};
} catch (e) {
// TODO 异常处理
console.error(e);
this.serviceError = {
isError: true,
code: e.code,
msg: e.msg || '系统异常,请稍后重试'
};
}
};
}
export default new FeedBackStore();