Commit 9172a53e authored by baixian's avatar baixian

111222dd

parent 4f481ca9
...@@ -187,8 +187,11 @@ export default { ...@@ -187,8 +187,11 @@ export default {
staticTotal: `${dakaapi}member/online_courses_total`, staticTotal: `${dakaapi}member/online_courses_total`,
staticChart: `${dakaapi}member/online_courses_chart`, staticChart: `${dakaapi}member/online_courses_chart`,
comments: `${dakaapi}common/website/comments`, comments: `${dakaapi}common/website/comments`,
strickcomments: `${dakaapi}member/website/comments`,
}, },
courseMateria: { courseMateria: {
index: `${dakaapi}member/materials`, index: `${dakaapi}member/materials`,
uploadcourseware: `${dakaapi}member/online_courses/upload_content`,
}, },
}; };
...@@ -91,7 +91,10 @@ class MaterialModalForm extends React.Component { ...@@ -91,7 +91,10 @@ class MaterialModalForm extends React.Component {
<List.Item> <List.Item>
<div className={pageStyle.item}> <div className={pageStyle.item}>
<Radio value={item}> <Radio value={item}>
{item.type == 1 && <img className={pageStyle.img} src={imagify(item.src)} alt="" />} {item.type === 1 && <img className={pageStyle.img} src={imagify(item.src)} alt="" />}
{item.type === 2 && <img className={pageStyle.img} src={`${__IMGCDN__}/course/video_default.PNG`} alt="" />}
{item.type === 3 && <img className={pageStyle.img} src={`${__IMGCDN__}/course/audio_default.PNG`} alt="" />}
{item.type === 4 && <img className={pageStyle.img} src={`${__IMGCDN__}/course/ppt_default.PNG`} alt="" />}
</Radio> </Radio>
</div> </div>
</List.Item> </List.Item>
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
.list { .list {
text-align: center; text-align: center;
} }
.tablefooterbox {
text-align: right;
}
.item { .item {
width: 150px; width: 150px;
height: 150px; height: 150px;
......
...@@ -27,14 +27,21 @@ class UploadCourseware extends React.Component { ...@@ -27,14 +27,21 @@ class UploadCourseware extends React.Component {
} }
save = () => { save = () => {
const { info, dispatch, callback } = this.props; const { info, dispatch, callback } = this.props;
callback(JSON.parse(JSON.stringify(info))); console.log(info, 'info');
dispatch({ dispatch({
type: 'uploadcourseware/updateState', type: 'uploadcourseware/uploadCourseware',
payload: { payload: {
visible: false, info,
info: {},
}, },
}); });
callback(JSON.parse(JSON.stringify(info)));
// dispatch({
// type: 'uploadcourseware/updateState',
// payload: {
// visible: false,
// info: {},
// },
// });
} }
hide = () => { hide = () => {
const { dispatch } = this.props; const { dispatch } = this.props;
......
...@@ -206,6 +206,94 @@ export default { ...@@ -206,6 +206,94 @@ export default {
}); });
if (data.code == 200) { if (data.code == 200) {
message.success('修改成功', 0.5); message.success('修改成功', 0.5);
yield put({
type: 'selectComment',
payload: {
params: {
source_id: data.data.source_id,
},
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* commentDelete({ payload }, { call, put, select }) {
const { id } = payload;
const data = yield call(onlineAjax.commentDelete, {
id,
});
if (data.code == 200) {
message.success('删除成功', 0.5);
yield put({
type: 'selectComment',
payload: {
params: {
source_id: data.data.source_id,
},
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* saveComment({ payload }, { call, put, select }) {
const {
id,
content,
callBack,
} = payload;
const { replyLoading } = yield select(state => state.onlineclasses);
if (replyLoading) {
return;
}
yield put({
type: 'updateState',
payload: {
replyLoading: true,
},
});
const loadmessage = message.loading('保存中...', 0);
const data = yield call(onlineAjax.commentSave, {
id,
content,
});
yield put({
type: 'updateState',
payload: {
replyLoading: false,
},
});
setTimeout(loadmessage);
if (data.code == 200) {
message.success('保存成功', 0.5);
if (callBack && (typeof callBack == 'function')) {
callBack();
}
yield put({
type: 'updateState',
payload: {
replyVisible: false,
},
});
yield put({
type: 'selectComment',
payload: {
params: {
source_id: data.data.source_id,
},
},
});
} else { } else {
yield put({ yield put({
type: 'webapp/errorrequestresolve', type: 'webapp/errorrequestresolve',
...@@ -361,7 +449,6 @@ export default { ...@@ -361,7 +449,6 @@ export default {
start_time, start_time,
study_count, study_count,
school_id: sid, school_id: sid,
content: JSON.stringify(coursewareInfo),
}); });
const data = yield call(onlineAjax.editCourse, newParams); const data = yield call(onlineAjax.editCourse, newParams);
yield put({ yield put({
......
...@@ -144,6 +144,32 @@ export default { ...@@ -144,6 +144,32 @@ export default {
}); });
} }
}, },
* uploadCourseware({ payload }, { call, put, select }) {
const { info } = payload;
const { addCourseObj } = yield select(state => state.onlineclasses);
const loadmessage = message.loading('保存中...', 0);
const data = yield call(courseMateriaAjax.uploadCourseware, {
content: JSON.stringify(info),
id: addCourseObj.id,
});
setTimeout(loadmessage);
if (data.code == 200) {
yield put({
type: 'updateState',
payload: {
visible: false,
info: {},
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* createCourseMateria({ payload }, { call, put, select }) { * createCourseMateria({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp); const { sid } = yield select(state => state.webapp);
const { const {
......
...@@ -42,7 +42,11 @@ class CommentListForm extends React.Component { ...@@ -42,7 +42,11 @@ class CommentListForm extends React.Component {
render() { render() {
const { const {
form: { getFieldDecorator, getFieldValue }, form: { getFieldDecorator, getFieldValue },
allRelativeCourseList,
gatherDetail,
staticChartId,
} = this.props; } = this.props;
console.log(allRelativeCourseList, 'allRelativeCourseList');
const dataSource = [ const dataSource = [
{ {
key: '1', key: '1',
...@@ -98,8 +102,12 @@ class CommentListForm extends React.Component { ...@@ -98,8 +102,12 @@ class CommentListForm extends React.Component {
className={pageStyle.searchBox} className={pageStyle.searchBox}
> >
<span className={pageStyle.searchname}>课程名称</span> <span className={pageStyle.searchname}>课程名称</span>
<Select style={{ width: '162px', marginRight: '21px' }}> <Select style={{ width: '162px', marginRight: '21px' }} value={Number(staticChartId)} onChange={this.change}>
<Option value="">课程</Option> <Option key={gatherDetail.id} value={Number(gatherDetail.id)}>全部</Option>
{allRelativeCourseList.map(ele => (
<Option key={ele.id} value={Number(ele.id)}>{ele.title}</Option>
))
}
</Select> </Select>
<Button type="primary" style={{ marginRight: '19px' }}>搜索</Button> <Button type="primary" style={{ marginRight: '19px' }}>搜索</Button>
<Button type="primary" ghost>重置</Button> <Button type="primary" ghost>重置</Button>
...@@ -117,10 +125,14 @@ CommentListForm.propTypes = { ...@@ -117,10 +125,14 @@ CommentListForm.propTypes = {
const CommentList = Form.create()(CommentListForm); const CommentList = Form.create()(CommentListForm);
function mapStateToProps(state) { function mapStateToProps(state) {
const { const {
addCourseObj, allRelativeCourseList,
} = state.onlineclasses; gatherDetail,
staticChartId,
} = state.coursegatherdetail;
return { return {
addCourseObj, allRelativeCourseList,
gatherDetail,
staticChartId,
}; };
} }
export default connect(mapStateToProps)(CommentList); export default connect(mapStateToProps)(CommentList);
......
...@@ -4,8 +4,23 @@ import { ...@@ -4,8 +4,23 @@ import {
Col, Col,
Select, Select,
Button, Button,
DatePicker, DatePicker, Empty,
} from 'antd'; } from 'antd';
import {
G2,
Chart,
Geom,
Axis,
Tooltip,
Coord,
Label,
Legend,
View,
Guide,
Shape,
Facet,
Util,
} from 'bizcharts';
import moment from 'moment'; import moment from 'moment';
import pageStyle from './StaticBox.less'; import pageStyle from './StaticBox.less';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
...@@ -17,6 +32,9 @@ class StaticBox extends React.Component { ...@@ -17,6 +32,9 @@ class StaticBox extends React.Component {
} }
componentWillUnmount() { // 卸载 componentWillUnmount() { // 卸载
} }
disabledDate=(current) => {
return current > moment();
}
render() { render() {
const { const {
staticTotalInfo, staticTotalInfo,
...@@ -32,6 +50,20 @@ class StaticBox extends React.Component { ...@@ -32,6 +50,20 @@ class StaticBox extends React.Component {
queryChartParams, queryChartParams,
dateChange, dateChange,
} = this.props; } = this.props;
const dataCols = {
month: {
type: 'time',
tickCount: 10,
},
};
const courseChart = staticChartInfo;
const dataChart = [];
const month = courseChart.dates;
const visitorCount = courseChart.visitor_count;
for (let i = 0; i < month.length && i < visitorCount.length; i++) {
dataChart.push({ month: month[i], count: visitorCount[i], name: '访问人数' });
}
console.log(this.props, ' this.props');
return ( return (
<div> <div>
<div className={pageStyle.StaticBox}> <div className={pageStyle.StaticBox}>
...@@ -68,19 +100,68 @@ class StaticBox extends React.Component { ...@@ -68,19 +100,68 @@ class StaticBox extends React.Component {
defaultValue={[moment(queryChartParams.start, 'YYYY-MM-DD'), moment(queryChartParams.end, 'YYYY-MM-DD')]} defaultValue={[moment(queryChartParams.start, 'YYYY-MM-DD'), moment(queryChartParams.end, 'YYYY-MM-DD')]}
format="YYYY-MM-DD" format="YYYY-MM-DD"
queryChartParams queryChartParams
ranges={{
' 最近7天': [moment().subtract(6, 'days'), moment()],
' 最近三十天 ': [moment().subtract(29, 'days'), moment()],
}}
disabledDate={this.disabledDate}
/> />
<div className={`${pageStyle.chartitem} ${pageStyle.payitem}`}> {/* <div className={`${pageStyle.chartitem} ${pageStyle.payitem}`}> */}
<div className={pageStyle.dot} /> {/* <div className={pageStyle.dot} /> */}
<div className={pageStyle.chartitemname}>付费人数</div> {/* <div className={pageStyle.chartitemname}>付费人数</div> */}
</div> {/* </div> */}
<div className={`${pageStyle.chartitem} ${pageStyle.visititem}`}> {/* <div className={`${pageStyle.chartitem} ${pageStyle.visititem}`}> */}
<div className={pageStyle.dot} /> {/* <div className={pageStyle.dot} /> */}
<div className={pageStyle.chartitemname}>访问人数</div> {/* <div className={pageStyle.chartitemname}>访问人数</div> */}
</div> {/* </div> */}
</Col> </Col>
</Row> </Row>
<Row style={{ marginBottom: '20px' }}> <Row style={{ marginBottom: '20px' }}>
图表页面 <div className={pageStyle.chartBox}>
{dataChart.length > 0 ?
<Chart height={350} data={dataChart} padding="auto" scale={dataCols} forceFit>
<Legend
textStyle={{ fontSize: '15', fill: '#5c5c5c', textBaseline: 'middle' }}
marker="circle"
offsetY={-45}
position="top-right"
items={[
{
value: 'visitor_count',
marker: {
fill: '#FFB879',
radius: 2,
},
},
]}
/>
<Axis name="month" />
<Tooltip
g2-tooltip={{
backgroundColor: '#000',
opacity: '0.75',
color: '#FFFFFF',
}}
crosshairs={{
type: 'y',
fill: '#000',
stroke: '#000',
}}
/>
<Geom
type="line"
position="month*count"
color={['name', ['#FFB879']]}
size={3}
shape="smooth"
/>
</Chart>
:
<div className={pageStyle.chartEmpty}>
<Empty />
</div>
}
</div>
</Row> </Row>
</div> </div>
<div className={pageStyle.divideLine} /> <div className={pageStyle.divideLine} />
......
...@@ -39,6 +39,13 @@ class StaticCenter extends React.Component { ...@@ -39,6 +39,13 @@ class StaticCenter extends React.Component {
tabIndex: tab, tabIndex: tab,
}, },
}); });
} else if (tab == 4) {
dispatch({
type: 'coursegatherdetail/getAllRelativeCourseList',
payload: {
tabIndex: tab,
},
});
} }
} }
toAddCourse = () => { toAddCourse = () => {
......
import { connect } from 'dva';
import React from 'react';
import {
Icon,
Divider,
Tabs,
Select,
Form,
Upload,
Row,
Col,
Input,
Radio,
Modal,
message,
DatePicker,
Button,
} from 'antd';
import pageStyle from './ThemeEditor.less';
import { pageIn, hasBtnPower, imagify, ossVideofy } from '../../utils/index';
const FormItem = Form.Item;
const { TextArea } = Input;
class ReplyModal extends React.Component {
constructor(props) {
super(props);
this.state = {
};
}
componentDidMount() { // 挂载
pageIn('轻校-线上课堂');
}
componentDidUpdate() {
}
componentWillUnmount() { // 卸载
}
close = () => {
const { close } = this.props;
close();
}
save = (e) => {
const { save, form } = this.props;
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
const {
id,
content,
} = values;
save({
id,
content,
callBack: () => {
form.resetFields();
},
});
}
});
}
render() {
const {
visible,
form: { getFieldDecorator, getFieldValue },
record,
replyLoading,
} = this.props;
const formItemModalLineLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 3 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 20 },
},
};
console.log(record, 'record');
return (
<Modal
visible={visible}
maskClosable={false}
zIndex={110}
width={600}
bodyStyle={{
padding: '40px 20px',
}}
title="回复"
closable={false}
onCancel={this.close}
okText="保存"
cancelText="取消"
confirmLoading={replyLoading}
onOk={this.save}
>
<Form className={pageStyle.modalform} labelAlign="left" onSubmit={this.save}>
{getFieldDecorator('id', { initialValue: record && record.id })(<Input type="hidden" />)}
<FormItem {...formItemModalLineLayout} label="内容">
{getFieldDecorator('content', {
initialValue: '',
rules: [
{
required: true,
message: '请输入回复内容',
},
],
})(<TextArea rows={2} />)}
</FormItem>
</Form>
</Modal>
);
}
}
ReplyModal.propTypes = {
};
const ReplyModalForm = Form.create()(ReplyModal);
export default connect()(ReplyModalForm);
...@@ -65,6 +65,10 @@ class AddCourseModalForm extends React.Component { ...@@ -65,6 +65,10 @@ class AddCourseModalForm extends React.Component {
time, time,
password, password,
} = values; } = values;
if (password.length < 4) {
message.error('密码至少4位', 0.5);
return;
}
dispatch({ dispatch({
type: 'onlineclasses/addCourse', type: 'onlineclasses/addCourse',
payload: { payload: {
...@@ -179,11 +183,13 @@ class AddCourseModalForm extends React.Component { ...@@ -179,11 +183,13 @@ class AddCourseModalForm extends React.Component {
rules: [ rules: [
{ {
required: true, required: true,
message: '请输入4-8位密码', message: '请输入正整数',
pattern: new RegExp(/^[1-9]\d*$/, 'g'),
}, },
], ],
})( })(
<Input style={{ width: 200 }} maxLength={8} placeholder="请输入4-8位密码" />, <Input style={{ width: 200 }} maxLength={8} placeholder="请输入4-8位密码" />,
<span className="ant-form-text">请输入4-8位数字密码</span>,
)} )}
</FormItem> : '' </FormItem> : ''
} }
......
...@@ -14,12 +14,13 @@ import { ...@@ -14,12 +14,13 @@ import {
Divider, Divider,
DatePicker, DatePicker,
Table, Table,
InputNumber, Checkbox, Radio, Pagination, Checkbox, Radio, Modal,
Tooltip,
} from 'antd'; } from 'antd';
import moment from 'moment';
import ThemeEditor from '../../newtheme/ThemeEditor'; import ThemeEditor from '../../newtheme/ThemeEditor';
import pageStyle from './CommentList.less'; import pageStyle from './CommentList.less';
import { pageIn, hasBtnPower, imagify } from '../../../utils'; import { pageIn, hasBtnPower, imagify } from '../../../utils';
import ReplyModal from '../ReplyModal';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const FormItem = Form.Item; const FormItem = Form.Item;
const { Option } = Select; const { Option } = Select;
...@@ -42,19 +43,97 @@ class CommentListForm extends React.Component { ...@@ -42,19 +43,97 @@ class CommentListForm extends React.Component {
handleClickStick =(record) => { handleClickStick =(record) => {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch({ dispatch({
type: 'onlineclasses/changeCourseStatus', type: 'onlineclasses/commentStick',
payload: { payload: {
place_top: 1, place_top: 1,
id: record.id, id: record.id,
}, },
}); });
} }
changePage = (page, perPage) => {
const { dispatch, addCourseObj } = this.props;
dispatch({
type: 'onlineclasses/selectComment',
payload: {
params: {
page,
perPage,
source_id: addCourseObj.id,
},
},
});
}
handleClickDelete = (record) => {
const { dispatch } = this.props;
Modal.confirm({
title: '确定删除这条评论吗?',
content: '删除后不可恢复,请谨慎操作!',
okText: '确定',
cancelText: '取消',
icon: <Icon type="close-circle" style={{ color: 'red' }} />,
onOk() {
dispatch({
type: 'onlineclasses/commentDelete',
payload: {
id: record.id,
},
});
},
okButtonProps: {
type: 'danger',
style: {
color: '#fff',
backgroundColor: '#ff4d4f',
borderColor: '#ff4d4f',
},
},
});
}
handleClickReview = (record) => {
const { dispatch } = this.props;
dispatch({
type: 'onlineclasses/updateState',
payload: {
replyVisible: true,
},
});
this.setState({
record,
});
}
closeReply = () => {
const { dispatch } = this.props;
dispatch({
type: 'onlineclasses/updateState',
payload: {
replyVisible: false,
},
});
this.setState({
record: '',
});
}
saveReply = (values) => {
const { dispatch } = this.props;
dispatch({
type: 'onlineclasses/saveComment',
payload: {
id: values.id,
content: values.content,
callBack: values.callBack,
},
});
}
render() { render() {
const { const {
form: { getFieldDecorator, getFieldValue }, form: { getFieldDecorator, getFieldValue },
commentList, commentList,
commentListTotal, commentListTotal,
commentParams,
replyVisible,
replyLoading,
} = this.props; } = this.props;
const { record } = this.state;
const columns = [ const columns = [
{ {
title: '序号', title: '序号',
...@@ -74,6 +153,15 @@ class CommentListForm extends React.Component { ...@@ -74,6 +153,15 @@ class CommentListForm extends React.Component {
{ {
title: '内容', title: '内容',
dataIndex: 'content', dataIndex: 'content',
render: (text, record) => {
return (
<div>
<Tooltip title={text}>
<span className={pageStyle.hreflink}>{text.substring(0, 20)}</span>
</Tooltip>
</div>
);
},
}, },
{ {
title: '操作', title: '操作',
...@@ -81,11 +169,17 @@ class CommentListForm extends React.Component { ...@@ -81,11 +169,17 @@ class CommentListForm extends React.Component {
render: (text, record) => { render: (text, record) => {
return ( return (
<div> <div>
<span className={pageStyle.hreflink}>回复</span> { record.website_comment_reply === null ?
<span className={pageStyle.hreflink} onClick={() => this.handleClickReview(record)}>回复</span>
:
<Tooltip title={record.website_comment_reply.content}>
<span className={pageStyle.hreflink}>已回复</span>
</Tooltip>
}
<Divider type="vertical" /> <Divider type="vertical" />
<span className={pageStyle.hreflink} onClick={() => this.handleClickStick(record)}>置顶</span> <span className={pageStyle.hreflink} onClick={() => this.handleClickStick(record)}>置顶</span>
<Divider type="vertical" /> <Divider type="vertical" />
<span className={pageStyle.hreflink}>删除</span> <span className={pageStyle.hreflink} onClick={() => this.handleClickDelete(record)}>删除</span>
</div> </div>
); );
}, },
...@@ -93,7 +187,29 @@ class CommentListForm extends React.Component { ...@@ -93,7 +187,29 @@ class CommentListForm extends React.Component {
]; ];
return ( return (
<div className={pageStyle.container}> <div className={pageStyle.container}>
<Table rowKey="id" dataSource={commentList} columns={columns} /> <Table
rowKey="id"
dataSource={commentList}
columns={columns}
pagination={false}
footer={() => (
<div className="tablefooterbox">
<span className="tablefooterstatic">{commentListTotal}条数据</span>
<Pagination
pageSize={commentParams.perPage}
total={Number(commentListTotal)}
onChange={this.changePage}
/>
</div>
)}
/>
<ReplyModal
visible={replyVisible}
record={record}
close={this.closeReply}
replyLoading={replyLoading}
save={this.saveReply}
/>
</div> </div>
); );
} }
...@@ -107,10 +223,18 @@ function mapStateToProps(state) { ...@@ -107,10 +223,18 @@ function mapStateToProps(state) {
const { const {
commentList, commentList,
commentListTotal, commentListTotal,
commentParams,
addCourseObj,
replyVisible,
replyLoading,
} = state.onlineclasses; } = state.onlineclasses;
return { return {
commentList, commentList,
commentListTotal, commentListTotal,
commentParams,
addCourseObj,
replyVisible,
replyLoading,
}; };
} }
export default connect(mapStateToProps)(CommentList); export default connect(mapStateToProps)(CommentList);
......
...@@ -3,4 +3,5 @@ ...@@ -3,4 +3,5 @@
font-family:PingFang SC; font-family:PingFang SC;
font-weight:400; font-weight:400;
color:rgba(24,144,255,1); color:rgba(24,144,255,1);
cursor: pointer;
} }
...@@ -260,6 +260,7 @@ class CourseDetailForm extends React.Component { ...@@ -260,6 +260,7 @@ class CourseDetailForm extends React.Component {
} }
toUploadCourseware = () => { toUploadCourseware = () => {
const { dispatch, coursewareInfo } = this.props; const { dispatch, coursewareInfo } = this.props;
console.log(coursewareInfo, 'coursewareInfo1111111');
dispatch({ dispatch({
type: 'uploadcourseware/updateState', type: 'uploadcourseware/updateState',
payload: { payload: {
...@@ -278,7 +279,10 @@ class CourseDetailForm extends React.Component { ...@@ -278,7 +279,10 @@ class CourseDetailForm extends React.Component {
queryParams, queryParams,
materiaListTotal, materiaListTotal,
coursewareInfo, coursewareInfo,
info,
} = this.props; } = this.props;
console.log(info, 'coursewareInfo');
console.log(coursewareInfo, 'coursewareInfo');
const formItemModalLineLayout = { const formItemModalLineLayout = {
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
...@@ -376,10 +380,10 @@ class CourseDetailForm extends React.Component { ...@@ -376,10 +380,10 @@ class CourseDetailForm extends React.Component {
placeholder="选择时间" placeholder="选择时间"
/>)} />)}
</FormItem> </FormItem>
<div> {/* <div> */}
<span>课件:</span> {/* <span>课件:</span> */}
<span>{(coursewareInfo.properties && coursewareInfo.properties.name) || '无'}</span> {/* <span>{(coursewareInfo.properties && coursewareInfo.properties.name) || '无'}</span> */}
</div> {/* </div> */}
<FormItem {...formItemModalLineLayout} label="语音介绍"> <FormItem {...formItemModalLineLayout} label="语音介绍">
{ {
addCourseObj.audio ? addCourseObj.audio ?
...@@ -449,6 +453,9 @@ function mapStateToProps(state) { ...@@ -449,6 +453,9 @@ function mapStateToProps(state) {
// queryParams, // queryParams,
// materiaListTotal, // materiaListTotal,
// } = state.coursemateria; // } = state.coursemateria;
const {
info,
} = state.uploadcourseware;
return { return {
addCourseObj, addCourseObj,
editLoading, editLoading,
...@@ -457,6 +464,7 @@ function mapStateToProps(state) { ...@@ -457,6 +464,7 @@ function mapStateToProps(state) {
queryParams, queryParams,
materiaListTotal, materiaListTotal,
coursewareInfo, coursewareInfo,
info,
}; };
} }
export default connect(mapStateToProps)(CourseDetail); export default connect(mapStateToProps)(CourseDetail);
......
...@@ -22,16 +22,31 @@ import { ...@@ -22,16 +22,31 @@ import {
Facet, Facet,
Util, Util,
} from 'bizcharts'; } from 'bizcharts';
import moment from 'moment';
import pageStyle from './StaticBox.less'; import pageStyle from './StaticBox.less';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const { Option } = Select; const { Option } = Select;
class StaticBox extends React.Component { class StaticBox extends React.Component {
componentDidMount() { // 挂载 componentDidMount() {
} }
componentDidUpdate() { componentDidUpdate() {
} }
componentWillUnmount() { // 卸载 componentWillUnmount() { // 卸载
} }
disabledDate=(current) => {
return current > moment();
}
onChange = (dates, dateStrings) => {
const { dispatch, addCourseObj } = this.props;
dispatch({
type: 'onlineclasses/selectChart',
payload: {
start: dateStrings[0],
end: dateStrings[1],
id: addCourseObj.id,
},
});
}
render() { render() {
const { courseChartData, dataAllTotal } = this.props; const { courseChartData, dataAllTotal } = this.props;
const dataCols = { const dataCols = {
...@@ -47,8 +62,10 @@ class StaticBox extends React.Component { ...@@ -47,8 +62,10 @@ class StaticBox extends React.Component {
for (let i = 0; i < month.length && i < visitorCount.length; i++) { for (let i = 0; i < month.length && i < visitorCount.length; i++) {
dataChart.push({ month: month[i], count: visitorCount[i], name: '访问人数' }); dataChart.push({ month: month[i], count: visitorCount[i], name: '访问人数' });
} }
const yesterday = moment(moment().subtract(6, 'days').unix() * 1000);
const today = moment(moment().unix() * 1000);
return ( return (
<div> <div className={pageStyle.container}>
<div className={pageStyle.StaticBox}> <div className={pageStyle.StaticBox}>
<Row> <Row>
<Col <Col
...@@ -59,64 +76,72 @@ class StaticBox extends React.Component { ...@@ -59,64 +76,72 @@ class StaticBox extends React.Component {
className={pageStyle.searchBox} className={pageStyle.searchBox}
> >
<span className={pageStyle.searchname}>日期</span> <span className={pageStyle.searchname}>日期</span>
<RangePicker onChange={this.onChange} style={{ marginRight: '42px' }} /> <RangePicker
<div className={`${pageStyle.chartitem} ${pageStyle.payitem}`}> onChange={this.onChange}
<div className={pageStyle.dot} /> ranges={{
<div className={pageStyle.chartitemname}>付费人数</div> ' 最近7天': [moment().subtract(6, 'days'), moment()],
</div> ' 最近三十天 ': [moment().subtract(29, 'days'), moment()],
<div className={`${pageStyle.chartitem} ${pageStyle.visititem}`}> }}
<div className={pageStyle.dot} /> disabledDate={this.disabledDate}
<div className={pageStyle.chartitemname}>访问人数</div> allowClear={false}
</div> style={{ marginRight: '42px' }}
defaultValue={[yesterday, today]}
/>
{/* <div className={`${pageStyle.chartitem} ${pageStyle.payitem}`}> */}
{/* <div className={pageStyle.dot} /> */}
{/* <div className={pageStyle.chartitemname}>付费人数</div> */}
{/* </div> */}
{/* <div className={`${pageStyle.chartitem} ${pageStyle.visititem}`}> */}
{/* <div className={pageStyle.dot} /> */}
{/* <div className={pageStyle.chartitemname}>访问人数</div> */}
{/* </div> */}
</Col> </Col>
</Row> </Row>
<Row style={{ marginBottom: '20px', width: 800 }}> <div className={pageStyle.chartBox}>
<div> {dataChart.length > 0 ?
{dataChart.length > 0 ? <Chart height={350} data={dataChart} padding="auto" scale={dataCols} forceFit>
<Chart height={350} data={dataChart} padding="auto" scale={dataCols} forceFit> <Legend
<Legend textStyle={{ fontSize: '15', fill: '#5c5c5c', textBaseline: 'middle' }}
textStyle={{ fontSize: '15', fill: '#5c5c5c', textBaseline: 'middle' }} marker="circle"
marker="circle" offsetY={-45}
offsetY={-45} position="top-right"
position="top-left" items={[
items={[ {
{ value: 'visitor_count',
value: 'visitor_count', marker: {
marker: { fill: '#FFB879',
fill: '#FFB879', radius: 2,
radius: 2,
},
}, },
]} },
/> ]}
<Axis name="month" /> />
<Tooltip <Axis name="month" />
g2-tooltip={{ <Tooltip
backgroundColor: '#000', g2-tooltip={{
opacity: '0.75', backgroundColor: '#000',
color: '#FFFFFF', opacity: '0.75',
}} color: '#FFFFFF',
crosshairs={{ }}
type: 'y', crosshairs={{
fill: '#000', type: 'y',
stroke: '#000', fill: '#000',
}} stroke: '#000',
/> }}
<Geom />
type="line" <Geom
position="month*count" type="line"
color={['name', ['#FFB879']]} position="month*count"
size={3} color={['name', ['#FFB879']]}
shape="smooth" size={3}
/> shape="smooth"
</Chart> />
: </Chart>
<div className={pageStyle.chartEmpty}> :
<Empty /> <div className={pageStyle.chartEmpty}>
</div> <Empty />
} </div>
</div> }
</Row> </div>
</div> </div>
<div className={pageStyle.divideLine} /> <div className={pageStyle.divideLine} />
<div className={pageStyle.staticDetail}> <div className={pageStyle.staticDetail}>
...@@ -239,10 +264,12 @@ function mapStateToProps(state) { ...@@ -239,10 +264,12 @@ function mapStateToProps(state) {
const { const {
courseChartData, courseChartData,
dataAllTotal, dataAllTotal,
addCourseObj,
} = state.onlineclasses; } = state.onlineclasses;
return { return {
courseChartData, courseChartData,
dataAllTotal, dataAllTotal,
addCourseObj,
}; };
} }
export default connect(mapStateToProps)(StaticBoxForm); export default connect(mapStateToProps)(StaticBoxForm);
......
.container {
width: 100%;
}
.StaticBox { .StaticBox {
padding: 27px 20px; padding: 27px 20px;
margin-bottom: 10px; margin-bottom: 10px;
...@@ -109,4 +112,7 @@ ...@@ -109,4 +112,7 @@
} }
} }
} }
} }
\ No newline at end of file .chartBox {
width: 1000px;
}
...@@ -81,7 +81,6 @@ class ClassMgtForm extends React.Component { ...@@ -81,7 +81,6 @@ class ClassMgtForm extends React.Component {
} }
deleteCourse = (item) => { deleteCourse = (item) => {
const { dispatch } = this.props; const { dispatch } = this.props;
console.log(item, 'item');
Modal.confirm({ Modal.confirm({
title: `确定删除“${item.title}”?`, title: `确定删除“${item.title}”?`,
content: '删除后不可恢复,请谨慎操作!', content: '删除后不可恢复,请谨慎操作!',
......
.container { .container {
padding-bottom: 20px; padding-bottom: 20px;
width: 100%;
.head { .head {
height: 100px; //height: 100px;
width: 100%; //width: 100%;
padding: 20px; padding: 20px;
background-color: #fff; background-color: #fff;
.hedaTitle { .hedaTitle {
......
...@@ -25,3 +25,12 @@ export function delMateria(params) { ...@@ -25,3 +25,12 @@ export function delMateria(params) {
data, data,
}); });
} }
export function uploadCourseware(params) {
const data = qs.stringify(params);
return request({
url: `${api.courseMateria.uploadcourseware}/${params.id}`,
method: 'PUT',
data,
});
}
...@@ -84,8 +84,24 @@ export function selectComment(params) { ...@@ -84,8 +84,24 @@ export function selectComment(params) {
export function commentStick(params) { export function commentStick(params) {
const data = qs.stringify(params); const data = qs.stringify(params);
return request({ return request({
url: `${api.onlineclasses.comments}/${params.id}`, url: `${api.onlineclasses.strickcomments}/${params.id}`,
method: 'PUT', method: 'PUT',
data, data,
}); });
} }
export function commentDelete(params) {
const data = qs.stringify(params);
return request({
url: `${api.onlineclasses.strickcomments}/${params.id}`,
method: 'DELETE',
data,
});
}
export function commentSave(params) {
const data = qs.stringify(params);
return request({
url: `${api.onlineclasses.strickcomments}?${data}`,
method: 'POST',
data,
});
}
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