Commit 1eeefb2b by chenshu

fix:修复

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