Commit 0273bd91 by chenshu

feat:初始化

parent 5731608e
...@@ -132,30 +132,19 @@ class AddOfflineCourse extends React.Component { ...@@ -132,30 +132,19 @@ class AddOfflineCourse extends React.Component {
//获取分类列表 //获取分类列表
getCourseCatalogList = ()=>{ getCourseCatalogList = ()=>{
StoreService.getCourseCatalogList({current:1,size:1000}).then((res) => { Service.Hades('public/hades/queryCategoryTree', { source: 0, tenantId: User.getStoreId(), count: false, userId: User.getUserId() }).then((res) => {
this.setState({ this.setState({
courseCatalogList:res.result.records courseCatalogList: res.result.categoryList
}) })
}); });
} }
catalogChange= (value, options) => { catalogChange= (value, options) => {
const changeValueLength = value.length; this.setState({ categoryId: _.last(value), categoryName: _.pluck(options, 'categoryName').join('-') })
switch (changeValueLength){
case 1:
this.setState({ categoryId: value[0], categoryName: options[0].categoryName });
break;
case 2:
this.setState({ categoryId: value[1], categoryName: `${options[0].categoryName}-${options[1].categoryName}` });
break;
default:
this.setState({ categoryId: null, categoryName: '' });
break;
}
} }
// 获取线下课详情 // 获取线下课详情
handleFetchScheudleDetail = (courseId) => { handleFetchScheudleDetail = (courseId) => {
Service.Hades('public/hades/mediaCourseDetail',{ Service.Hades('public/hades/getOfflineCourseDetail',{
courseId courseId
}).then((res) => { }).then((res) => {
const { result = {} } = res || {}; const { result = {} } = res || {};
...@@ -457,6 +446,9 @@ class AddOfflineCourse extends React.Component { ...@@ -457,6 +446,9 @@ class AddOfflineCourse extends React.Component {
offlineCourseType, offlineCourseType,
startTime, startTime,
endTime, endTime,
startTimeApply,
endTimeApply,
quota,
} = this.state; } = this.state;
let coverObj ={ let coverObj ={
...@@ -484,8 +476,29 @@ class AddOfflineCourse extends React.Component { ...@@ -484,8 +476,29 @@ class AddOfflineCourse extends React.Component {
startTime, startTime,
endTime, endTime,
}; };
if (whetherSetApply === 'YES') {
commonParams.startTimeApply = startTimeApply;
commonParams.endTimeApply = endTimeApply;
commonParams.quota = quota;
}
if (whetherSetSignIn === 'YES') {
commonParams.signInType = signInType;
commonParams.signInTimeNum = signInTimeNum;
commonParams.signInTimeUnit = signInTimeUnit;
}
if (whetherSetSignOut === 'YES') {
commonParams.signOutType = signOutType;
commonParams.signOutStartTimeNum = signOutStartTimeNum;
commonParams.signOutStartTimeUnit = signOutStartTimeUnit;
commonParams.signOutEndTimeNum = signOutEndTimeNum;
commonParams.signOutStartTimeUnit = signOutStartTimeUnit;
}
// 校验必填字段:课程名称, 课程线下 // 校验必填字段:课程名称, 课程线下
this.handleValidate(courseName, courseMedia, categoryId).then((res) => { this.handleValidate({ courseName, courseMedia, categoryId }).then((res) => {
if (!res) return; if (!res) return;
Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => { Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => {
this.submitRemote({ this.submitRemote({
...@@ -524,7 +537,8 @@ class AddOfflineCourse extends React.Component { ...@@ -524,7 +537,8 @@ class AddOfflineCourse extends React.Component {
} }
} }
handleValidate = (courseName, courseMedia, categoryId) => { handleValidate = (data) => {
const { courseName, categoryId } = data;
return new Promise((resolve) => { return new Promise((resolve) => {
if (!courseName) { if (!courseName) {
message.warning('请输入课程名称'); message.warning('请输入课程名称');
...@@ -779,7 +793,7 @@ class AddOfflineCourse extends React.Component { ...@@ -779,7 +793,7 @@ class AddOfflineCourse extends React.Component {
<span className="label">观看设置:</span> <span className="label">观看设置:</span>
<div className="content"> <div className="content">
<div> <div>
<Switch checked={whetherVisitorsJoin==="YES"? true:false} onChange={this.whetherVisitorsJoinChange}/> <Switch checked={whetherVisitorsJoin === "YES"? true : false} onChange={this.whetherVisitorsJoinChange}/>
</div> </div>
<div> <div>
<div className="desc"> <div className="desc">
...@@ -880,10 +894,10 @@ class AddOfflineCourse extends React.Component { ...@@ -880,10 +894,10 @@ class AddOfflineCourse extends React.Component {
<span className="label">课程报名:</span> <span className="label">课程报名:</span>
<div className="switch-box"> <div className="switch-box">
<div className="switch-item" key="1"> <div className="switch-item" key="1">
<Switch checked={whetherSetApply} onChange={(value) => this.setState({ whetherSetApply: value })} /> <Switch checked={whetherSetApply === 'YES'} onChange={(value) => this.setState({ whetherSetApply: value ? 'YES' : 'NO' })} />
<span className="switch-tip">开启后可设置课程报名时间,获取报名数据</span> <span className="switch-tip">开启后可设置课程报名时间,获取报名数据</span>
</div> </div>
{whetherSetApply && <div className="switch-item" key="2"> {whetherSetApply === 'YES' && <div className="switch-item" key="2">
<span className="switch-label">报名日期:</span> <span className="switch-label">报名日期:</span>
<RangePicker <RangePicker
id="course_date_picker" id="course_date_picker"
...@@ -894,11 +908,14 @@ class AddOfflineCourse extends React.Component { ...@@ -894,11 +908,14 @@ class AddOfflineCourse extends React.Component {
style={{ width: "calc(100% - 70px)" }} style={{ width: "calc(100% - 70px)" }}
/> />
</div>} </div>}
{whetherSetApply && <div className="switch-item" key="3"> {whetherSetApply === 'YES' && <div className="switch-item" key="3">
<span className="switch-label">报名人数:最多</span> <span className="switch-label">报名人数:最多</span>
<InputNumber <InputNumber
value={signInTimeNum} value={quota}
style={{ margin: '0 4px' }} style={{ margin: '0 4px' }}
onChange={(value) => {
this.setState({ quota: value })
}}
/> />
<span className="switch-label"></span> <span className="switch-label"></span>
</div>} </div>}
...@@ -908,10 +925,10 @@ class AddOfflineCourse extends React.Component { ...@@ -908,10 +925,10 @@ class AddOfflineCourse extends React.Component {
<span className="label">考勤签到:</span> <span className="label">考勤签到:</span>
<div className="switch-box"> <div className="switch-box">
<div className="switch-item" key="1"> <div className="switch-item" key="1">
<Switch checked={whetherSetSignIn} onChange={(value) => this.setState({ whetherSetSignIn: value })} /> <Switch checked={whetherSetSignIn === 'YES'} onChange={(value) => this.setState({ whetherSetSignIn: value ? 'YES' : 'NO' })} />
<span className="switch-tip">开启后可设置获取签到考勤数据</span> <span className="switch-tip">开启后可设置获取签到考勤数据</span>
</div> </div>
{whetherSetSignIn && <div className="switch-item" key="2"> {whetherSetSignIn === 'YES' && <div className="switch-item" key="2">
<span className="switch-label">签到时间:</span> <span className="switch-label">签到时间:</span>
<Radio.Group <Radio.Group
style={{ display: 'inline-block' }} style={{ display: 'inline-block' }}
...@@ -929,10 +946,10 @@ class AddOfflineCourse extends React.Component { ...@@ -929,10 +946,10 @@ class AddOfflineCourse extends React.Component {
</Radio> </Radio>
</Radio.Group> </Radio.Group>
</div>} </div>}
{whetherSetSignIn && <div className="switch-item" key="3"> {whetherSetSignIn === 'YES' && <div className="switch-item" key="3">
<span className="switch-label">课程开始前</span> <span className="switch-label">课程开始前</span>
<InputNumber <InputNumber
value={quota} value={signInTimeNum}
style={{ margin: '0 4px' }} style={{ margin: '0 4px' }}
onChange={(value) => { onChange={(value) => {
this.setState({ signInTimeNum: value }); this.setState({ signInTimeNum: value });
...@@ -957,10 +974,10 @@ class AddOfflineCourse extends React.Component { ...@@ -957,10 +974,10 @@ class AddOfflineCourse extends React.Component {
<span className="label">考勤签退:</span> <span className="label">考勤签退:</span>
<div className="switch-box"> <div className="switch-box">
<div className="switch-item" key="1"> <div className="switch-item" key="1">
<Switch checked={whetherSetSignOut} onChange={(value) => this.setState({ whetherSetSignOut: value })} /> <Switch checked={whetherSetSignOut === 'YES'} onChange={(value) => this.setState({ whetherSetSignOut: value ? 'YES' : 'NO' })} />
<span className="switch-tip">开启后可设置获取签退考勤数据</span> <span className="switch-tip">开启后可设置获取签退考勤数据</span>
</div> </div>
{whetherSetSignOut && <div className="switch-item" key="2"> {whetherSetSignOut === 'YES' && <div className="switch-item" key="2">
<span className="switch-label">签退时间:</span> <span className="switch-label">签退时间:</span>
<Radio.Group <Radio.Group
style={{ display: 'inline-block' }} style={{ display: 'inline-block' }}
...@@ -978,7 +995,7 @@ class AddOfflineCourse extends React.Component { ...@@ -978,7 +995,7 @@ class AddOfflineCourse extends React.Component {
</Radio> </Radio>
</Radio.Group> </Radio.Group>
</div>} </div>}
{whetherSetSignOut && <div className="switch-item" key="3"> {whetherSetSignOut === 'YES' && <div className="switch-item" key="3">
<span className="switch-label">课程开始后</span> <span className="switch-label">课程开始后</span>
<InputNumber <InputNumber
value={signOutStartTimeNum} value={signOutStartTimeNum}
......
...@@ -24,6 +24,7 @@ import User from '@/common/js/user' ...@@ -24,6 +24,7 @@ import User from '@/common/js/user'
import './OfflineCourseList.less'; import './OfflineCourseList.less';
import moment from 'moment';
const ENV = process.env.DEPLOY_ENV || 'dev'; const ENV = process.env.DEPLOY_ENV || 'dev';
const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'; const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png';
...@@ -34,9 +35,9 @@ class OfflineCourseList extends React.Component { ...@@ -34,9 +35,9 @@ class OfflineCourseList extends React.Component {
super(props); super(props);
this.state = { this.state = {
id: '', // 视频课ID id: '', // 视频课ID
studentIds:[], studentIds: [],
RelatedPlanModalVisible:false, RelatedPlanModalVisible: false,
selectPlanList:{} selectPlanList: {},
} }
} }
...@@ -85,30 +86,31 @@ class OfflineCourseList extends React.Component { ...@@ -85,30 +86,31 @@ class OfflineCourseList extends React.Component {
width:321, width:321,
fixed: 'left', fixed: 'left',
render: (val, record) => { render: (val, record) => {
const { coverUrl, scheduleVideoUrl } = record; const { coverUrl, courseName, offlinePlace, calendarTime, startTime, endTime } = record;
return ( return (
<div className="record__item"> <div className="record__item">
<img className="course-cover" src={coverUrl || defaultCoverUrl} /> <img className="course-cover" src={coverUrl || defaultCoverUrl} />
<div> <div>
<Tooltip title={record.courseName}> <Tooltip title={courseName}>
<div className="course-name">{record.courseName}</div> <div className="course-name">{courseName}</div>
</Tooltip> </Tooltip>
<div className="course-text">地点:一行最多二十字超出一行最多二十字超出</div> <div className="course-text">地点:{offlinePlace}</div>
<div className="course-text">12-01 09:00 ~ 01-01 14:00</div> <div className="course-text">{calendarTime.map(item => moment(item).format('MM-DD')).join('、')} {moment(startTime).format('HH:mm')} ~ {moment(endTime).format('HH:mm')}</div>
</div> </div>
</div> </div>
) )
} }
}, },
{ {
title: '上课状态', title: '课程状态',
key: 'courseState', key: 'courseState',
dataIndex: 'courseState', dataIndex: 'courseState',
width: 120, width: 120,
render: (val, record) => { render: (val, record) => {
return ( return (
<div className="record__item"> <div className="course-state">
{ENUM.offlineStateShow[val]} <div style={{ width: 6, height: 6, borderRadius: '50%', background: ENUM.offlineStateShow[val].color, marginRight: 8 }}></div>
{ENUM.offlineStateShow[val].title}
</div> </div>
) )
} }
...@@ -121,7 +123,7 @@ class OfflineCourseList extends React.Component { ...@@ -121,7 +123,7 @@ class OfflineCourseList extends React.Component {
render: (val, record) => { render: (val, record) => {
return ( return (
<div className="record__item"> <div className="record__item">
{record.categoryOneName}{ record.categoryTwoName?`-${record.categoryTwoName}`:''} {record.categorySonName}
</div> </div>
) )
} }
...@@ -135,18 +137,18 @@ class OfflineCourseList extends React.Component { ...@@ -135,18 +137,18 @@ class OfflineCourseList extends React.Component {
dataIndex: "courseware", dataIndex: "courseware",
render: (val, item, index) => { render: (val, item, index) => {
return ( return (
<Switch defaultChecked={item.shelfState==="YES"?true:false} onChange={()=>this.changeShelfState(item)}/> <Switch defaultChecked={item.shelfState === "YES"} onChange={() => this.changeShelfState(item)}/>
) )
}, },
}, },
{ {
title: "讲师", title: "讲师",
width: 110, width: 200,
key: "teacher", key: "teacher",
dataIndex: "teacher", dataIndex: "teacher",
render: (val, item) => { render: (val, item) => {
return ( return (
<div className="watchUserCount">张老师</div> <div>{item.teacherName}</div>
) )
}, },
}, },
...@@ -156,8 +158,8 @@ class OfflineCourseList extends React.Component { ...@@ -156,8 +158,8 @@ class OfflineCourseList extends React.Component {
key: 'updated', key: 'updated',
dataIndex: 'updated', dataIndex: 'updated',
sorter: true, sorter: true,
render: (val) => { render: (val, item) => {
return formatDate('YYYY-MM-DD H:i', val) return item.startTimeApply ? `${formatDate('MM-DD H:i', item.startTimeApply)} ~ ${formatDate('MM-DD H:i', item.endTimeApply)}` : '-'
} }
}, },
{ {
...@@ -179,7 +181,7 @@ class OfflineCourseList extends React.Component { ...@@ -179,7 +181,7 @@ class OfflineCourseList extends React.Component {
render: (val, record) => { render: (val, record) => {
return ( return (
<div className="operate"> <div className="operate">
<div className="operate__item" onClick={()=>this.handleShowWatchDataModal(record)}>观看数据</div> <div className="operate__item" onClick={()=>this.handleShowWatchDataModal(record)}>参与数据</div>
<span className="operate__item split"> | </span> <span className="operate__item split"> | </span>
<div className="operate__item" onClick={() => this.handleShowShareModal(record)}>分享</div> <div className="operate__item" onClick={() => this.handleShowShareModal(record)}>分享</div>
<span className="operate__item split"> | </span> <span className="operate__item split"> | </span>
...@@ -402,7 +404,7 @@ class OfflineCourseList extends React.Component { ...@@ -402,7 +404,7 @@ class OfflineCourseList extends React.Component {
const { RelatedPlanModalVisible, selectCourseId, selectPlanList } = this.state; const { RelatedPlanModalVisible, selectCourseId, selectPlanList } = this.state;
const { dataSource = [], totalCount, query } = this.props; const { dataSource = [], totalCount, query } = this.props;
const { current, size } = query; const { current, size } = query;
console.log(dataSource, 5555555)
return ( return (
<div className="offline-course-list"> <div className="offline-course-list">
<Table <Table
......
...@@ -47,6 +47,10 @@ ...@@ -47,6 +47,10 @@
.more-operate{ .more-operate{
line-height:20px; line-height:20px;
} }
.course-state {
display: flex;
align-items: center;
}
.record__item { .record__item {
display: flex; display: flex;
......
...@@ -34,7 +34,7 @@ const ENUM = { ...@@ -34,7 +34,7 @@ const ENUM = {
UN_START: { UN_START: {
code: 1, code: 1,
title: "未开始", title: "未开始",
color: "#FFB714", color: "#FDBE31",
}, },
STARTING: { STARTING: {
code: 2, code: 2,
...@@ -44,12 +44,12 @@ const ENUM = { ...@@ -44,12 +44,12 @@ const ENUM = {
FINISH: { FINISH: {
code: 3, code: 3,
title: "已结束", title: "已结束",
color: "#3BBDAA", color: "#2FC83C",
}, },
EXPIRED: { EXPIRED: {
code: 4, code: 4,
title: "已取消", title: "已取消",
color: "#999", color: "#CCCCCC",
}, },
}, },
......
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