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);
......
......@@ -210,3 +210,30 @@
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 {
info,
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 1, // 1 转换中 2 保存中
text: '文件解析中,请稍等...',
},
},
});
} else {
yield put({
type: 'sureSaveCourseWare',
......@@ -1333,6 +1342,15 @@ export default {
},
});
} else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'webapp/errorrequestresolve',
payload: {
......@@ -1352,6 +1370,7 @@ export default {
});
const { data, code } = transformData;
if (code == 200) {
message.success('解析成功', 1);
yield put({
type: 'sureSaveCourseWare',
payload: {
......@@ -1373,6 +1392,15 @@ export default {
type: info.type,
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
} else if (code == 40060) {
yield delay(1000);
yield put({
......@@ -1384,6 +1412,15 @@ export default {
},
});
} else {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'webapp/errorrequestresolve',
payload: {
......@@ -1567,6 +1604,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: {
......@@ -1613,6 +1665,15 @@ export default {
},
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
......@@ -1621,18 +1682,18 @@ export default {
},
});
} else {
if (coursewareSubmitting) {
return;
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 data = yield call(courseMateriaAjax.uploadCourseware, {
content: JSON.stringify({
......@@ -1649,6 +1710,15 @@ export default {
});
setTimeout(loadmessage);
if (data.code == 200) {
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'updateState',
payload: {
......@@ -1672,6 +1742,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: {
......@@ -1696,11 +1781,29 @@ export default {
data: transformData,
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
}
},
* uploadCourseware({ payload }, { call, put, select }) {
const { info } = payload;
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.type == 4) {
yield put({
......@@ -1709,6 +1812,15 @@ export default {
info,
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 1, // 1 转换中 2 保存中
text: '文件解析中,请稍等...',
},
},
});
} else {
yield put({
type: 'createCourseMateria',
......@@ -1728,6 +1840,7 @@ export default {
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
editSingleCourseInfo: {
...editSingleCourseInfo,
content: {
......@@ -1745,18 +1858,18 @@ export default {
},
});
} else {
if (coursewareSubmitting) {
return;
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 data = yield call(courseMateriaAjax.uploadCourseware, {
content: JSON.stringify(info),
......@@ -1779,6 +1892,15 @@ export default {
},
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
......@@ -1799,10 +1921,19 @@ export default {
data,
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
saveStatus: {
status: 0, // 1 转换中 2 保存中
text: '',
},
},
});
}
}
}
} else {
} else if (info.from == 'materia') {
if (editSingleCourseId == 0) {
if (info.from) {
delete info.from;
......@@ -1810,6 +1941,7 @@ export default {
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
editSingleCourseInfo: {
...editSingleCourseInfo,
content: info,
......@@ -1823,16 +1955,7 @@ export default {
info: {},
},
});
} else if (info.from == 'materia') {
if (coursewareSubmitting) {
return;
}
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: true,
},
});
} else {
if (info.from) {
delete info.from;
}
......@@ -1849,6 +1972,12 @@ export default {
});
setTimeout(loadmessage);
if (data.code == 200) {
yield put({
type: 'selectCourseList',
payload: {
params: {},
},
});
yield put({
type: 'updateState',
payload: {
......@@ -1877,7 +2006,14 @@ export default {
},
});
}
}
} else {
yield put({
type: 'updateState',
payload: {
coursewareSubmitting: false,
},
});
yield put({
type: 'uploadcourseware/updateState',
payload: {
......@@ -1886,7 +2022,6 @@ export default {
},
});
}
}
},
* createCourseMateria({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
......
......@@ -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