Commit 1eeefb2b by chenshu

fix:修复

parent 67f6b381
......@@ -75,6 +75,7 @@ class AddOfflineCourse extends React.Component {
showCutModal: false, // 是否显示截图弹窗
studentModal: false,
categoryName:null, //分类名称
categoryList: [],
courseCatalogList:[], //分类列表
categoryId:null, //分类的Id值
whetherVisitorsJoin: 'NO', // 是否允许游客加入
......@@ -132,6 +133,7 @@ class AddOfflineCourse extends React.Component {
Service.Hades('public/hades/queryCategoryTree', { source: 0, tenantId: User.getStoreId(), count: false, userId: User.getUserId() }).then((res) => {
const { categoryList = [] } = res.result;
this.setState({
categoryList,
courseCatalogList: this.renderTreeNodes(categoryList),
})
});
......@@ -139,11 +141,7 @@ class AddOfflineCourse extends React.Component {
renderTreeNodes = (data) => {
let newTreeData = data.map((item) => {
item.title = (
<span>
{item.categoryName}
</span>
);
item.title = item.categoryName;
item.value = item.id;
item.key = item.id;
if (item.sonCategoryList) {
......@@ -160,12 +158,13 @@ class AddOfflineCourse extends React.Component {
// 获取线下课详情
handleFetchScheudleDetail = (courseId) => {
Service.Hades('public/hades/getOfflineCourseDetail',{
return Service.Hades('public/hades/getOfflineCourseDetail',{
courseId
}).then((res) => {
const { result = {} } = res || {};
const {
courseName,
courseState,
categoryId,
offlinePlace,
whetherVisitorsJoin,
......@@ -247,6 +246,7 @@ class AddOfflineCourse extends React.Component {
signOutType,
isEditDisablie: whetherHaveApply === 'YES',
});
return courseState === 'UN_START';
})
}
......@@ -463,6 +463,11 @@ class AddOfflineCourse extends React.Component {
return new Blob([ab], { type: "image/png" });
};
preSubmit = () => {
const { courseId } = this.state;
courseId ? this.handleFetchScheudleDetail().then(bool => bool && this.handleSubmit()) : this.handleSubmit();
}
// 保存
handleSubmit = () => {
const {
......@@ -470,7 +475,6 @@ class AddOfflineCourse extends React.Component {
coverId,
pageType,
courseName,
courseMedia,
introduce,
categoryId,
offlinePlace,
......@@ -612,7 +616,7 @@ class AddOfflineCourse extends React.Component {
message.warning('上课时间不能早于现在');
resolve(false);
} else if(data.startTime > data.endTime){
message.warning('上课结束时间需大于报名开始时间');
message.warning('上课结束时间不能早于上课开始时间');
resolve(false);
} else if(data.whetherSetApply === 'YES' && !data.startTimeApply){
message.warning('请选择报名时间');
......@@ -731,6 +735,7 @@ class AddOfflineCourse extends React.Component {
coverUrl,
introduce,
categoryId,
categoryList,
courseCatalogList,
whetherVisitorsJoin,
loadintroduce,
......@@ -816,8 +821,10 @@ class AddOfflineCourse extends React.Component {
<div className="course-catalog">
<span className="label"><span className="require">*</span>课程分类:</span>
<TreeSelect
showSearch
treeNodeFilterProp="title"
style={{ width: 240 }}
dropdownStyle={{ maxHeight: 240, overflow: "auto" }}
dropdownStyle={{ maxHeight: 300, overflow: "auto" }}
treeData={courseCatalogList}
placeholder="请选择课程类型"
allowClear
......@@ -1096,7 +1103,7 @@ class AddOfflineCourse extends React.Component {
this.setState({
whetherSetSignIn: value ? 'YES' : 'NO',
signInType: 'START_AGO',
signInTimeNum: 1,
signInTimeNum: null,
signInTimeUnit: 'MINUTE',
})
}}
......@@ -1162,9 +1169,9 @@ class AddOfflineCourse extends React.Component {
this.setState({
whetherSetSignOut: value ? 'YES' : 'NO',
signOutType: 'START_LATER',
signOutStartTimeNum: 1,
signOutStartTimeNum: null,
signOutStartTimeUnit: 'MINUTE',
signOutEndTimeNum: 1,
signOutEndTimeNum: null,
signOutEndTimeUnit: 'MINUTE',
})
}}
......@@ -1255,7 +1262,7 @@ class AddOfflineCourse extends React.Component {
<div className="footer">
<Button onClick={this.handleGoBack}>取消</Button>
<Button onClick={this.handleShowPreviewModal}>预览</Button>
<Button type="primary" onClick={_.debounce(() => this.handleSubmit(), 3000, true)}>保存</Button>
<Button type="primary" onClick={_.debounce(() => this.preSubmit(), 3000, true)}>保存</Button>
</div>
{showSelectCoverModal &&
......
......@@ -59,7 +59,9 @@ export default class QRCodeModal extends React.Component {
qrcodeWrapDom1 && qrcodeWrapDom1.appendChild(qrcodeNode1);
qrcodeWrapDom2 && qrcodeWrapDom2.childNodes[0] && qrcodeWrapDom2.removeChild(qrcodeWrapDom2.childNodes[0]);
qrcodeWrapDom2 && qrcodeWrapDom2.appendChild(qrcodeNode2);
setTimeout(() => {
this.initQRCode();
}, 300)
})
}
......
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