Commit 1c27a803 authored by wangxuelai's avatar wangxuelai

''

parent 452c7fe9
......@@ -17,6 +17,6 @@
</head>
<body>
<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>
</html>
\ No newline at end of file
import { connect } from 'dva';
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 {
pageIn,
......@@ -87,6 +87,8 @@ class UploadCourseware extends React.Component {
visible,
info,
chooseFromCourseMateria,
saveStatus,
loading,
} = this.props;
return (
<Modal
......@@ -96,7 +98,7 @@ class UploadCourseware extends React.Component {
onCancel={this.hide}
onOk={this.save}
className="UploadCoursewareContent"
// confirmLoading={callStudentSubmitting}
confirmLoading={loading}
zIndex={110}
maskClosable={false}
width={600}
......@@ -126,6 +128,12 @@ class UploadCourseware extends React.Component {
</div>
</div>
<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 &&
<Carousel
className={pageStyle.Carousel}
......@@ -213,10 +221,12 @@ function mapStateToProps(state) {
const {
visible,
info,
saveStatus,
} = state.uploadcourseware;
return {
visible,
info,
saveStatus,
};
}
export default connect(mapStateToProps)(UploadCourseware);
......
......@@ -209,4 +209,31 @@
text-overflow: ellipsis;
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 {
},
});
} else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
},
});
yield put({
type: 'webapp/errorrequestresolve',
payload: {
......@@ -982,17 +997,41 @@ export default {
},
});
} else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data: transformData,
},
});
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
},
});
}
},
* uploadCourseware({ payload }, { call, put, select }) {
const { info } = payload;
const { addCourseObj, coursewareSubmitting } = yield select(state => state.onlineclasses);
if (coursewareSubmitting) {
return;
}
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: true,
},
});
const { from } = info;
if (from == 'upload') { // 课件上传得到需要转码
if (info.type == 4) { // 其他文件需要转码
......@@ -1002,6 +1041,15 @@ export default {
info,
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 1, // 1 转换中 2 保存中
text: '文件解析中,请稍等...',
},
},
});
} else {
yield put({
type: 'saveCourseWare',
......@@ -1032,6 +1080,12 @@ export default {
},
});
} else { // 打开弹窗没操作 直接关闭弹窗
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
......@@ -1044,19 +1098,28 @@ export default {
* saveCourseWare({ payload }, { call, put, select }) {
const { info } = payload;
const { addCourseObj, coursewareSubmitting } = yield select(state => state.onlineclasses);
if (coursewareSubmitting) {
return;
// if (coursewareSubmitting) {
// return;
// }
// yield put({
// type: 'updateState',
// payload: {
// coursewareSubmitting: true,
// },
// });
if (info.from) {
delete info.from;
}
yield put({
type: 'updateState',
type: 'uploadcourseware/updateState',
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, {
content: JSON.stringify(info),
id: addCourseObj.id,
......@@ -1067,7 +1130,7 @@ export default {
coursewareSubmitting: false,
},
});
setTimeout(loadmessage);
console.log(1111111111111);
if (data.code == 200) {
yield put({
type: 'uploadcourseware/updateState',
......@@ -1076,6 +1139,15 @@ export default {
info: {},
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'updateState',
payload: {
......@@ -1098,7 +1170,17 @@ export default {
params: {},
},
});
message.success('课件保存成功...', 1);
} else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'webapp/errorrequestresolve',
payload: {
......
......@@ -20,6 +20,10 @@ export default {
state: {
visible: false,
info: {},
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -72,7 +76,7 @@ export default {
return;
}
let signature = {};
const uploaderLoading = message.loading('件上传中...');
const uploaderLoading = message.loading('件上传中...');
const uploadSignature = yield call(ajax, params);
signature = uploadSignature.data;
if (uploadSignature.code == 200) {
......
......@@ -124,13 +124,13 @@ class CourseBoxForm extends React.Component {
<List
size="large"
grid={{
gutter: 20,
gutter: 10,
xs: 1,
sm: 1,
md: 1,
lg: 2,
xl: 2,
xxl: 3,
xl: 3,
xxl: 4,
}}
dataSource={list}
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