Commit 5c9cbe98 authored by wangxuelai's avatar wangxuelai

''

parent 8f68b5e5
......@@ -17,6 +17,6 @@
</head>
<body>
<div id="root"></div>
<script src="dist/main.js?1574859238720" charset="utf-8"></script>
<script src="dist/main.js?1574863280714" charset="utf-8"></script>
</body>
</html>
\ No newline at end of file
......@@ -10,6 +10,7 @@ import {
SessionStorage,
isExpired,
getRandomFilename,
getFileType,
} from '../utils/index';
import * as courseMateriaAjax from '../services/courseMateria';
import * as onlineAjax from '../services/onlineclasses';
......@@ -889,7 +890,7 @@ export default {
signature, files, uploaderLoading, uploadtype, successCallback,
} = payload;
const file = files.files ? files.files[0] : null;
const { addCourseObj } = yield select(state => state.coursegatherdetail);
const { addCourseObj, editSingleCourseInfo } = yield select(state => state.coursegatherdetail);
const filename = `${signature.dir}${getRandomFilename(file.name)}`;
const params = {
key: filename,
......@@ -913,6 +914,20 @@ export default {
},
});
} else if (uploadtype == 'uploadCover') {
yield put({
type: 'createCourseMateria',
payload: {
content: {
name: file.name,
size: file.size,
fileType: file.type,
duration: 0,
images: [filename],
},
filename,
type: getFileType(file.type).filetype,
},
});
addCourseObj.cover = imageUrl;
yield put({
type: 'updateState',
......@@ -930,6 +945,30 @@ export default {
},
},
});
} else if (uploadtype == 'uploadSingleCourseCover') {
yield put({
type: 'createCourseMateria',
payload: {
content: {
name: file.name,
size: file.size,
fileType: file.type,
duration: 0,
images: [filename],
},
filename,
type: getFileType(file.type).filetype,
},
});
yield put({
type: 'updateState',
payload: {
editSingleCourseInfo: {
...editSingleCourseInfo,
cover: imageUrl,
},
},
});
}
if (successCallback && (typeof successCallback == 'function')) {
successCallback({
......
......@@ -6,7 +6,7 @@ import moment from 'moment';
import {
LocalStorage,
SessionStorage,
isExpired, getRandomFilename, imagify,
isExpired, getRandomFilename, imagify, getFileType,
} from '../utils/index';
import errorcode from '../common/errorcode';
import * as onlineAjax from '../services/onlineclasses';
......@@ -579,7 +579,7 @@ export default {
},
* queryimagesignature({ payload }, { call, put, select }) {
const { userInfo, sid } = yield select(state => state.webapp);
const { files, uploadtype } = payload;
const { files, uploadtype, successCallback } = payload;
const file = files.files ? files.files[0] : null;
const REGEXP_VIDEO = /^image\/\w+/;
const params = { type: 1, token: userInfo.token, schoolId: sid };
......@@ -596,6 +596,7 @@ export default {
files,
uploaderLoading,
uploadtype,
successCallback,
},
});
} else {
......@@ -611,7 +612,7 @@ export default {
},
* uploadimage({ payload }, { call, put, select }) {
const {
signature, files, uploaderLoading, uploadtype,
signature, files, uploaderLoading, uploadtype, successCallback,
} = payload;
const file = files.files ? files.files[0] : null;
const { addCourseObj } = yield select(state => state.onlineclasses);
......@@ -638,6 +639,20 @@ export default {
},
});
} else if (uploadtype == 'uploadCover') {
yield put({
type: 'createCourseMateria',
payload: {
content: {
name: file.name,
size: file.size,
fileType: file.type,
duration: 0,
images: [filename],
},
filename,
type: getFileType(file.type).filetype,
},
});
addCourseObj.cover = imageUrl;
yield put({
type: 'updateState',
......@@ -656,6 +671,9 @@ export default {
},
});
}
if (successCallback && (typeof successCallback == 'function')) {
successCallback();
}
setTimeout(uploaderLoading);
},
* queryvideosignature({ payload }, { call, put, select }) {
......
......@@ -63,7 +63,7 @@ class CourseBoxForm extends React.Component {
uploadCover = (e) => {
const { dispatch, uploadCover } = this.props;
uploadCover({
files: e.target.files,
files: e.target,
}, () => {
document.getElementById('uploadsinglecoursecover').value = '';
});
......
......@@ -154,6 +154,9 @@ class CourseDetailForm extends React.Component {
payload: {
files: e.target,
uploadtype: 'uploadCover',
successCallback() {
document.getElementById('upload1').value = '';
},
},
});
}
......@@ -283,6 +286,7 @@ class CourseDetailForm extends React.Component {
className={pageStyle.uploadInput}
accept="image/png, image/jpeg"
onChange={(e) => { this.uploadCover(e); }}
id="upload1"
/>
</div>
</div>
......@@ -300,6 +304,7 @@ class CourseDetailForm extends React.Component {
<img src={`${__IMGCDN__}course/upload_icon1.png`} alt="上传图片" />
<div className={pageStyle.tip}>上传图片</div>
<input
id="upload1"
type="file"
className={pageStyle.uploadInput}
accept="image/png, image/jpeg"
......
......@@ -634,19 +634,9 @@ class StaticCenter extends React.Component {
dispatch({
type: 'coursegatherdetail/queryimagesignature',
payload: {
files: {
files,
},
successCallback({ src }) {
dispatch({
type: 'coursegatherdetail/updateState',
payload: {
editSingleCourseInfo: {
...editSingleCourseInfo,
cover: src,
},
},
});
files: value.files,
uploadtype: 'uploadSingleCourseCover',
successCallback() {
if (callback && (typeof callback == 'function')) {
callback();
}
......
......@@ -156,6 +156,9 @@ class CourseDetailForm extends React.Component {
payload: {
files: e.target,
uploadtype: 'uploadCover',
successCallback() {
document.getElementById('upload1').value = '';
},
},
});
}
......@@ -353,6 +356,7 @@ class CourseDetailForm extends React.Component {
type="file"
className={pageStyle.uploadInput}
accept="image/png, image/jpeg"
id="upload1"
onChange={(e) => { this.uploadCover(e); }}
/>
</div>
......@@ -373,6 +377,7 @@ class CourseDetailForm extends React.Component {
<input
type="file"
className={pageStyle.uploadInput}
id="upload1"
accept="image/png, image/jpeg"
onChange={(e) => { this.uploadCover(e); }}
/>
......
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