Commit 5226c799 authored by wangtao's avatar wangtao

'专栏预览新增'

parent 28af00d4
This diff is collapsed.
......@@ -375,7 +375,7 @@ class UserGuide extends React.Component {
// width
}}
>
学员管理添加学员
学员管理添加学员
</div>
<div
className={componentStyle.textdesc}
......
......@@ -75,6 +75,7 @@ export default {
poster: '',
},
editLoading: false,
previewLoading: false,
materialVisible: false,
queryParams: {
type: '',
......@@ -105,6 +106,8 @@ export default {
},
saveSingleCourseSubmitting: false,
coursewareSubmitting: false,
previewCourseQrcodeShow: false,
previewCourseQrcode: '',
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -1251,26 +1254,43 @@ export default {
},
* editCourse({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const { editLoading, addCourseObj, id } = yield select(state => state.coursegatherdetail);
if (editLoading) {
return;
const {
editLoading, addCourseObj, id, previewLoading,
} = yield select(state => state.coursegatherdetail);
let loadmessage = null;
if (payload.type === 'save') {
if (editLoading) {
return;
}
yield put({
type: 'updateState',
payload: {
editLoading: true,
},
});
loadmessage = message.loading('保存中...', 0);
} else if (payload.type === 'preview') {
if (previewLoading) {
return;
}
yield put({
type: 'updateState',
payload: {
previewLoading: true,
},
});
loadmessage = message.loading('预览二维码生成中...', 0);
}
yield put({
type: 'updateState',
payload: {
editLoading: true,
},
});
const {
title,
remark,
start_time,
study_count,
type,
callBack,
} = payload;
addCourseObj.intro = JSON.stringify(addCourseObj.intro);
const newCourseObj = { ...addCourseObj };
const loadmessage = message.loading('保存中...', 0);
const newParams = Object.assign(newCourseObj, {
title,
remark,
......@@ -1282,24 +1302,59 @@ export default {
]),
});
const data = yield call(onlineAjax.editCourse, newParams);
yield put({
type: 'updateState',
payload: {
editLoading: false,
},
});
setTimeout(loadmessage);
if (data.code == 200) {
message.success('保存成功', 0.5);
if (callBack && (typeof callBack == 'function')) {
callBack();
}
if (payload.type === 'save') {
yield put({
type: 'getGatherDetail',
type: 'updateState',
payload: {
id,
editLoading: false,
},
});
} else if (payload.type === 'preview') {
yield put({
type: 'updateState',
payload: {
previewLoading: false,
},
});
}
setTimeout(loadmessage);
if (data.code == 200) {
if (payload.type === 'save') {
message.success('保存成功', 0.5);
if (callBack && (typeof callBack == 'function')) {
callBack();
}
yield put({
type: 'getGatherDetail',
payload: {
id,
},
});
} else if (payload.type === 'preview') {
// sid=7&onlineCourseId=264
yield put({
type: 'getGatherDetail',
payload: {
id,
},
});
const qrcodeData = yield call(commonAjax.generateQrcode, {
scene: `s=${sid}&id=${id}`,
page: 'src/pages/websiteindex/onlineclassroomindex',
});
if (qrcodeData.code == 200) {
message.success('小程序码生成成功', 1);
yield put({
type: 'updateState',
payload: {
previewCourseQrcodeShow: true,
previewCourseQrcode: qrcodeData.data.url,
},
});
} else {
message.error('小程序码生成失败', 1);
}
}
} else {
yield put({
type: 'webapp/errorrequestresolve',
......
......@@ -121,7 +121,7 @@ class CourseDetailForm extends React.Component {
},
});
}
save = (e) => {
save = (e, type) => {
const { dispatch, form } = this.props;
e.preventDefault();
this.props.form.validateFieldsAndScroll({
......@@ -141,6 +141,7 @@ class CourseDetailForm extends React.Component {
title,
remark,
study_count,
type,
callBack: () => {
form.resetFields();
this.setState({
......@@ -288,7 +289,7 @@ class CourseDetailForm extends React.Component {
xl={{ span: 23 }}
xxl={{ span: 20 }}
>
<Form className={pageStyle.modalform} labelAlign="left" onSubmit={this.save}>
<Form className={pageStyle.modalform} labelAlign="left" onSubmit={e => this.save(e, 'save')}>
<FormItem {...formItemModalLineLayout} label="封&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;面" className={pageStyle.imgFormItem}>
{
addCourseObj.cover ?
......@@ -445,7 +446,7 @@ class CourseDetailForm extends React.Component {
>
<FormItem {...formItemModalLineLayout} style={{ marginBottom: 0 }}>
<Button loading={editLoading} type="primary" htmlType="submit" style={{ marginRight: 20 }}>保存</Button>
<Button style={{ marginRight: 20 }}>预览</Button>
<Button style={{ marginRight: 20 }} onClick={e => this.save(e, 'preview')}>预览</Button>
</FormItem>
</div>
</BtnPermission>
......
......@@ -21,6 +21,7 @@ import MaterialModal from '../../../components/MaterialModal';
import UploadCourseware from '../../../components/UploadCourseware';
import ChangePsdModal from '../../onlineclasses/ChangePsdModal';
import BtnPermission from '../../../components/BtnPermission';
import QrcodeShow from '../../../components/qrcodeShow';
class StaticCenter extends React.Component {
constructor(props) {
super(props);
......@@ -851,6 +852,16 @@ class StaticCenter extends React.Component {
},
});
}
closeCourseQrcodeShow = () => {
const { dispatch } = this.props;
dispatch({
type: 'coursegatherdetail/updateState',
payload: {
previewCourseQrcodeShow: false,
previewCourseQrcode: '',
},
});
}
render() {
const that = this;
const {
......@@ -885,6 +896,8 @@ class StaticCenter extends React.Component {
addCourseObj,
courseQueryParams,
coursewareSubmitting,
previewCourseQrcodeShow,
previewCourseQrcode,
} = this.props;
const menu = (
<Menu>
......@@ -979,6 +992,12 @@ class StaticCenter extends React.Component {
save={this.saveGatherCourse}
loading={addCourseSubmitting}
/>
<QrcodeShow
previewQrcodeShow={previewCourseQrcodeShow}
closeQrcodeShow={this.closeCourseQrcodeShow}
previewQrcode={previewCourseQrcode}
title="扫码预览专栏课程"
/>
<ManageCourse
visible={manageCourseShow}
list={manageCourseList}
......@@ -1088,6 +1107,8 @@ function mapStateToProps(state) {
addCourseObj,
courseQueryParams,
coursewareSubmitting,
previewCourseQrcodeShow,
previewCourseQrcode,
} = state.coursegatherdetail;
return {
tabIndex,
......@@ -1123,6 +1144,8 @@ function mapStateToProps(state) {
addCourseObj,
courseQueryParams,
coursewareSubmitting,
previewCourseQrcodeShow,
previewCourseQrcode,
};
}
export default connect(mapStateToProps)(StaticCenter);
......
......@@ -245,7 +245,7 @@ class GoodsAddModal extends React.Component {
{editCouponInfo.banner.length < 4 ?
<span className={pageStyle.uploadThumb}>
<input type="file" id="uploadinput" className={pageStyle.fileuploadinput} onChange={(e) => { this.uploadBanner(e); }} accept="image/*" />
新增图片
新增图片
</span> :
<span className={pageStyle.uploadThumb}>
已上传4
......
......@@ -224,6 +224,7 @@ class ThemeEditor extends React.Component {
moveContent,
editorUploadVideo,
} = this.props;
console.log(commentParams.intro, 'commentParams');
return (
<div className={pageStyle.container}>
<div className="clearfix">
......
......@@ -423,7 +423,7 @@ class SelectPlaceMap extends React.Component {
{ele.ad_info.province}{ele.ad_info.city}{ele.ad_info.district}
</div>
<div className={pageStyles.locationinfo}>
地址:{ele.title}
地址:{ele.title}
</div>
</div>
</div>
......
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