Commit 71c063c4 authored by baixian's avatar baixian

111222dd

parent 309623ca
......@@ -204,6 +204,111 @@ export default {
});
}
},
* 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: 'searchCourseReply',
payload: {
params: {
source_id: data.data.source_id,
},
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* commentStick({ payload }, { call, put, select }) {
const { id, place_top } = payload;
const data = yield call(onlineAjax.commentStick, {
id,
place_top,
});
if (data.code == 200) {
message.success('修改成功', 0.5);
yield put({
type: 'searchCourseReply',
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.coursegatherdetail);
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: 'searchCourseReply',
payload: {
params: {
source_id: data.data.source_id,
},
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* getGatherDetail({ payload }, { call, put, select }) {
const { id, addCourseObj } = yield select(state => state.coursegatherdetail);
const loading = message.loading('数据加载中...', 0);
......@@ -274,6 +379,11 @@ export default {
status: '',
content: '',
},
commentList: [],
commentParams: {
page: 1,
perPage: 10,
},
},
});
},
......@@ -512,6 +622,30 @@ export default {
});
}
},
* searchCourseReply({ payload }, { call, put, select }) {
const { params } = payload;
const { commentParams } = yield select(state => state.coursegatherdetail);
const newParams = Object.assign(commentParams, params, {
source_type: 4,
});
const data = yield call(onlineAjax.selectComment, newParams);
if (data.code == 200) {
yield put({
type: 'updateState',
payload: {
commentList: data.data && data.data.list,
commentListTotal: data.data && data.data.total,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* getStaticChart({ payload }, { call, put, select }) {
const { staticChartId, queryChartParams } = yield select(state => state.coursegatherdetail);
const { params } = payload;
......
......@@ -14,12 +14,13 @@ import {
Divider,
DatePicker,
Table,
InputNumber, Checkbox, Radio,
InputNumber, Checkbox, Radio, Pagination, Tooltip, Modal,
} from 'antd';
import moment from 'moment';
import ThemeEditor from '../../newtheme/ThemeEditor';
import pageStyle from './CommentList.less';
import { pageIn, hasBtnPower, imagify } from '../../../utils';
import ReplyModal from '../../onlineclasses/ReplyModal';
const { TabPane } = Tabs;
const FormItem = Form.Item;
const { Option } = Select;
......@@ -39,58 +40,184 @@ class CommentListForm extends React.Component {
}
componentWillUnmount() { // 卸载
}
chooseCourseID = (value) => {
const { dispatch } = this.props;
dispatch({
type: 'coursegatherdetail/updateState',
payload: {
staticChartId: value,
},
});
}
searchCourseReply = () => {
const { dispatch, staticChartId } = this.props;
dispatch({
type: 'coursegatherdetail/searchCourseReply',
payload: {
params: {
source_id: staticChartId,
},
},
});
}
changePage = (page, perPage) => {
const { dispatch, staticChartId } = this.props;
dispatch({
type: 'coursegatherdetail/searchCourseReply',
payload: {
params: {
page,
perPage,
source_id: staticChartId,
},
},
});
}
handleClickDelete = (record) => {
const { dispatch } = this.props;
Modal.confirm({
title: '确定删除这条评论吗?',
content: '删除后不可恢复,请谨慎操作!',
okText: '确定',
cancelText: '取消',
icon: <Icon type="close-circle" style={{ color: 'red' }} />,
onOk() {
dispatch({
type: 'coursegatherdetail/commentDelete',
payload: {
id: record.id,
},
});
},
okButtonProps: {
type: 'danger',
style: {
color: '#fff',
backgroundColor: '#ff4d4f',
borderColor: '#ff4d4f',
},
},
});
}
handleClickStick =(record) => {
const { dispatch } = this.props;
dispatch({
type: 'coursegatherdetail/commentStick',
payload: {
place_top: 1,
id: record.id,
},
});
}
handleClickReview = (record) => {
const { dispatch } = this.props;
dispatch({
type: 'coursegatherdetail/updateState',
payload: {
replyVisible: true,
},
});
this.setState({
record,
});
}
closeReply = () => {
const { dispatch } = this.props;
dispatch({
type: 'coursegatherdetail/updateState',
payload: {
replyVisible: false,
},
});
this.setState({
record: '',
});
}
saveReply = (values) => {
const { dispatch } = this.props;
dispatch({
type: 'coursegatherdetail/saveComment',
payload: {
id: values.id,
content: values.content,
callBack: values.callBack,
},
});
}
resetCourseReply = () => {
const { dispatch, gatherDetail } = this.props;
dispatch({
type: 'coursegatherdetail/updateState',
payload: {
staticChartId: gatherDetail.id,
},
});
}
render() {
const {
form: { getFieldDecorator, getFieldValue },
allRelativeCourseList,
gatherDetail,
staticChartId,
commentList,
commentListTotal,
commentParams,
replyVisible,
replyLoading,
} = this.props;
console.log(allRelativeCourseList, 'allRelativeCourseList');
const dataSource = [
{
key: '1',
name: '胡彦斌',
age: 32,
address: '西湖区湖底公园1号',
},
{
key: '2',
name: '胡彦祖',
age: 42,
address: '西湖区湖底公园1号',
},
];
const { record } = this.state;
const columns = [
{
title: '序号',
dataIndex: 'name',
dataIndex: 'id',
},
{
title: '用户',
dataIndex: 'age',
dataIndex: 'comment_user',
render: (text, record) => {
return (
<div>
{record.comment_user.nickname}
</div>
);
},
},
{
title: '内容',
dataIndex: 'address',
dataIndex: 'content',
render: (text, record) => {
return (
<div>
<Tooltip title={text}>
<span className={pageStyle.hreflink}>{text.substring(0, 20)}</span>
</Tooltip>
</div>
);
},
},
{
title: '操作',
dataIndex: 'a',
render: () => {
render: (text, record) => {
return (
<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" />
<span className={pageStyle.hreflink}>置顶</span>
<span className={pageStyle.hreflink} onClick={() => this.handleClickStick(record)}>置顶</span>
<Divider type="vertical" />
<span className={pageStyle.hreflink}>删除</span>
<span className={pageStyle.hreflink} onClick={() => this.handleClickDelete(record)}>删除</span>
</div>
);
},
},
];
console.log(this.props, 'this.props');
return (
<div className={pageStyle.container}>
<Row>
......@@ -102,18 +229,41 @@ class CommentListForm extends React.Component {
className={pageStyle.searchBox}
>
<span className={pageStyle.searchname}>课程名称</span>
<Select style={{ width: '162px', marginRight: '21px' }} value={Number(staticChartId)} onChange={this.change}>
<Select style={{ width: '162px', marginRight: '21px' }} value={Number(staticChartId)} onChange={this.chooseCourseID}>
<Option key={gatherDetail.id} value={Number(gatherDetail.id)}>全部</Option>
{allRelativeCourseList.map(ele => (
<Option key={ele.id} value={Number(ele.id)}>{ele.title}</Option>
))
}
</Select>
<Button type="primary" style={{ marginRight: '19px' }}>搜索</Button>
<Button type="primary" ghost>重置</Button>
<Button type="primary" style={{ marginRight: '19px' }} onClick={this.searchCourseReply}>搜索</Button>
<Button type="primary" ghost onClick={this.resetCourseReply}>重置</Button>
</Col>
</Row>
<Table rowKey="id" dataSource={dataSource} columns={columns} />
<Table
rowKey="id"
dataSource={commentList}
columns={columns}
pagination={false}
footer={() => (
commentList.length > 0 &&
<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>
);
}
......@@ -128,11 +278,21 @@ function mapStateToProps(state) {
allRelativeCourseList,
gatherDetail,
staticChartId,
commentList,
commentListTotal,
commentParams,
replyVisible,
replyLoading,
} = state.coursegatherdetail;
return {
allRelativeCourseList,
gatherDetail,
staticChartId,
commentList,
commentListTotal,
commentParams,
replyVisible,
replyLoading,
};
}
export default connect(mapStateToProps)(CommentList);
......
......@@ -3,6 +3,7 @@
font-family:PingFang SC;
font-weight:400;
color:rgba(24,144,255,1);
cursor: pointer;
}
.searchname {
color: #000000;
......@@ -16,5 +17,5 @@
margin-bottom: 20px;
}
.container {
padding: 31px 21px
}
\ No newline at end of file
padding: 31px 21px
}
......@@ -190,7 +190,7 @@ class StaticBox extends React.Component {
<Row className={pageStyle.staticitemList}>
<Col className={pageStyle.staticitem} lg={4} md={24} xs={24} sm={24}>
<div className={pageStyle.staticIconBox}>
<img className={pageStyle.staticIcon} src="https://cdn.img.shangjiadao.cn/clock-test/member/12186/2019-07-08/240ef0e06262ffb11253e03bf986143c.jpg?x-oss-process=image/resize,w_640/rotate,360/crop,x_176,y_36,w_288,h_288" alt="" />
<img className={pageStyle.staticIcon} src={`${__IMGCDN__}/course/data_icon1.png`} alt="" />
</div>
<div className={pageStyle.staticRight}>
<div className={pageStyle.staticName}>访问人数</div>
......@@ -241,7 +241,7 @@ class StaticBox extends React.Component {
<Row className={pageStyle.staticitemList}>
<Col className={pageStyle.staticitem} lg={4} md={24} xs={24} sm={24}>
<div className={pageStyle.staticIconBox}>
<img className={pageStyle.staticIcon} src="https://cdn.img.shangjiadao.cn/clock-test/member/12186/2019-07-08/240ef0e06262ffb11253e03bf986143c.jpg?x-oss-process=image/resize,w_640/rotate,360/crop,x_176,y_36,w_288,h_288" alt="" />
<img className={pageStyle.staticIcon} src={`${__IMGCDN__}/course/data_icon2.png`} alt="" />
</div>
<div className={pageStyle.staticRight}>
<div className={pageStyle.staticName}>分享好友</div>
......@@ -265,7 +265,7 @@ class StaticBox extends React.Component {
</Col> */}
<Col className={pageStyle.staticitem} lg={4} md={24} xs={24} sm={24}>
<div className={pageStyle.staticIconBox}>
<img className={pageStyle.staticIcon} src="https://cdn.img.shangjiadao.cn/clock-test/member/12186/2019-07-08/240ef0e06262ffb11253e03bf986143c.jpg?x-oss-process=image/resize,w_640/rotate,360/crop,x_176,y_36,w_288,h_288" alt="" />
<img className={pageStyle.staticIcon} src={`${__IMGCDN__}/course/data_icon3.png`} alt="" />
</div>
<div className={pageStyle.staticRight}>
<div className={pageStyle.staticName}>分享邀请卡</div>
......@@ -280,7 +280,7 @@ class StaticBox extends React.Component {
<Row className={pageStyle.staticitemList}>
<Col className={pageStyle.staticitem} lg={4} md={24} xs={24} sm={24}>
<div className={pageStyle.staticIconBox}>
<img className={pageStyle.staticIcon} src="https://cdn.img.shangjiadao.cn/clock-test/member/12186/2019-07-08/240ef0e06262ffb11253e03bf986143c.jpg?x-oss-process=image/resize,w_640/rotate,360/crop,x_176,y_36,w_288,h_288" alt="" />
<img className={pageStyle.staticIcon} src={`${__IMGCDN__}/course/data_icon4.png`} alt="" />
</div>
<div className={pageStyle.staticRight}>
<div className={pageStyle.staticName}>评论</div>
......
......@@ -28,7 +28,7 @@ class StaticCenter extends React.Component {
componentWillUnmount() { // 卸载
}
tabShift = (tab) => {
const { dispatch } = this.props;
const { dispatch, gatherDetail } = this.props;
dispatch({
type: 'coursegatherdetail/updateState',
payload: {
......@@ -36,6 +36,12 @@ class StaticCenter extends React.Component {
},
});
if (tab == 2) {
dispatch({
type: 'coursegatherdetail/updateState',
payload: {
staticChartId: gatherDetail.id,
},
});
dispatch({
type: 'coursegatherdetail/getAllRelativeCourseList',
payload: {
......@@ -43,6 +49,12 @@ class StaticCenter extends React.Component {
},
});
} else if (tab == 4) {
dispatch({
type: 'coursegatherdetail/updateState',
payload: {
staticChartId: gatherDetail.id,
},
});
dispatch({
type: 'coursegatherdetail/getAllRelativeCourseList',
payload: {
......
......@@ -27,24 +27,24 @@ class MediaCard extends React.Component {
{info.type == 1 &&
<div className={`${pageStyle.mediaBox} ${pageStyle.imgBox}`}>
<img className={pageStyle.image} src={`${imagify(info.src)}`} alt="" />
<img className={pageStyle.imageicon} src="https://cdn.img.shangjiadao.cn/clock-test/member/12186/2019-07-08/240ef0e06262ffb11253e03bf986143c.jpg?x-oss-process=image/resize,w_640/rotate,360/crop,x_176,y_36,w_288,h_288" alt="" />
<img className={pageStyle.imageicon} src={`${__IMGCDN__}/course/photo_icon.png`} alt="" />
</div>}
{info.type == 2 &&
<div className={`${pageStyle.mediaBox} ${pageStyle.videoBox}`}>
<img className={pageStyle.videoposter} src={`${videoPoster(info.src)}`} alt="" />
<img className={pageStyle.videoicon} src="https://cdn.img.shangjiadao.cn/clock-test/member/12186/2019-07-08/240ef0e06262ffb11253e03bf986143c.jpg?x-oss-process=image/resize,w_640/rotate,360/crop,x_176,y_36,w_288,h_288" alt="" />
<img className={pageStyle.videoicon} src={`${__IMGCDN__}/course/video_icon.png`} alt="" />
<div className={pageStyle.videoplay}>
<img className={pageStyle.videoplayicon} src={`${__IMGCDN__}smallplayicon.png`} alt="" />
</div>
</div>}
{info.type == 4 &&
<div className={`${pageStyle.mediaBox} ${pageStyle.fileBox}`}>
<img className={pageStyle.fileIcon} src="https://cdn.img.shangjiadao.cn/clock-test/member/12186/2019-07-08/240ef0e06262ffb11253e03bf986143c.jpg?x-oss-process=image/resize,w_640/rotate,360/crop,x_176,y_36,w_288,h_288" alt="" />
<img className={pageStyle.fileIcon} src={`${__IMGCDN__}/course/ppt_icon.png`} alt="" />
<div className={pageStyle.fileName}>{content.name}</div>
</div>}
{info.type == 3 &&
<div className={`${pageStyle.mediaBox} ${pageStyle.audioBox}`}>
<img className={pageStyle.audioIcon} src="https://cdn.img.shangjiadao.cn/clock-test/member/12186/2019-07-08/240ef0e06262ffb11253e03bf986143c.jpg?x-oss-process=image/resize,w_640/rotate,360/crop,x_176,y_36,w_288,h_288" alt="" />
<img className={pageStyle.audioIcon} src={`${__IMGCDN__}/course/audio_icon.png`} alt="" />
<div className={pageStyle.audioTime}>60&ldquo;</div>
</div>}
<div className={pageStyle.bottom}>
......
......@@ -65,7 +65,7 @@ class AddCourseModalForm extends React.Component {
time,
password,
} = values;
if (password.length < 4) {
if (is_encrypt === true && password.length < 4) {
message.error('密码至少4位', 0.5);
return;
}
......
......@@ -111,7 +111,7 @@ class CourseDetailForm extends React.Component {
});
}
courseUploadVideo = ({ files, uploadtype, time }) => {
const { dispatch } = this.props;
const { dispatch, addCourseObj } = this.props;
dispatch({
type: 'onlineclasses/queryvideosignature',
payload: {
......@@ -260,7 +260,6 @@ class CourseDetailForm extends React.Component {
}
toUploadCourseware = () => {
const { dispatch, coursewareInfo } = this.props;
console.log(coursewareInfo, 'coursewareInfo1111111');
dispatch({
type: 'uploadcourseware/updateState',
payload: {
......@@ -281,8 +280,6 @@ class CourseDetailForm extends React.Component {
coursewareInfo,
info,
} = this.props;
console.log(info, 'coursewareInfo');
console.log(coursewareInfo, 'coursewareInfo');
const formItemModalLineLayout = {
labelCol: {
xs: { span: 24 },
......
......@@ -116,7 +116,6 @@ class ClassMgtForm extends React.Component {
},
},
});
console.log(page, perPage, '111111111');
}
render() {
const {
......
......@@ -42,6 +42,7 @@
}
.tabs {
background-color: #fff;
width: 100%;
}
}
.editStatus {
......
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