Commit 0328ee98 authored by baixian's avatar baixian

优化

parent 74a2ec65
...@@ -167,6 +167,7 @@ export default { ...@@ -167,6 +167,7 @@ export default {
delete_unlock_subject: `${dakaapi}member/unlock_subject`, delete_unlock_subject: `${dakaapi}member/unlock_subject`,
find_unlock_subject: `${dakaapi}member/unlock_subject/detail`, find_unlock_subject: `${dakaapi}member/unlock_subject/detail`,
pattern_list: `${dakaapi}member/unlock_subject/index`, pattern_list: `${dakaapi}member/unlock_subject/index`,
edit_unlock_subject: `${dakaapi}member/unlock_subject/update`,
}, },
}; };
...@@ -22,7 +22,7 @@ class CourseChart extends React.Component { ...@@ -22,7 +22,7 @@ class CourseChart extends React.Component {
}); });
} }
calculateStyle = (info) => { calculateStyle = (info) => {
const colorList = ['#FF9A6C', '#FF5971', '#82D7FE', '#38E0C9', '#BD9FFF']; const colorList = ['#FF9A6C', '#FF5971', '#82D7FE', '#38E0C9', '#BD9FFF', '#ffd338', '#35c13a'];
const dayStartTimestamp = new Date(`${info.start_date} 06:00`.replace(/-/g, '/')); const dayStartTimestamp = new Date(`${info.start_date} 06:00`.replace(/-/g, '/'));
const dayEndTimestamp = new Date(`${info.start_date} 24:00`.replace(/-/g, '/')); const dayEndTimestamp = new Date(`${info.start_date} 24:00`.replace(/-/g, '/'));
const dayTotalTimestamp = (dayEndTimestamp - dayStartTimestamp) + 3600000; const dayTotalTimestamp = (dayEndTimestamp - dayStartTimestamp) + 3600000;
......
...@@ -114,23 +114,23 @@ class SjdMenu extends React.Component { ...@@ -114,23 +114,23 @@ class SjdMenu extends React.Component {
))} ))}
</div> </div>
} }
{!isDepartment && <Dropdown overlay={menu}>
<div className={SjdHeaderStyle.useraccount}> <div className={SjdHeaderStyle.accountoperate}>
<span className={SjdHeaderStyle.usermobile}>{(schoolUserInfo && schoolUserInfo.nickname) || ''}</span>
<img alt={(schoolUserInfo && schoolUserInfo.name) || ''} src={(schoolUserInfo && imagify(schoolUserInfo.avatar)) || ''} className={SjdHeaderStyle.avator} />
</div>
}
{isDepartment &&
<div className={SjdHeaderStyle.useraccount}>
<span className={SjdHeaderStyle.usermobile}>{(userInfo && userInfo.nickname) || ''}</span>
<img alt={(userInfo && userInfo.name) || ''} src={(userInfo && imagify(schoolUserInfo.avatar)) || ''} className={SjdHeaderStyle.avator} />
</div>
}
<div className={SjdHeaderStyle.accountoperate}>
<Dropdown overlay={menu} trigger={['click']}>
<Icon type="caret-down" className={SjdHeaderStyle.caretDown} /> <Icon type="caret-down" className={SjdHeaderStyle.caretDown} />
</Dropdown> {!isDepartment &&
</div> <div className={SjdHeaderStyle.useraccount}>
<span className={SjdHeaderStyle.usermobile}>{(schoolUserInfo && schoolUserInfo.nickname) || ''}</span>
<img alt={(schoolUserInfo && schoolUserInfo.name) || ''} src={(schoolUserInfo && imagify(schoolUserInfo.avatar)) || ''} className={SjdHeaderStyle.avator} />
</div>
}
{isDepartment &&
<div className={SjdHeaderStyle.useraccount}>
<span className={SjdHeaderStyle.usermobile}>{(userInfo && userInfo.nickname) || ''}</span>
<img alt={(userInfo && userInfo.name) || ''} src={(userInfo && imagify(schoolUserInfo.avatar)) || ''} className={SjdHeaderStyle.avator} />
</div>
}
</div>
</Dropdown>
</Header> </Header>
); );
} }
......
...@@ -72,3 +72,10 @@ ...@@ -72,3 +72,10 @@
color: #fff; color: #fff;
} }
} }
:global {
.ant-menu.ant-menu-dark .ant-menu-item:hover {
background-color: #1890FF;
color: rgba(254, 254, 254, 1);
border-left: 5px solid #FFFFFF;
}
}
...@@ -39,6 +39,14 @@ export default { ...@@ -39,6 +39,14 @@ export default {
value: 5, value: 5,
color: '#BD9FFF', color: '#BD9FFF',
}, },
{
value: 6,
color: '#ffd338',
},
{
value: 7,
color: '#35c13a',
},
], ],
editCourseInfo: { editCourseInfo: {
id: 0, id: 0,
...@@ -238,6 +246,14 @@ export default { ...@@ -238,6 +246,14 @@ export default {
value: 5, value: 5,
color: '#BD9FFF', color: '#BD9FFF',
}, },
{
value: 6,
color: '#ffd338',
},
{
value: 7,
color: '#35c13a',
},
], ],
editCourseInfo: { editCourseInfo: {
id: 0, id: 0,
......
...@@ -147,6 +147,29 @@ export default { ...@@ -147,6 +147,29 @@ export default {
pathname: `/sjd/newtheme/emigratedclock/${patternId}`, pathname: `/sjd/newtheme/emigratedclock/${patternId}`,
})); }));
}, },
* editSubjectCourse({ payload }, { call, put, select }) {
const { record } = payload;
yield put(routerRedux.push({
pathname: `/sjd/newtheme/emigratedcourse/${record.id}`,
}));
},
* findSubjectCourse({ payload }, { call, put, select }) {
const { id } = payload;
const { sid } = yield select(state => state.webapp);
const { emigratedObj } = yield select(state => state.createtheme);
const courseData = yield call(themeAjax.findTheme, {
id,
});
if (courseData.code == 200) {
courseData.data.content = JSON.parse(courseData.data.content);
yield put({
type: 'updateState',
payload: {
emigrateParams: { ...courseData.data },
},
});
}
},
* copyGoTheme({ payload }, { call, put, select }) { * copyGoTheme({ payload }, { call, put, select }) {
const { record, isCopy } = payload; const { record, isCopy } = payload;
if (record.subject_type === 1) { if (record.subject_type === 1) {
...@@ -412,8 +435,9 @@ export default { ...@@ -412,8 +435,9 @@ export default {
* createThemeModalAddEmigrated({ payload }, { call, put, select }) { * createThemeModalAddEmigrated({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp); const { sid } = yield select(state => state.webapp);
const { const {
unClockLoading, stepNumber, unClockLoading, stepNumber, emigratedObj,
} = yield select(state => state.createtheme); } = yield select(state => state.createtheme);
console.log(emigratedObj, 'emigratedObj');
if (unClockLoading) { if (unClockLoading) {
return; return;
} }
...@@ -438,7 +462,13 @@ export default { ...@@ -438,7 +462,13 @@ export default {
unlock_limit, unlock_limit,
callBack, callBack,
} = payload; } = payload;
const data = yield call(themeAjax.addEmigrated, { const newParams = {
id: emigratedObj.unlock_mode_id,
...emigratedObj,
};
console.log(newParams, 'newParams');
const postFunction = (newParams.id != undefined) && newParams.id !== 0 ? themeAjax.EditEmigrated : themeAjax.addEmigrated;
const data = yield call(postFunction, Object.assign(newParams, {
title, title,
push_status, push_status,
push_time, push_time,
...@@ -451,14 +481,15 @@ export default { ...@@ -451,14 +481,15 @@ export default {
max_clock_count, max_clock_count,
subject_count, subject_count,
unlock_limit, unlock_limit,
}); }));
yield put({ // yield put({
type: 'updateState', // type: 'updateState',
payload: { // payload: {
unClockLoading: false, // unClockLoading: false,
}, // },
}); // });
if (data.code === 200) { if (data.code === 200) {
message.success(newParams.id ? '闯关打卡活动编辑成功' : '闯关打卡活动创建成功', 0.3);
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
...@@ -468,10 +499,14 @@ export default { ...@@ -468,10 +499,14 @@ export default {
if (callBack && (typeof callBack == 'function')) { if (callBack && (typeof callBack == 'function')) {
callBack(); callBack();
} }
message.success('闯关打卡活动创建成功', 0.5); if (newParams.id) {
yield put(routerRedux.push({ yield delay(100);
pathname: `/sjd/newtheme/emigratedcount/${data.data.id}`, yield put(routerRedux.goBack());
})); } else {
yield put(routerRedux.push({
pathname: `/sjd/newtheme/emigratedcount/${data.data.id}`,
}));
}
// yield put({ // yield put({
// type: 'createtheme/createThemeModalfindEmigrated', // type: 'createtheme/createThemeModalfindEmigrated',
// payload: { // payload: {
...@@ -498,8 +533,8 @@ export default { ...@@ -498,8 +533,8 @@ export default {
sortNumber, sortNumber,
} = yield select(state => state.createtheme); } = yield select(state => state.createtheme);
let newParams = {}; let newParams = {};
if (payload.title.length > 20) { if (payload.title.length > 40) {
message.error('标题长度不能超过20个字!', 1); message.error('标题长度不能超过40个字!', 1);
return; return;
} }
if (emigrateLoading) { if (emigrateLoading) {
...@@ -528,18 +563,19 @@ export default { ...@@ -528,18 +563,19 @@ export default {
force_num, force_num,
callBack, callBack,
} = payload; } = payload;
newParams = { ...emigratedObj }; newParams = { ...emigrateParams };
if (newParams.school) { if (newParams.school) {
delete newParams.school; delete newParams.school;
} }
console.log(newParams, 'newParams'); console.log(newParams, 'newParams');
console.log(emigratedObj, 'emigratedObj');
const loadmessage = message.loading('保存中...', 0); const loadmessage = message.loading('保存中...', 0);
const postFunction = (newParams.id != undefined) && newParams.id !== 0 ? themeAjax.editTheme : themeAjax.addTheme; const postFunction = (newParams.id != undefined) && newParams.id !== 0 ? themeAjax.editTheme : themeAjax.addTheme;
const data = yield call(postFunction, Object.assign(newParams, { const data = yield call(postFunction, Object.assign(newParams, {
is_cheat, is_cheat,
is_encrypt, is_encrypt,
title, title,
// class_id: emigratedObj.class_id, class_id: emigratedObj.class_id,
subject_type, subject_type,
school_id: sid, school_id: sid,
text_require_status, text_require_status,
...@@ -553,7 +589,7 @@ export default { ...@@ -553,7 +589,7 @@ export default {
force_status, force_status,
force_num, force_num,
sort: sortNumber, sort: sortNumber,
// unlock_mode_id: emigratedObj.id, unlock_mode_id: emigratedObj.unlock_mode_id,
content: JSON.stringify(emigrateParams.content), content: JSON.stringify(emigrateParams.content),
})); }));
yield put({ yield put({
...@@ -569,6 +605,19 @@ export default { ...@@ -569,6 +605,19 @@ export default {
payload: { payload: {
emigrateText: '', emigrateText: '',
emigrateParams: { emigrateParams: {
is_cheat: 0,
title: '',
is_encrypt: 0,
text_require_status: 2,
text_require_num: 0,
image_require_status: 2,
image_require_num: 0,
video_require_status: 2,
video_require_num: 0,
audio_require_status: 2,
audio_require_num: 0,
force_status: 2,
force_num: 0,
content: [ content: [
{ type: 'text', value: '' }, { type: 'text', value: '' },
], ],
...@@ -589,6 +638,10 @@ export default { ...@@ -589,6 +638,10 @@ export default {
callBack(); callBack();
} }
message.success('保存成功', 0.5); message.success('保存成功', 0.5);
if ((emigrateParams.id != undefined) && emigrateParams.id !== 0) {
yield delay(300);
yield put(routerRedux.goBack());
}
} else { } else {
yield put({ yield put({
type: 'webapp/errorrequestresolve', type: 'webapp/errorrequestresolve',
...@@ -600,7 +653,9 @@ export default { ...@@ -600,7 +653,9 @@ export default {
}, },
* saveRelease({ payload }, { call, put, select }) { * saveRelease({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp); const { sid } = yield select(state => state.webapp);
const { releaseLoading, emigratedObj } = yield select(state => state.createtheme); const {
releaseLoading, emigratedObj, emigrateParams, patternId,
} = yield select(state => state.createtheme);
if (releaseLoading) { if (releaseLoading) {
return; return;
} }
...@@ -613,7 +668,7 @@ export default { ...@@ -613,7 +668,7 @@ export default {
const data = yield call(themeAjax.saveRelease, { const data = yield call(themeAjax.saveRelease, {
status: 2, status: 2,
school_id: sid, school_id: sid,
id: emigratedObj.unlock_mode_id, id: emigratedObj.unlock_mode_id ? emigratedObj.unlock_mode_id : patternId,
}); });
yield put({ yield put({
type: 'updateState', type: 'updateState',
...@@ -626,14 +681,37 @@ export default { ...@@ -626,14 +681,37 @@ export default {
type: 'updateState', type: 'updateState',
payload: { payload: {
stepNumber: 0, stepNumber: 0,
emigrateText: '',
emigrateParams: { emigrateParams: {
content: [], is_cheat: 0,
title: '',
is_encrypt: 0,
text_require_status: 2,
text_require_num: 0,
image_require_status: 2,
image_require_num: 0,
video_require_status: 2,
video_require_num: 0,
audio_require_status: 2,
audio_require_num: 0,
force_status: 2,
force_num: 0,
content: [
{ type: 'text', value: '' },
],
}, },
isRelease: false, isRelease: false,
emigrateLoading: false, emigrateLoading: false,
}, },
}); });
if ((emigrateParams.id != undefined) && emigrateParams.id !== 0) {
yield delay(500);
yield put(routerRedux.goBack());
} else {
yield delay(500);
yield put(routerRedux.push({
pathname: `/sjd/thememgt/${emigratedObj.class_id}`,
}));
}
message.success('闯关打卡发布成功', 1); message.success('闯关打卡发布成功', 1);
} else { } else {
yield put({ yield put({
...@@ -665,7 +743,6 @@ export default { ...@@ -665,7 +743,6 @@ export default {
let length = emigratedDate.data.subject_count; let length = emigratedDate.data.subject_count;
// eslint-disable-next-line no-irregular-whitespace // eslint-disable-next-line no-irregular-whitespace
const result = Array.from({ length }, () => length--).sort((a, b) => a - b); const result = Array.from({ length }, () => length--).sort((a, b) => a - b);
console.log(emigratedDate.data, ' emigratedDate.data');
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
...@@ -1341,6 +1418,19 @@ export default { ...@@ -1341,6 +1418,19 @@ export default {
selectPlanDays: [], selectPlanDays: [],
emigrateText: '', emigrateText: '',
emigrateParams: { emigrateParams: {
is_cheat: 0,
title: '',
is_encrypt: 0,
text_require_status: 2,
text_require_num: 0,
image_require_status: 2,
image_require_num: 0,
video_require_status: 2,
video_require_num: 0,
audio_require_status: 2,
audio_require_num: 0,
force_status: 2,
force_num: 0,
content: [ content: [
{ type: 'text', value: '' }, { type: 'text', value: '' },
], ],
......
...@@ -857,6 +857,35 @@ export default { ...@@ -857,6 +857,35 @@ export default {
}, },
}); });
} }
const EditSubjectCourseActive = pathToRegexp('/sjd/newtheme/emigratedcourse/:id').exec(pathname);
if (EditSubjectCourseActive) {
dispatch({
type: 'createtheme/pageInit',
payload: {
},
});
dispatch({
type: 'createtheme/findSubjectCourse',
payload: {
id: EditSubjectCourseActive[1],
},
});
dispatch({
type: 'webapp/updateState',
payload: {
breadcrumbList: [
{
path: 'sjd/indexstaic',
name: '首页',
},
{
path: pathname,
name: '编辑闯关打卡',
},
],
},
});
}
if (pathname === '/sjd/newtheme/calendarclock') { if (pathname === '/sjd/newtheme/calendarclock') {
dispatch({ dispatch({
type: 'createtheme/queryClassList', type: 'createtheme/queryClassList',
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
transition: all 0.2s; transition: all 0.2s;
// overflow: auto; // overflow: auto;
// min-width: 900px; // min-width: 900px;
} }
.collapsedcontent { .collapsedcontent {
margin-left: 220px; margin-left: 220px;
...@@ -31,4 +31,3 @@ ...@@ -31,4 +31,3 @@
} }
} }
} }
...@@ -75,13 +75,14 @@ class StaticCenter extends React.Component { ...@@ -75,13 +75,14 @@ class StaticCenter extends React.Component {
}); });
} }
createUnlockTheme = () => { createUnlockTheme = () => {
const { dispatch } = this.props; message.warning('功能即将开放,敬请期待', 1);
dispatch({ // const { dispatch } = this.props;
type: 'createtheme/goTheme', // dispatch({
payload: { // type: 'createtheme/goTheme',
index: 3, // payload: {
}, // index: 3,
}); // },
// });
} }
disabledDate=(current) => { disabledDate=(current) => {
return current > moment(); return current > moment();
......
...@@ -143,12 +143,12 @@ class ContentSettingForm extends React.Component { ...@@ -143,12 +143,12 @@ class ContentSettingForm extends React.Component {
} }
changeTab = (index) => { changeTab = (index) => {
const { dispatch, isSort } = this.props; const { dispatch, isSort } = this.props;
dispatch({ // dispatch({
type: 'createtheme/getSort', // type: 'createtheme/getSort',
payload: { // payload: {
key: index + 1, // key: index + 1,
}, // },
}); // });
} }
saveSubject = () => { saveSubject = () => {
const { dispatch, isRelease } = this.props; const { dispatch, isRelease } = this.props;
...@@ -196,6 +196,7 @@ class ContentSettingForm extends React.Component { ...@@ -196,6 +196,7 @@ class ContentSettingForm extends React.Component {
releaseLoading, releaseLoading,
isRelease, isRelease,
} = this.props; } = this.props;
console.log(emigrateParams, 'emigrateParams');
console.log(emigratedObj, 'emigratedObj'); console.log(emigratedObj, 'emigratedObj');
const formItemModalLineLayout = { const formItemModalLineLayout = {
labelCol: { labelCol: {
...@@ -234,36 +235,30 @@ class ContentSettingForm extends React.Component { ...@@ -234,36 +235,30 @@ class ContentSettingForm extends React.Component {
}, },
}; };
const selectBefore = ( const selectBefore = (
<div>{title.length || 0}/40</div> <div>{emigrateParams.title ? emigrateParams.title.length : title.length || 0}/40</div>
); );
return ( return (
<div className={pageStyle.container}> <div className={pageStyle.container}>
<Form labelAlign="left" onSubmit={this.handleSubmit}> <Form labelAlign="left" onSubmit={this.handleSubmit}>
<div className={pageStyle.title}>关卡设置</div> <div className={pageStyle.title}>关卡设置</div>
<div className={pageStyle.customs}> {
{/* <Tabs ActiveKey={`${sortNumber}`} onChange={this.changeTab} style={{ height: 220 }}> */} !emigrateParams.id && unlockSubjectList.length > 0 &&
{/* { */} <div className={pageStyle.customs} >
{/* unlockSubjectList.map((item, index) => */} {
{/* ( */} unlockSubjectList.map((item, index) =>
{/* <TabPane tab={item} key={item}> */} (
{/* </TabPane> */} <div onClick={() => this.changeTab(index)} className={sortNumber === item ? pageStyle.numitemActive : pageStyle.numitem}>
{/* ), */} {item}
{/* ) */} </div>
{/* } */} ),
{/* </Tabs> */} )
{ }
unlockSubjectList.map((item, index) => <div className={pageStyle.add}>添加</div>
( </div>
<div onClick={() => this.changeTab(index)} className={sortNumber === item ? pageStyle.numitemActive : pageStyle.numitem}> }
{item}
</div>
),
)
}
<div className={pageStyle.add}>添加</div>
</div>
<FormItem {...formItemModalLineLayout}> <FormItem {...formItemModalLineLayout}>
{getFieldDecorator('title', { {getFieldDecorator('title', {
initialValue: emigrateParams.title,
rules: [ rules: [
{ {
required: true, required: true,
...@@ -294,7 +289,7 @@ class ContentSettingForm extends React.Component { ...@@ -294,7 +289,7 @@ class ContentSettingForm extends React.Component {
<div className={pageStyle.commonright}> <div className={pageStyle.commonright}>
<FormItem {...formItemModaltypeLayout} label="文字字数要求" style={{ marginBottom: 0 }}> <FormItem {...formItemModaltypeLayout} label="文字字数要求" style={{ marginBottom: 0 }}>
{getFieldDecorator('text_require_status', { {getFieldDecorator('text_require_status', {
initialValue: false, initialValue: emigrateParams.text_require_status === 1,
valuePropName: 'checked', valuePropName: 'checked',
})( })(
<Switch checkedChildren="开启" unCheckedChildren="关闭" />, <Switch checkedChildren="开启" unCheckedChildren="关闭" />,
...@@ -303,7 +298,7 @@ class ContentSettingForm extends React.Component { ...@@ -303,7 +298,7 @@ class ContentSettingForm extends React.Component {
</FormItem> </FormItem>
{getFieldValue('text_require_status') === true ? ( {getFieldValue('text_require_status') === true ? (
<FormItem {...formItemverticalLayout} labelAlign="right" label="学员打卡最少"> <FormItem {...formItemverticalLayout} labelAlign="right" label="学员打卡最少">
{getFieldDecorator('text_require_num', { initialValue: 0 })( {getFieldDecorator('text_require_num', { initialValue: emigrateParams.text_require_num })(
<InputNumber placeholder="请输入" min={0} max={500} style={{ width: 100 }} />, <InputNumber placeholder="请输入" min={0} max={500} style={{ width: 100 }} />,
)} )}
<span className="ant-form-text">个文字</span> <span className="ant-form-text">个文字</span>
...@@ -313,7 +308,7 @@ class ContentSettingForm extends React.Component { ...@@ -313,7 +308,7 @@ class ContentSettingForm extends React.Component {
)} )}
<FormItem {...formItemModaltypeLayout} label="图片个数要求" style={{ marginBottom: 0 }}> <FormItem {...formItemModaltypeLayout} label="图片个数要求" style={{ marginBottom: 0 }}>
{getFieldDecorator('image_require_status', { {getFieldDecorator('image_require_status', {
initialValue: false, initialValue: emigrateParams.image_require_status === 1,
valuePropName: 'checked', valuePropName: 'checked',
})( })(
<Switch checkedChildren="开启" unCheckedChildren="关闭" />, <Switch checkedChildren="开启" unCheckedChildren="关闭" />,
...@@ -322,7 +317,7 @@ class ContentSettingForm extends React.Component { ...@@ -322,7 +317,7 @@ class ContentSettingForm extends React.Component {
</FormItem> </FormItem>
{getFieldValue('image_require_status') === true ? ( {getFieldValue('image_require_status') === true ? (
<FormItem {...formItemverticalLayout} labelAlign="right" label="学员打卡最少"> <FormItem {...formItemverticalLayout} labelAlign="right" label="学员打卡最少">
{getFieldDecorator('image_require_num', { initialValue: 0 })( {getFieldDecorator('image_require_num', { initialValue: emigrateParams.image_require_num })(
<InputNumber placeholder="请输入" min={0} max={9} style={{ width: 100 }} />, <InputNumber placeholder="请输入" min={0} max={9} style={{ width: 100 }} />,
)} )}
<span className="ant-form-text">张图片</span> <span className="ant-form-text">张图片</span>
...@@ -332,7 +327,7 @@ class ContentSettingForm extends React.Component { ...@@ -332,7 +327,7 @@ class ContentSettingForm extends React.Component {
)} )}
<FormItem {...formItemModaltypeLayout} label="视频个数要求" style={{ marginBottom: 0 }}> <FormItem {...formItemModaltypeLayout} label="视频个数要求" style={{ marginBottom: 0 }}>
{getFieldDecorator('video_require_status', { {getFieldDecorator('video_require_status', {
initialValue: false, initialValue: emigrateParams.video_require_status === 1,
valuePropName: 'checked', valuePropName: 'checked',
})( })(
<Switch checkedChildren="开启" unCheckedChildren="关闭" />, <Switch checkedChildren="开启" unCheckedChildren="关闭" />,
...@@ -341,7 +336,7 @@ class ContentSettingForm extends React.Component { ...@@ -341,7 +336,7 @@ class ContentSettingForm extends React.Component {
</FormItem> </FormItem>
{getFieldValue('video_require_status') === true ? ( {getFieldValue('video_require_status') === true ? (
<FormItem {...formItemverticalLayout} labelAlign="right" label="学员打卡最少"> <FormItem {...formItemverticalLayout} labelAlign="right" label="学员打卡最少">
{getFieldDecorator('video_require_num', { initialValue: 0 })( {getFieldDecorator('video_require_num', { initialValue: emigrateParams.video_require_num })(
<InputNumber placeholder="请输入" min={0} max={9} style={{ width: 100 }} />, <InputNumber placeholder="请输入" min={0} max={9} style={{ width: 100 }} />,
)} )}
<span className="ant-form-text">个视频</span> <span className="ant-form-text">个视频</span>
...@@ -351,7 +346,7 @@ class ContentSettingForm extends React.Component { ...@@ -351,7 +346,7 @@ class ContentSettingForm extends React.Component {
)} )}
<FormItem {...formItemModaltypeLayout} label="录音时长要求" style={{ marginBottom: 0 }}> <FormItem {...formItemModaltypeLayout} label="录音时长要求" style={{ marginBottom: 0 }}>
{getFieldDecorator('audio_require_status', { {getFieldDecorator('audio_require_status', {
initialValue: false, initialValue: emigrateParams.audio_require_status === 1,
valuePropName: 'checked', valuePropName: 'checked',
})( })(
<Switch checkedChildren="开启" unCheckedChildren="关闭" />, <Switch checkedChildren="开启" unCheckedChildren="关闭" />,
...@@ -360,7 +355,7 @@ class ContentSettingForm extends React.Component { ...@@ -360,7 +355,7 @@ class ContentSettingForm extends React.Component {
</FormItem> </FormItem>
{getFieldValue('audio_require_status') === true ? ( {getFieldValue('audio_require_status') === true ? (
<FormItem {...formItemverticalLayout} labelAlign="right" label="学员打卡最少"> <FormItem {...formItemverticalLayout} labelAlign="right" label="学员打卡最少">
{getFieldDecorator('audio_require_num', { initialValue: 0 })( {getFieldDecorator('audio_require_num', { initialValue: emigrateParams.audio_require_num })(
<InputNumber placeholder="请输入" min={0} max={600} style={{ width: 100 }} />, <InputNumber placeholder="请输入" min={0} max={600} style={{ width: 100 }} />,
)} )}
<span className="ant-form-text">秒录音</span> <span className="ant-form-text">秒录音</span>
...@@ -377,7 +372,7 @@ class ContentSettingForm extends React.Component { ...@@ -377,7 +372,7 @@ class ContentSettingForm extends React.Component {
<div className={pageStyle.commonright}> <div className={pageStyle.commonright}>
<FormItem {...formItemModaltypeLayout} label="强制阅读模式" style={{ marginBottom: 0 }}> <FormItem {...formItemModaltypeLayout} label="强制阅读模式" style={{ marginBottom: 0 }}>
{getFieldDecorator('force_status', { {getFieldDecorator('force_status', {
initialValue: false, initialValue: emigrateParams.force_status === 1,
valuePropName: 'checked', valuePropName: 'checked',
})( })(
<Switch checkedChildren="开启" unCheckedChildren="关闭" />, <Switch checkedChildren="开启" unCheckedChildren="关闭" />,
...@@ -386,7 +381,7 @@ class ContentSettingForm extends React.Component { ...@@ -386,7 +381,7 @@ class ContentSettingForm extends React.Component {
</FormItem> </FormItem>
{getFieldValue('force_status') === true ? ( {getFieldValue('force_status') === true ? (
<FormItem {...formItemverticalLayout} labelAlign="right" label="学员强制阅读"> <FormItem {...formItemverticalLayout} labelAlign="right" label="学员强制阅读">
{getFieldDecorator('force_num', { initialValue: 0 })( {getFieldDecorator('force_num', { initialValue: emigrateParams.force_num })(
<InputNumber placeholder="请输入" min={0} style={{ width: 100 }} />, <InputNumber placeholder="请输入" min={0} style={{ width: 100 }} />,
)} )}
<span className="ant-form-text">分钟</span> <span className="ant-form-text">分钟</span>
...@@ -402,7 +397,9 @@ class ContentSettingForm extends React.Component { ...@@ -402,7 +397,9 @@ class ContentSettingForm extends React.Component {
<Button htmlType="submit" loading={emigrateLoading}> <Button htmlType="submit" loading={emigrateLoading}>
保存此关卡 保存此关卡
</Button> </Button>
<Button style={{ float: 'right' }} loading={releaseLoading} type="primary" onClick={this.saveSubject}>发布主题</Button> {
emigrateParams.id ? '' : <Button style={{ float: 'right' }} loading={releaseLoading} type="primary" onClick={this.saveSubject}>发布主题</Button>
}
</FormItem> </FormItem>
</Form> </Form>
</div> </div>
......
...@@ -90,7 +90,6 @@ class UnClockForm extends React.Component { ...@@ -90,7 +90,6 @@ class UnClockForm extends React.Component {
classList, classList,
emigratedObj, emigratedObj,
} = this.props; } = this.props;
console.log(emigratedObj, 'emigratedObj');
const formItemModalLineLayout = { const formItemModalLineLayout = {
labelCol: { labelCol: {
xs: { span: 3 }, xs: { span: 3 },
...@@ -157,7 +156,7 @@ class UnClockForm extends React.Component { ...@@ -157,7 +156,7 @@ class UnClockForm extends React.Component {
}, },
], ],
})( })(
<Select placeholder="请选择班级" style={{ width: 174 }} showSearch onChange={this.handleStudentChange}> <Select disabled={(emigratedObj.class_id && emigratedObj.class_id != undefined)} placeholder="请选择班级" style={{ width: 174 }} showSearch onChange={this.handleStudentChange}>
{classList.map(ele => <Option value={ele.id}>{ele.title}</Option>)} {classList.map(ele => <Option value={ele.id}>{ele.title}</Option>)}
</Select>, </Select>,
)} )}
......
...@@ -24,7 +24,13 @@ class EmigratedClockForm extends React.Component { ...@@ -24,7 +24,13 @@ class EmigratedClockForm extends React.Component {
componentWillUnmount() { // 卸载 componentWillUnmount() { // 卸载
} }
editCourse = (record) => { editCourse = (record) => {
console.log(record); const { dispatch } = this.props;
dispatch({
type: 'createtheme/editSubjectCourse',
payload: {
record,
},
});
} }
editClock = () => { editClock = () => {
const { dispatch } = this.props; const { dispatch } = this.props;
...@@ -34,6 +40,14 @@ class EmigratedClockForm extends React.Component { ...@@ -34,6 +40,14 @@ class EmigratedClockForm extends React.Component {
}, },
}); });
} }
saveSubject = () => {
const { dispatch } = this.props;
dispatch({
type: 'createtheme/saveRelease',
payload: {
},
});
}
render() { render() {
const columns = [ const columns = [
{ {
...@@ -41,7 +55,7 @@ class EmigratedClockForm extends React.Component { ...@@ -41,7 +55,7 @@ class EmigratedClockForm extends React.Component {
dataIndex: 'sort', dataIndex: 'sort',
}, },
{ {
title: '课程名称', title: '关卡标题',
dataIndex: 'title', dataIndex: 'title',
}, },
{ {
...@@ -55,6 +69,7 @@ class EmigratedClockForm extends React.Component { ...@@ -55,6 +69,7 @@ class EmigratedClockForm extends React.Component {
]; ];
const { const {
patternList, patternList,
releaseLoading,
} = this.props; } = this.props;
return ( return (
<div className={pageStyle.container}> <div className={pageStyle.container}>
...@@ -71,7 +86,7 @@ class EmigratedClockForm extends React.Component { ...@@ -71,7 +86,7 @@ class EmigratedClockForm extends React.Component {
</Row> </Row>
<Row> <Row>
<Col span={24} style={{ textAlign: 'right' }}> <Col span={24} style={{ textAlign: 'right' }}>
<Button type="primary">发布主题</Button> <Button loading={releaseLoading} type="primary" onClick={this.saveSubject} >发布主题</Button>
</Col> </Col>
</Row> </Row>
</div> </div>
...@@ -85,9 +100,11 @@ const EmigratedClock = Form.create()(EmigratedClockForm); ...@@ -85,9 +100,11 @@ const EmigratedClock = Form.create()(EmigratedClockForm);
function mapStateToProps(state) { function mapStateToProps(state) {
const { const {
patternList, patternList,
releaseLoading,
} = state.createtheme; } = state.createtheme;
return { return {
patternList, patternList,
releaseLoading,
}; };
} }
export default connect(mapStateToProps)(EmigratedClock); export default connect(mapStateToProps)(EmigratedClock);
......
...@@ -137,6 +137,10 @@ class ThemeMgt extends React.Component { ...@@ -137,6 +137,10 @@ class ThemeMgt extends React.Component {
} }
editTheme = (record) => { editTheme = (record) => {
const { dispatch } = this.props; const { dispatch } = this.props;
if (record.subject_type == 3) {
message.warning('功能即将开放,敬请期待', 1);
return;
}
dispatch({ dispatch({
type: 'createtheme/editGoTheme', type: 'createtheme/editGoTheme',
payload: { payload: {
......
...@@ -240,6 +240,7 @@ function RouterConfig({ history }) { ...@@ -240,6 +240,7 @@ function RouterConfig({ history }) {
<Route path="/sjd/newtheme/editemigrated/:id" exact component={EditEmigratedClock} /> <Route path="/sjd/newtheme/editemigrated/:id" exact component={EditEmigratedClock} />
<Route path="/sjd/newtheme/emigratedclock/:id" exact component={EmigratedSetting} /> <Route path="/sjd/newtheme/emigratedclock/:id" exact component={EmigratedSetting} />
<Route path="/sjd/newtheme/emigratedcount/:showId" exact component={EmigratedContent} /> <Route path="/sjd/newtheme/emigratedcount/:showId" exact component={EmigratedContent} />
<Route path="/sjd/newtheme/emigratedcourse/:id" exact component={EmigratedContent} />
</SjdIndex> </SjdIndex>
)} )}
/> />
......
...@@ -77,3 +77,11 @@ export function find_pattern_list(params) { ...@@ -77,3 +77,11 @@ export function find_pattern_list(params) {
data, data,
}); });
} }
export function EditEmigrated(params) {
const data = qs.stringify(params);
return request({
url: `${api.createtheme.edit_unlock_subject}`,
method: 'POST',
data,
});
}
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