Commit 1c27a803 authored by wangxuelai's avatar wangxuelai

''

parent 452c7fe9
...@@ -17,6 +17,6 @@ ...@@ -17,6 +17,6 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="dist/main.js?1574833367343" charset="utf-8"></script> <script src="dist/main.js?1574837184040" charset="utf-8"></script>
</body> </body>
</html> </html>
\ No newline at end of file
import { connect } from 'dva'; import { connect } from 'dva';
import React from 'react'; import React from 'react';
import { Button, Row, Carousel, Icon, Col, Input, Select, Pagination, Radio, DatePicker, Modal, Form, TimePicker, InputNumber, Table } from 'antd'; import { Button, Row, Carousel, Icon, Col, Input, Select, Pagination, Radio, DatePicker, Modal, Form, TimePicker, InputNumber, Table, Spin } from 'antd';
import pageStyle from './UploadCourseware.less'; import pageStyle from './UploadCourseware.less';
import { import {
pageIn, pageIn,
...@@ -87,6 +87,8 @@ class UploadCourseware extends React.Component { ...@@ -87,6 +87,8 @@ class UploadCourseware extends React.Component {
visible, visible,
info, info,
chooseFromCourseMateria, chooseFromCourseMateria,
saveStatus,
loading,
} = this.props; } = this.props;
return ( return (
<Modal <Modal
...@@ -96,7 +98,7 @@ class UploadCourseware extends React.Component { ...@@ -96,7 +98,7 @@ class UploadCourseware extends React.Component {
onCancel={this.hide} onCancel={this.hide}
onOk={this.save} onOk={this.save}
className="UploadCoursewareContent" className="UploadCoursewareContent"
// confirmLoading={callStudentSubmitting} confirmLoading={loading}
zIndex={110} zIndex={110}
maskClosable={false} maskClosable={false}
width={600} width={600}
...@@ -126,6 +128,12 @@ class UploadCourseware extends React.Component { ...@@ -126,6 +128,12 @@ class UploadCourseware extends React.Component {
</div> </div>
</div> </div>
<div className={pageStyle.uploadBox} style={{ display: info.src ? 'block' : 'none' }}> <div className={pageStyle.uploadBox} style={{ display: info.src ? 'block' : 'none' }}>
{saveStatus.status != 0 &&
<div className={`${pageStyle.uploadLoading} uploadLoading`}>
<Spin size="large" wrapperClassName={pageStyle.uploadLoadingSpin} />
<div className={pageStyle.uploadLoadingText}>{saveStatus.text}</div>
</div>
}
{info.mediaType == 1 && {info.mediaType == 1 &&
<Carousel <Carousel
className={pageStyle.Carousel} className={pageStyle.Carousel}
...@@ -213,10 +221,12 @@ function mapStateToProps(state) { ...@@ -213,10 +221,12 @@ function mapStateToProps(state) {
const { const {
visible, visible,
info, info,
saveStatus,
} = state.uploadcourseware; } = state.uploadcourseware;
return { return {
visible, visible,
info, info,
saveStatus,
}; };
} }
export default connect(mapStateToProps)(UploadCourseware); export default connect(mapStateToProps)(UploadCourseware);
......
...@@ -209,4 +209,31 @@ ...@@ -209,4 +209,31 @@
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
}
:global {
.uploadLoading {
.ant-spin-dot-item {
background-color: #fff;
}
}
}
.uploadLoading {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
z-index: 5;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.uploadLoadingText {
text-align: center;
color: #fff;
font-size: 18px;
position: relative;
z-index: 6;
font-weight: 700;
margin-top: 10px;
}
} }
\ No newline at end of file
...@@ -1232,6 +1232,15 @@ export default { ...@@ -1232,6 +1232,15 @@ export default {
info, info,
}, },
}); });
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 1, // 1 转换中 2 保存中
text: '文件解析中,请稍等...',
},
},
});
} else { } else {
yield put({ yield put({
type: 'sureSaveCourseWare', type: 'sureSaveCourseWare',
...@@ -1333,6 +1342,15 @@ export default { ...@@ -1333,6 +1342,15 @@ export default {
}, },
}); });
} else { } else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({ yield put({
type: 'webapp/errorrequestresolve', type: 'webapp/errorrequestresolve',
payload: { payload: {
...@@ -1352,6 +1370,7 @@ export default { ...@@ -1352,6 +1370,7 @@ export default {
}); });
const { data, code } = transformData; const { data, code } = transformData;
if (code == 200) { if (code == 200) {
message.success('解析成功', 1);
yield put({ yield put({
type: 'sureSaveCourseWare', type: 'sureSaveCourseWare',
payload: { payload: {
...@@ -1373,6 +1392,15 @@ export default { ...@@ -1373,6 +1392,15 @@ export default {
type: info.type, type: info.type,
}, },
}); });
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
} else if (code == 40060) { } else if (code == 40060) {
yield delay(1000); yield delay(1000);
yield put({ yield put({
...@@ -1384,6 +1412,15 @@ export default { ...@@ -1384,6 +1412,15 @@ export default {
}, },
}); });
} else { } else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({ yield put({
type: 'webapp/errorrequestresolve', type: 'webapp/errorrequestresolve',
payload: { payload: {
...@@ -1567,6 +1604,21 @@ export default { ...@@ -1567,6 +1604,21 @@ export default {
}, },
}); });
} else { } else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
},
});
yield put({ yield put({
type: 'webapp/errorrequestresolve', type: 'webapp/errorrequestresolve',
payload: { payload: {
...@@ -1613,6 +1665,15 @@ export default { ...@@ -1613,6 +1665,15 @@ export default {
}, },
}, },
}); });
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({ yield put({
type: 'uploadcourseware/updateState', type: 'uploadcourseware/updateState',
payload: { payload: {
...@@ -1621,18 +1682,18 @@ export default { ...@@ -1621,18 +1682,18 @@ export default {
}, },
}); });
} else { } else {
if (coursewareSubmitting) { if (info.from) {
return; delete info.from;
} }
yield put({ yield put({
type: 'updateState', type: 'uploadcourseware/updateState',
payload: { payload: {
coursewareSubmitting: true, saveStatus: {
status: 2, // 1 转换中 2 保存中
text: '保存中...',
},
}, },
}); });
if (info.from) {
delete info.from;
}
const loadmessage = message.loading('保存中...', 0); const loadmessage = message.loading('保存中...', 0);
const data = yield call(courseMateriaAjax.uploadCourseware, { const data = yield call(courseMateriaAjax.uploadCourseware, {
content: JSON.stringify({ content: JSON.stringify({
...@@ -1649,6 +1710,15 @@ export default { ...@@ -1649,6 +1710,15 @@ export default {
}); });
setTimeout(loadmessage); setTimeout(loadmessage);
if (data.code == 200) { if (data.code == 200) {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
...@@ -1672,6 +1742,21 @@ export default { ...@@ -1672,6 +1742,21 @@ export default {
}, },
}); });
} else { } else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
},
});
yield put({ yield put({
type: 'webapp/errorrequestresolve', type: 'webapp/errorrequestresolve',
payload: { payload: {
...@@ -1696,11 +1781,29 @@ export default { ...@@ -1696,11 +1781,29 @@ export default {
data: transformData, data: transformData,
}, },
}); });
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
} }
}, },
* uploadCourseware({ payload }, { call, put, select }) { * uploadCourseware({ payload }, { call, put, select }) {
const { info } = payload; const { info } = payload;
const { editSingleCourseInfo, coursewareSubmitting, editSingleCourseId } = yield select(state => state.coursegatherdetail); const { editSingleCourseInfo, coursewareSubmitting, editSingleCourseId } = yield select(state => state.coursegatherdetail);
if (coursewareSubmitting) {
return;
}
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: true,
},
});
if (info.from == 'upload') { if (info.from == 'upload') {
if (info.type == 4) { if (info.type == 4) {
yield put({ yield put({
...@@ -1709,6 +1812,15 @@ export default { ...@@ -1709,6 +1812,15 @@ export default {
info, info,
}, },
}); });
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 1, // 1 转换中 2 保存中
text: '文件解析中,请稍等...',
},
},
});
} else { } else {
yield put({ yield put({
type: 'createCourseMateria', type: 'createCourseMateria',
...@@ -1728,6 +1840,7 @@ export default { ...@@ -1728,6 +1840,7 @@ export default {
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
coursewareSubmitting: false,
editSingleCourseInfo: { editSingleCourseInfo: {
...editSingleCourseInfo, ...editSingleCourseInfo,
content: { content: {
...@@ -1745,18 +1858,18 @@ export default { ...@@ -1745,18 +1858,18 @@ export default {
}, },
}); });
} else { } else {
if (coursewareSubmitting) { if (info.from) {
return; delete info.from;
} }
yield put({ yield put({
type: 'updateState', type: 'uploadcourseware/updateState',
payload: { payload: {
coursewareSubmitting: true, saveStatus: {
status: 2, // 1 转换中 2 保存中
text: '保存中...',
},
}, },
}); });
if (info.from) {
delete info.from;
}
const loadmessage = message.loading('保存中...', 0); const loadmessage = message.loading('保存中...', 0);
const data = yield call(courseMateriaAjax.uploadCourseware, { const data = yield call(courseMateriaAjax.uploadCourseware, {
content: JSON.stringify(info), content: JSON.stringify(info),
...@@ -1779,6 +1892,15 @@ export default { ...@@ -1779,6 +1892,15 @@ export default {
}, },
}, },
}); });
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({ yield put({
type: 'uploadcourseware/updateState', type: 'uploadcourseware/updateState',
payload: { payload: {
...@@ -1799,10 +1921,19 @@ export default { ...@@ -1799,10 +1921,19 @@ export default {
data, data,
}, },
}); });
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
} }
} }
} }
} else { } else if (info.from == 'materia') {
if (editSingleCourseId == 0) { if (editSingleCourseId == 0) {
if (info.from) { if (info.from) {
delete info.from; delete info.from;
...@@ -1810,6 +1941,7 @@ export default { ...@@ -1810,6 +1941,7 @@ export default {
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
coursewareSubmitting: false,
editSingleCourseInfo: { editSingleCourseInfo: {
...editSingleCourseInfo, ...editSingleCourseInfo,
content: info, content: info,
...@@ -1823,16 +1955,7 @@ export default { ...@@ -1823,16 +1955,7 @@ export default {
info: {}, info: {},
}, },
}); });
} else if (info.from == 'materia') { } else {
if (coursewareSubmitting) {
return;
}
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: true,
},
});
if (info.from) { if (info.from) {
delete info.from; delete info.from;
} }
...@@ -1849,6 +1972,12 @@ export default { ...@@ -1849,6 +1972,12 @@ export default {
}); });
setTimeout(loadmessage); setTimeout(loadmessage);
if (data.code == 200) { if (data.code == 200) {
yield put({
type: 'selectCourseList',
payload: {
params: {},
},
});
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
...@@ -1877,15 +2006,21 @@ export default { ...@@ -1877,15 +2006,21 @@ export default {
}, },
}); });
} }
} else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
visible: false,
info: {},
},
});
} }
} else {
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
visible: false,
info: {},
},
});
} }
}, },
* createCourseMateria({ payload }, { call, put, select }) { * createCourseMateria({ payload }, { call, put, select }) {
......
...@@ -934,6 +934,21 @@ export default { ...@@ -934,6 +934,21 @@ export default {
}, },
}); });
} else { } else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
},
});
yield put({ yield put({
type: 'webapp/errorrequestresolve', type: 'webapp/errorrequestresolve',
payload: { payload: {
...@@ -982,17 +997,41 @@ export default { ...@@ -982,17 +997,41 @@ export default {
}, },
}); });
} else { } else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({ yield put({
type: 'webapp/errorrequestresolve', type: 'webapp/errorrequestresolve',
payload: { payload: {
data: transformData, data: transformData,
}, },
}); });
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
},
});
} }
}, },
* uploadCourseware({ payload }, { call, put, select }) { * uploadCourseware({ payload }, { call, put, select }) {
const { info } = payload; const { info } = payload;
const { addCourseObj, coursewareSubmitting } = yield select(state => state.onlineclasses); const { addCourseObj, coursewareSubmitting } = yield select(state => state.onlineclasses);
if (coursewareSubmitting) {
return;
}
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: true,
},
});
const { from } = info; const { from } = info;
if (from == 'upload') { // 课件上传得到需要转码 if (from == 'upload') { // 课件上传得到需要转码
if (info.type == 4) { // 其他文件需要转码 if (info.type == 4) { // 其他文件需要转码
...@@ -1002,6 +1041,15 @@ export default { ...@@ -1002,6 +1041,15 @@ export default {
info, info,
}, },
}); });
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 1, // 1 转换中 2 保存中
text: '文件解析中,请稍等...',
},
},
});
} else { } else {
yield put({ yield put({
type: 'saveCourseWare', type: 'saveCourseWare',
...@@ -1032,6 +1080,12 @@ export default { ...@@ -1032,6 +1080,12 @@ export default {
}, },
}); });
} else { // 打开弹窗没操作 直接关闭弹窗 } else { // 打开弹窗没操作 直接关闭弹窗
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
},
});
yield put({ yield put({
type: 'uploadcourseware/updateState', type: 'uploadcourseware/updateState',
payload: { payload: {
...@@ -1044,19 +1098,28 @@ export default { ...@@ -1044,19 +1098,28 @@ export default {
* saveCourseWare({ payload }, { call, put, select }) { * saveCourseWare({ payload }, { call, put, select }) {
const { info } = payload; const { info } = payload;
const { addCourseObj, coursewareSubmitting } = yield select(state => state.onlineclasses); const { addCourseObj, coursewareSubmitting } = yield select(state => state.onlineclasses);
if (coursewareSubmitting) { // if (coursewareSubmitting) {
return; // return;
// }
// yield put({
// type: 'updateState',
// payload: {
// coursewareSubmitting: true,
// },
// });
if (info.from) {
delete info.from;
} }
yield put({ yield put({
type: 'updateState', type: 'uploadcourseware/updateState',
payload: { payload: {
coursewareSubmitting: true, saveStatus: {
status: 2, // 1 转换中 2 保存中
text: '保存中...',
},
}, },
}); });
if (info.from) { // const loadmessage = message.loading('保存中...', 0);
delete info.from;
}
const loadmessage = message.loading('保存中...', 0);
const data = yield call(courseMateriaAjax.uploadCourseware, { const data = yield call(courseMateriaAjax.uploadCourseware, {
content: JSON.stringify(info), content: JSON.stringify(info),
id: addCourseObj.id, id: addCourseObj.id,
...@@ -1067,7 +1130,7 @@ export default { ...@@ -1067,7 +1130,7 @@ export default {
coursewareSubmitting: false, coursewareSubmitting: false,
}, },
}); });
setTimeout(loadmessage); console.log(1111111111111);
if (data.code == 200) { if (data.code == 200) {
yield put({ yield put({
type: 'uploadcourseware/updateState', type: 'uploadcourseware/updateState',
...@@ -1076,6 +1139,15 @@ export default { ...@@ -1076,6 +1139,15 @@ export default {
info: {}, info: {},
}, },
}); });
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
...@@ -1098,7 +1170,17 @@ export default { ...@@ -1098,7 +1170,17 @@ export default {
params: {}, params: {},
}, },
}); });
message.success('课件保存成功...', 1);
} else { } else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({ yield put({
type: 'webapp/errorrequestresolve', type: 'webapp/errorrequestresolve',
payload: { payload: {
......
...@@ -20,6 +20,10 @@ export default { ...@@ -20,6 +20,10 @@ export default {
state: { state: {
visible: false, visible: false,
info: {}, info: {},
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
}, },
subscriptions: { subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line setup({ dispatch, history }) { // eslint-disable-line
...@@ -72,7 +76,7 @@ export default { ...@@ -72,7 +76,7 @@ export default {
return; return;
} }
let signature = {}; let signature = {};
const uploaderLoading = message.loading('件上传中...'); const uploaderLoading = message.loading('件上传中...');
const uploadSignature = yield call(ajax, params); const uploadSignature = yield call(ajax, params);
signature = uploadSignature.data; signature = uploadSignature.data;
if (uploadSignature.code == 200) { if (uploadSignature.code == 200) {
......
...@@ -124,13 +124,13 @@ class CourseBoxForm extends React.Component { ...@@ -124,13 +124,13 @@ class CourseBoxForm extends React.Component {
<List <List
size="large" size="large"
grid={{ grid={{
gutter: 20, gutter: 10,
xs: 1, xs: 1,
sm: 1, sm: 1,
md: 1, md: 1,
lg: 2, lg: 2,
xl: 2, xl: 3,
xxl: 3, xxl: 4,
}} }}
dataSource={list} dataSource={list}
footer={ footer={
......
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