Commit 6fbc53fd by chenshu

fix:修复

parent 34e9e15f
...@@ -14,7 +14,7 @@ import { ...@@ -14,7 +14,7 @@ import {
Radio, Radio,
message, message,
Modal, Modal,
Cascader, TreeSelect,
Select, Select,
Switch, Switch,
TimePicker, TimePicker,
...@@ -101,6 +101,8 @@ class AddOfflineCourse extends React.Component { ...@@ -101,6 +101,8 @@ class AddOfflineCourse extends React.Component {
whetherSetSignIn: 'YES', whetherSetSignIn: 'YES',
whetherSetSignOut: 'YES', whetherSetSignOut: 'YES',
isEditDisablie: false, isEditDisablie: false,
startTime: new Date().getTime() + 300000, // 批量开始时分
endTime: new Date().getTime() + 300000, // 批量结束时分
} }
} }
...@@ -128,11 +130,29 @@ class AddOfflineCourse extends React.Component { ...@@ -128,11 +130,29 @@ class AddOfflineCourse extends React.Component {
//获取分类列表 //获取分类列表
getCourseCatalogList = ()=>{ getCourseCatalogList = ()=>{
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) => {
this.setState({ const { categoryList = [] } = res.result;
courseCatalogList: res.result.categoryList this.setState({
}) courseCatalogList: this.renderTreeNodes(categoryList),
})
}); });
} }
renderTreeNodes = (data) => {
let newTreeData = data.map((item) => {
item.title = (
<span>
{item.categoryName}
</span>
);
item.value = item.id;
item.key = item.id;
if (item.sonCategoryList) {
item.children = this.renderTreeNodes(item.sonCategoryList);
}
return item;
});
return newTreeData;
};
catalogChange= (value, options) => { catalogChange= (value, options) => {
this.setState({ categoryId: _.last(value), categoryName: _.pluck(options, 'categoryName').join('-') }) this.setState({ categoryId: _.last(value), categoryName: _.pluck(options, 'categoryName').join('-') })
...@@ -699,6 +719,10 @@ class AddOfflineCourse extends React.Component { ...@@ -699,6 +719,10 @@ class AddOfflineCourse extends React.Component {
} }
} }
handleChangeCatalogList = (value) => {
this.setState({ categoryId: value });
};
render() { render() {
const { const {
courseId, courseId,
...@@ -706,7 +730,7 @@ class AddOfflineCourse extends React.Component { ...@@ -706,7 +730,7 @@ class AddOfflineCourse extends React.Component {
courseName, courseName,
coverUrl, coverUrl,
introduce, introduce,
categoryName, categoryId,
courseCatalogList, courseCatalogList,
whetherVisitorsJoin, whetherVisitorsJoin,
loadintroduce, loadintroduce,
...@@ -791,31 +815,18 @@ class AddOfflineCourse extends React.Component { ...@@ -791,31 +815,18 @@ class AddOfflineCourse extends React.Component {
</div> </div>
<div className="course-catalog"> <div className="course-catalog">
<span className="label"><span className="require">*</span>课程分类:</span> <span className="label"><span className="require">*</span>课程分类:</span>
{ (pageType === 'add') && <TreeSelect
<Cascader style={{ width: 240 }}
showSearch dropdownStyle={{ maxHeight: 240, overflow: "auto" }}
defaultValue={categoryName ? [categoryName] : undefined} treeData={courseCatalogList}
options={courseCatalogList} placeholder="请选择课程类型"
displayRender={ label => label.join('-')} allowClear
fieldNames={fieldNames} value={categoryId}
onChange={this.catalogChange} treeDefaultExpandAll
style={{ width: 240 }} onChange={(value) => {
placeholder="请选择课程分类" suffixIcon={<span className="icon iconfont" style={{ fontSize: '12px', color: '#BFBFBF' }}>&#xe835;</span>} this.handleChangeCatalogList(value);
/> }}
} />
{ (pageType === 'edit' && categoryName ) &&
<Cascader
showSearch
defaultValue={[categoryName]}
options={courseCatalogList}
displayRender={ label => label.join('-')}
fieldNames={fieldNames}
onChange={this.catalogChange}
style={{ width: 240 }}
placeholder="请选择课程分类"
suffixIcon={<span className="icon iconfont" style={{ fontSize: '12px', color: '#BFBFBF' }}>&#xe835;</span>}
/>
}
</div> </div>
<div className="course-catalog"> <div className="course-catalog">
<span className="label"><span className="require">*</span>上课地点:</span> <span className="label"><span className="require">*</span>上课地点:</span>
...@@ -1071,6 +1082,7 @@ class AddOfflineCourse extends React.Component { ...@@ -1071,6 +1082,7 @@ class AddOfflineCourse extends React.Component {
}} }}
/> />
<span className="switch-label"></span> <span className="switch-label"></span>
<span className="switch-tip">未填写时默认为不限制</span>
</div>} </div>}
</div> </div>
</div> </div>
......
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