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
This diff is collapsed.
...@@ -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