Commit 6a5d8f97 by chenshu

feat:初始化

parent 0273bd91
......@@ -57,11 +57,11 @@ class AddOfflineCourse extends React.Component {
constructor(props) {
super(props);
const id = getParameterByName("id");
const courseId = getParameterByName("id");
const pageType = getParameterByName("type");
this.state = {
id, // 线下课ID,编辑的时候从URL上带过来
courseId, // 线下课ID,编辑的时候从URL上带过来
pageType, // 页面类型: add->新建 edit->编辑
imageFile: null, // 需要被截取的图片
courseName: null, // 线下课名称
......@@ -89,7 +89,7 @@ class AddOfflineCourse extends React.Component {
calendarTime: [],
offlineCourseType: 'ANY_DAY_POFFLINE',
signInType: 'START_AGO',
signOutType: 'START_AGO',
signOutType: 'START_LATER',
quota: 1,
signInTimeNum: 1,
signOutEndTimeNum: 1,
......@@ -104,11 +104,11 @@ class AddOfflineCourse extends React.Component {
}
componentWillMount() {
const { id, pageType } = this.state;
const { courseId, pageType } = this.state;
this.getCourseCatalogList();
this.getTeacherList();
if (pageType === 'edit') {
this.handleFetchScheudleDetail(id);
this.handleFetchScheudleDetail(courseId);
}
}
......@@ -150,11 +150,23 @@ class AddOfflineCourse extends React.Component {
const { result = {} } = res || {};
const {
courseName,
categoryId,
offlinePlace,
whetherVisitorsJoin,
whetherSetApply,
whetherSetSignIn,
whetherSetSignOut,
teacherId,
teacherName,
offlineCourseType,
startTime,
endTime,
startTimeApply,
endTimeApply,
quota,
calendarTime,
courseMediaVOS,
categoryOneName,
categoryTwoName,
categoryId
categoryName,
} = result;
let coverId;
let coverUrl = this.state.coverUrl;
......@@ -178,21 +190,27 @@ class AddOfflineCourse extends React.Component {
}
return item;
})
let categoryName;
if( categoryTwoName ){
categoryName = `${categoryOneName}-${categoryTwoName}`;
}else{
categoryName = `${categoryOneName}`;
}
this.setState({
loadintroduce: !hasIntro,
coverId,
coverUrl,
categoryName,
courseName,
categoryId,
offlinePlace,
whetherVisitorsJoin,
categoryName,
categoryId
whetherSetApply,
whetherSetSignIn,
whetherSetSignOut,
teacherId,
teacherName,
offlineCourseType,
startTime,
endTime,
startTimeApply,
endTimeApply,
quota,
calendarTime,
});
})
}
......@@ -429,7 +447,7 @@ class AddOfflineCourse extends React.Component {
// 保存
handleSubmit = () => {
const {
id,
courseId,
coverId,
pageType,
courseName,
......@@ -449,6 +467,15 @@ class AddOfflineCourse extends React.Component {
startTimeApply,
endTimeApply,
quota,
calendarTime,
signInType,
signInTimeNum,
signInTimeUnit,
signOutType,
signOutStartTimeNum,
signOutStartTimeUnit,
signOutEndTimeNum,
signOutEndTimeUnit,
} = this.state;
let coverObj ={
......@@ -475,6 +502,7 @@ class AddOfflineCourse extends React.Component {
offlineCourseType,
startTime,
endTime,
calendarTime,
};
if (whetherSetApply === 'YES') {
......@@ -494,7 +522,7 @@ class AddOfflineCourse extends React.Component {
commonParams.signOutStartTimeNum = signOutStartTimeNum;
commonParams.signOutStartTimeUnit = signOutStartTimeUnit;
commonParams.signOutEndTimeNum = signOutEndTimeNum;
commonParams.signOutStartTimeUnit = signOutStartTimeUnit;
commonParams.signOutEndTimeUnit = signOutEndTimeUnit;
}
// 校验必填字段:课程名称, 课程线下
......@@ -502,7 +530,7 @@ class AddOfflineCourse extends React.Component {
if (!res) return;
Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => {
this.submitRemote({
id,
courseId,
pageType,
commonParams,
introduceId,
......@@ -512,7 +540,7 @@ class AddOfflineCourse extends React.Component {
}
submitRemote = (data) => {
const { id, pageType, commonParams, introduceId } = data;
const { courseId, pageType, commonParams, introduceId } = data;
commonParams.introduceId = introduceId;
if (pageType === 'add') {
Service.Hades('public/hades/createOfflineCourse', commonParams).then((res) => {
......@@ -524,10 +552,10 @@ class AddOfflineCourse extends React.Component {
})
} else {
const editParams = {
courseId:id,
courseId:courseId,
...commonParams,
}
Service.Hades('public/hades/editMediaCourse', editParams).then((res) => {
Service.Hades('public/hades/updateOfflineCourse', editParams).then((res) => {
if (!res) return;
message.success("保存成功");
window.RCHistory.push({
......@@ -632,7 +660,7 @@ class AddOfflineCourse extends React.Component {
render() {
const {
id,
courseId,
pageType,
courseName,
coverUrl,
......@@ -784,7 +812,7 @@ class AddOfflineCourse extends React.Component {
>
{_.map(teacherList, (item, index) => {
return (
<Option value={item.userId} key={item.userId}>{item.nickName}</Option>
<Option value={item.id} key={item.id}>{item.nickName}</Option>
);
})}
</Select>
......@@ -808,7 +836,7 @@ class AddOfflineCourse extends React.Component {
<div className="content">
<div className="intro-list">
<div className="intro-list__item introduce-editor">
{(!id || loadintroduce) &&
{(!courseId || loadintroduce) &&
<GraphicsEditor
id="intro"
isIntro={true}
......@@ -987,10 +1015,10 @@ class AddOfflineCourse extends React.Component {
}}
className="mt5"
>
<Radio value="START_AGO" className="mr-16">
<Radio value="START_LATER" className="mr-16">
<span style={{ color: "#333" }}>课程开始后</span>
</Radio>
<Radio value="END_AGO" className="mr-16">
<Radio value="END_LATER" className="mr-16">
<span style={{ color: "#333" }}>课程结束后</span>
</Radio>
</Radio.Group>
......
......@@ -217,7 +217,7 @@ class OfflineCourseList extends React.Component {
this.setState({
RelatedPlanModalVisible: true,
selectCourseId: item.id,
selectCourseId: item.courseId,
selectPlanList: selectPlanList,
})
}
......@@ -256,13 +256,13 @@ class OfflineCourseList extends React.Component {
className="operate__item"
key="edit"
onClick={() => {
RCHistory.push(`/create-graphics-course?type=edit&id=${item.id}`);
RCHistory.push(`/create-offline-course?type=edit&id=${item.courseId}`);
}}
>编辑</div>
<div
className="operate__item"
key="delete"
onClick={() => this.handleDeleteOfflineCourse(item.id)}
onClick={() => this.handleDeleteOfflineCourse(item.courseId)}
>删除</div>
</div>
)
......@@ -278,7 +278,7 @@ class OfflineCourseList extends React.Component {
item.shelfState = "NO"
}
const params={
courseId: item.id,
courseId: item.courseId,
shelfState:_shelfState
}
CourseService.changeVideoShelfState(params).then((res)=>{
......@@ -381,7 +381,7 @@ class OfflineCourseList extends React.Component {
}
this.setState({
RelatedPlanModalVisible:true,
selectCourseId:item.id,
selectCourseId:item.courseId,
selectPlanList:selectPlanList
})
}
......@@ -404,11 +404,10 @@ class OfflineCourseList extends React.Component {
const { RelatedPlanModalVisible, selectCourseId, selectPlanList } = this.state;
const { dataSource = [], totalCount, query } = this.props;
const { current, size } = query;
console.log(dataSource, 5555555)
return (
<div className="offline-course-list">
<Table
rowKey={record => record.id}
rowKey={record => record.courseId}
dataSource={dataSource}
columns={this.parseColumns()}
onChange={this.handleChangeTable}
......
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