Commit e89891cd authored by wangxuelai's avatar wangxuelai

''

parent 51a52df4
......@@ -17,6 +17,6 @@
</head>
<body>
<div id="root"></div>
<script src="dist/main.js?1574739446435" charset="utf-8"></script>
<script src="dist/main.js?1574753959867" charset="utf-8"></script>
</body>
</html>
\ No newline at end of file
......@@ -37,6 +37,8 @@ export default {
study_count: '',
status: '',
content: '',
is_encrypt: 1,
password: '',
},
addLoading: false,
editLoading: false,
......@@ -323,6 +325,7 @@ export default {
title: data.data.title,
start_time: data.data.start_time,
charge_type: data.data.charge_type,
is_encrypt: data.data.is_encrypt,
created_at: data.data.created_at,
type: data.data.type,
intro: data.data.intro && data.data.intro != null ? JSON.parse(data.data.intro) : addCourseObj.intro,
......@@ -332,6 +335,7 @@ export default {
cover: data.data.cover,
audio: data.data.audio,
content: data.data.content,
password: data.data.password,
},
coursewareInfo: JSON.parse(data.data.content),
},
......@@ -1044,6 +1048,12 @@ export default {
id: addCourseObj.id,
},
});
yield put({
type: 'selectCourseList',
payload: {
params: {},
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
......
......@@ -301,11 +301,12 @@ class CourseDetailForm extends React.Component {
<span className="ant-form-text">设置学习人数基数,让学员更有东西学习喔</span>
</FormItem>
<FormItem {...formItemModalLineLayout} label="课程类型">
<div className={pageStyle.courseType}>免费</div>
<div className={pageStyle.courseType}>{addCourseObj.is_encrypt == 1 ? '加密' : '未加密'}</div>
<span className="hreflink" style={{ marginLeft: '10px' }}>修改</span>
{/* <span className={pageStyle.typeEdit}>点击修改</span> */}
{/* <span className="ant-form-text">有人报名则无法修改课程类型</span> */}
</FormItem>
<FormItem {...formItemModalLineLayout} label="语音介绍">
{/* <FormItem {...formItemModalLineLayout} label="语音介绍">
{
addCourseObj.audio ?
<div className={pageStyle.voice}>
......@@ -322,7 +323,7 @@ class CourseDetailForm extends React.Component {
/>
</div>
}
</FormItem>
</FormItem> */}
<FormItem {...formItemModalLineLayout} label="课程介绍">
<ThemeEditor
commentParams={addCourseObj}
......
......@@ -106,7 +106,8 @@
}
.courseType {
display: inline-block;
width: 37px;
// width: 37px;
padding: 0 5px;
height: 21px;
border: 1px solid #FF9D02;
color: #FF9D02;
......
import { connect } from 'dva';
import React from 'react';
import {
Form,
Input,
Modal,
Checkbox,
} from 'antd';
import pageStyle from './ThemeEditor.less';
import { pageIn, hasBtnPower, imagify, ossVideofy } from '../../utils/index';
const FormItem = Form.Item;
const { TextArea } = Input;
class ChangePsdModal extends React.Component {
constructor(props) {
super(props);
this.state = {
};
}
componentDidMount() { // 挂载
}
componentDidUpdate() {
}
componentWillUnmount() { // 卸载
}
close = () => {
const { close } = this.props;
close();
}
save = (e) => {
const { save, form } = this.props;
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
const {
is_encrypt,
password,
} = values;
save({
is_encrypt,
password,
callBack: () => {
form.resetFields();
},
});
}
});
}
render() {
const {
visible,
form: { getFieldDecorator, getFieldValue },
record,
replyLoading,
info,
} = this.props;
const formItemModalLineLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 3 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 20 },
},
};
return (
<Modal
visible={false}
maskClosable={false}
zIndex={110}
width={600}
bodyStyle={{
padding: '40px 20px',
}}
title="回复"
closable={false}
onCancel={this.close}
okText="保存"
cancelText="取消"
confirmLoading={replyLoading}
onOk={this.save}
>
<Form className={pageStyle.modalform} labelAlign="left" onSubmit={this.save}>
<FormItem>
{getFieldDecorator('is_encrypt', {
valuePropName: 'checked',
initialValue: info.is_encrypt == 1,
})(<Checkbox><span className={pageStyle.tip}>设置密码</span></Checkbox>)}
</FormItem>
{
Number(getFieldValue('is_encrypt')) === 1 ?
<FormItem {...formItemModalLineLayout}>
{getFieldDecorator('password', {
initialValue: info.password,
rules: [
{
required: true,
message: '请输入4-8位数字密码',
pattern: new RegExp(/^\d{4,8}$/, 'g'),
},
],
})(
<Input style={{ width: 200 }} maxLength={8} placeholder="请输入4-8位数字密码" />,
)}
</FormItem> : ''
}
</Form>
</Modal>
);
}
}
ChangePsdModal.propTypes = {
};
const ChangePsdModalForm = Form.create()(ChangePsdModal);
export default connect()(ChangePsdModalForm);
......@@ -302,6 +302,7 @@ class CourseDetailForm extends React.Component {
const selectBefore = (
<div>{title.length + textLength}/40</div>
);
console.log(addCourseObj, 'addCourseObj');
return (
<div className={pageStyle.container}>
<Form hideRequiredMark className={pageStyle.modalform} labelAlign="left" onSubmit={this.save}>
......@@ -370,7 +371,8 @@ class CourseDetailForm extends React.Component {
<span className="ant-form-text">设置学习人数基数,让学员更有东西学习喔</span>
</FormItem>
<FormItem {...formItemModalLineLayout} label="课程类型">
<div className={pageStyle.courseType}>免费</div>
<div className={pageStyle.courseType}>{addCourseObj.is_encrypt == 1 ? '加密' : '未加密'}</div>
<span className="hreflink" style={{ marginLeft: '10px' }}>修改</span>
{/* <span className={pageStyle.typeEdit}>点击修改</span> */}
{/* <span className="ant-form-text">有人报名则无法修改课程类型</span> */}
</FormItem>
......@@ -393,7 +395,7 @@ class CourseDetailForm extends React.Component {
{/* <span>课件:</span> */}
{/* <span>{(coursewareInfo.properties && coursewareInfo.properties.name) || '无'}</span> */}
{/* </div> */}
<FormItem {...formItemModalLineLayout} label="语音介绍">
{/* <FormItem {...formItemModalLineLayout} label="语音介绍">
{
addCourseObj.audio ?
<div className={pageStyle.voice}>
......@@ -410,7 +412,7 @@ class CourseDetailForm extends React.Component {
/>
</div>
}
</FormItem>
</FormItem> */}
<FormItem {...formItemModalLineLayout} label="课程介绍">
<ThemeEditor
commentParams={addCourseObj}
......
......@@ -108,7 +108,8 @@
}
.courseType {
display: inline-block;
width: 37px;
// width: 37px;
padding: 0 5px;
height: 21px;
border: 1px solid #FF9D02;
color: #FF9D02;
......
......@@ -18,7 +18,9 @@ import {
} from 'antd';
import pageStyle from './index.less';
import AddCourseModal from './AddCourseModal';
import { pageIn, hasBtnPower, imagify } from '../../../utils';
import { pageIn, hasBtnPower, imagify, getFileType } from '../../../utils';
import UploadCourseware from '../../../components/UploadCourseware';
import MaterialModal from '../../../components/MaterialModal';
const { TabPane } = Tabs;
const FormItem = Form.Item;
const { Option } = Select;
......@@ -129,6 +131,114 @@ class ClassMgtForm extends React.Component {
},
});
}
toUploadCourseWare = (item) => {
const { addCourseObj } = this.props;
let content = null;
if (item.content && JSON.parse(item.content) && JSON.parse(item.content).src) {
content = JSON.parse(item.content);
} else {
content = {};
}
const { dispatch, coursewareInfo } = this.props;
dispatch({
type: 'uploadcourseware/updateState',
payload: {
visible: true,
info: { ...content },
},
});
dispatch({
type: 'onlineclasses/updateState',
payload: {
addCourseObj: {
...addCourseObj,
id: item.id,
},
},
});
}
chooseFromCourseMateria = () => {
const { dispatch } = this.props;
dispatch({
type: 'onlineclasses/updateState',
payload: {
materialVisible2: true,
},
});
dispatch({
type: 'onlineclasses/querymaterialist',
payload: {
params: {
type: '',
page: 1,
perPage: 20,
},
},
});
}
materialClose2 = () => {
const { dispatch } = this.props;
dispatch({
type: 'onlineclasses/updateState',
payload: {
materialVisible2: false,
},
});
}
delCourseware = () => {
const { dispatch } = this.props;
dispatch({
type: 'onlineclasses/updateState',
payload: {
coursewareInfo: {},
},
});
}
materialSave2 = (values) => {
const { dispatch } = this.props;
const { checkValue } = values;
dispatch({
type: 'onlineclasses/updateState',
payload: {
materialVisible2: false,
},
});
const content = JSON.parse(checkValue.content);
dispatch({
type: 'uploadcourseware/updateState',
payload: {
info: JSON.parse(JSON.stringify({
properties: {
size: content.size,
fileType: content.fileType,
name: content.name,
duration: content.duration,
},
images: content.images,
src: checkValue.src,
fileType: content.fileType,
type: getFileType(content.fileType).filetype,
mediaType: getFileType(content.fileType).fileSmalltype,
from: 'materia',
})),
},
});
// dispatch({
// type: 'onlineclasses/updateCover',
// payload: {
// values,
// },
// });
}
uploadCourseware = (values) => {
const { dispatch } = this.props;
dispatch({
type: 'onlineclasses/uploadCourseware',
payload: {
info: { ...values },
},
});
}
render() {
const {
form: { getFieldDecorator, getFieldValue },
......@@ -136,6 +246,11 @@ class ClassMgtForm extends React.Component {
courseList,
courseListTotal,
courseListParams,
coursewareSubmitting,
materialVisible2,
materiaList,
queryParams,
materiaListTotal,
} = this.props;
return (
<div className={pageStyle.container}>
......@@ -191,7 +306,7 @@ class ClassMgtForm extends React.Component {
<div>
<div className={pageStyle.itemTime}>{item.created_at}</div>
<div>
<span className="hreflink" style={{ paddingRight: '20px', color: '#2194FF', lineHeight: 1 }}>上传课件</span>
<span title={(item.content && JSON.parse(item.content) && JSON.parse(item.content).src) ? JSON.parse(item.content).properties.name : ''} className="hreflink" style={{ paddingRight: '20px', color: '#2194FF', lineHeight: 1 }} onClick={() => this.toUploadCourseWare(item)}>{(item.content && JSON.parse(item.content) && JSON.parse(item.content).src) ? '编辑课件' : '上传课件'}</span>
<span className="hreflink" style={{ color: '#2194FF', lineHeight: 1 }} onClick={() => this.goEditCourse(item.id)}>管理课程</span>
</div>
</div>
......@@ -220,6 +335,21 @@ class ClassMgtForm extends React.Component {
visible={courseVisible}
close={this.addCourseClose}
/>
<UploadCourseware
callback={this.uploadCourseware}
delCourseware={this.delCourseware}
chooseFromCourseMateria={this.chooseFromCourseMateria}
loading={coursewareSubmitting}
/>
<MaterialModal
visible={materialVisible2}
close={this.materialClose2}
list={materiaList}
queryParams={queryParams}
total={materiaListTotal}
changePagination={this.changeListPagination2}
save={this.materialSave2}
/>
</div>
);
}
......@@ -235,12 +365,24 @@ function mapStateToProps(state) {
courseList,
courseListTotal,
courseListParams,
coursewareSubmitting,
materialVisible2,
materiaList,
queryParams,
materiaListTotal,
addCourseObj,
} = state.onlineclasses;
return {
courseVisible,
courseList,
courseListTotal,
courseListParams,
coursewareSubmitting,
materialVisible2,
materiaList,
queryParams,
materiaListTotal,
addCourseObj,
};
}
export default connect(mapStateToProps)(ClassMgt);
......
......@@ -24,6 +24,7 @@ import CommentList from './CommentList';
import StaticBox from './StaticBox';
import UploadCourseware from '../../../components/UploadCourseware';
import MaterialModal from '../../../components/MaterialModal';
import ChangePsdModal from '../ChangePsdModal';
const { TabPane } = Tabs;
const FormItem = Form.Item;
const { Option } = Select;
......@@ -216,6 +217,10 @@ class singleDetailForm extends React.Component {
changePagination={this.changeListPagination2}
save={this.materialSave2}
/>
<ChangePsdModal
visible
info={addCourseObj}
/>
</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