Commit 0072911c by chenshu

feat:初始化

parent e27c81aa
......@@ -41,37 +41,24 @@ export default class OfflineCourseData extends React.Component {
componentDidMount() {
this.getOfflineBasic();
this.getOfflineCalendar();
}
getOfflineBasic = () => {
const { courseId } = this.state;
const { courseId, currentIndex } = this.state;
Service.Hades('public/hades/getOfflineCourseJoinBase', { courseId }).then((res) => {
if (res.success) {
const { result } = res;
const calendarTime = result.calendarTime || [];
const currentDate = calendarTime[currentIndex];
this.setState({
courseName: result.courseName,
fullJoin: result.fullJoin || 0,
totalJoin: result.totalJoin || 0,
});
}
})
}
getOfflineCalendar = () => {
const { courseId, currentIndex } = this.state;
Service.Hades('public/customerHades/offlineDateList', { courseId }).then((res) => {
if (res.success) {
const timeList = _.sortBy(_.pluck(res.result, 'date'));
const group = _.groupBy(timeList, item => moment(item).format('YYYY年M月'));
const calendarTime = _.map(group, (value, key) => ({ key, value }));
const currentDate = calendarTime[currentIndex].value[0];
this.setState({
calendarTime,
currentDate,
}, () => this.getDateDetail())
}, () => this.getDateDetail());
}
});
})
}
getDateDetail = (current = 1) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment