Commit 0273bd91 by chenshu

feat:初始化

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