姓名:
{this.setState({name: e.target.value})}}
- style={{ width: '242px'}}
+ style={{ width: '221px'}}
>
单位:
{/* {this.setState({school_name: e.target.value})}}
@@ -210,14 +210,7 @@ class AddStudentModal extends Component{
>搜索
{/* */}
- {course_groups && course_groups.length &&
- 分班:
-
-
}
+
@@ -247,7 +240,12 @@ class AddStudentModal extends Component{
12 }>
-
+
@@ -271,6 +269,14 @@ class AddStudentModal extends Component{
+ {course_groups && course_groups.length &&
+ 所选学生分班至(选填):
+
+
}
: }
diff --git a/public/react/src/modules/forums/ForumsIndex.css b/public/react/src/modules/forums/ForumsIndex.css
index c4af188eb..22925f882 100644
--- a/public/react/src/modules/forums/ForumsIndex.css
+++ b/public/react/src/modules/forums/ForumsIndex.css
@@ -5,6 +5,9 @@
.discuss-tab {
height: 90px;
}
+ .discuss-tab ._forum_tab a.navItem {
+ line-height: 2;
+ }
.discuss-tab ._forum_tab a.navItem:hover {
color: #4CACFF !important;
border-bottom: none !important;
diff --git a/public/react/src/modules/forums/MemoDetail.js b/public/react/src/modules/forums/MemoDetail.js
index e504dae77..0b53d9507 100644
--- a/public/react/src/modules/forums/MemoDetail.js
+++ b/public/react/src/modules/forums/MemoDetail.js
@@ -44,7 +44,7 @@ class MemoDetail extends Component {
this.state = {
memoLoading: true,
hasMoreComments: false,
- pageCount: 1,
+ pageCount: 2,
goldRewardDialogOpen: false
}
@@ -54,12 +54,12 @@ class MemoDetail extends Component {
const { match } = this.props
- const memoUrl = `/api/v1/memos/${match.params.memoId}`;
+ const memoUrl = `/memos/${match.params.memoId}.json`;
this.setState({
memoLoading: true
})
axios.get(memoUrl,{
- withCredentials: true,
+ // withCredentials: true,
})
.then((response) => {
const memo = response.data.memo
@@ -86,14 +86,16 @@ class MemoDetail extends Component {
}
this.setState({
hasMoreComments,
- pageCount: 1,
+ pageCount: 2,
comments: memo_replies
})
delete response.data.memo_replies;
+ // reset
+ response.data.memo.praise_count = response.data.memo.memo_praise_count
this.props.initForumState(response.data)
- const user = response.data.current_user;
- user.tidding_count = response.data.tidding_count;
- this.props.initCommonState(user)
+ // const user = response.data.current_user;
+ // user.tidding_count = response.data.tidding_count;
+ // this.props.initCommonState(user)
}
this.setState({
memoLoading: false
@@ -116,10 +118,10 @@ class MemoDetail extends Component {
$('body>#root').off('onMemoDelete')
}
onMemoDelete(memo) {
- const deleteUrl = `/api/v1/memos/${memo.id}`;
+ const deleteUrl = `/memos/${memo.id}.json`;
// 获取memo list
axios.delete(deleteUrl, {
- withCredentials: true,
+ // withCredentials: true,
})
.then((response) => {
const status = response.data.status
@@ -158,14 +160,14 @@ class MemoDetail extends Component {
clickPraise(){
const { memo } = this.props;
- const url = `/api/v1/discusses/${memo.id}/plus`;
+ const url = `/discusses/${memo.id}/plus.json`;
console.log(url)
axios.post(url, {
container_type: 'Memo',
type: 1 // "踩0;赞1"
},
{
- withCredentials: true
+ // withCredentials: true
}
).then((response) => {
console.log(response);
@@ -223,7 +225,8 @@ class MemoDetail extends Component {
this.createNewComment(commentContent, id, editor);
return;
}
- const url = `/api/v1/memos/${id}/reply`;
+ // /${id}
+ const url = `/memos/reply.json`;
const { comments } = this.state;
const user = this._getUser();
/*
@@ -235,12 +238,14 @@ class MemoDetail extends Component {
commentContent = commentContent.replace(/(\n\n\t
\n<\/p>)*$/g,'');
}
axios.post(url, {
+ parent_id: id,
content: commentContent
},
{
- withCredentials: true
+ // withCredentials: true
}
).then((response) => {
+ response.data.memo = response.data
if (response.data.memo) {
let newDiscuss = response.data.memo;
@@ -303,12 +308,12 @@ class MemoDetail extends Component {
if (childCommentId) {
deleteCommentId = childCommentId;
}
- const url = `/api/v1/memos/${deleteCommentId}`
+ const url = `/memos/${deleteCommentId}.json`
let comments = this.state.comments;
axios.delete(url,
{
- withCredentials: true
+ // withCredentials: true
}
).then((response) => {
// TODO 删除成功或失败
@@ -346,7 +351,7 @@ class MemoDetail extends Component {
const { comments } = this.state;
const commentIndex = this._findById(discussId, comments);
- const url = `/api/v1/discusses/${discussId}/plus`
+ const url = `/discusses/${discussId}/plus.json`
axios.post(url, {
// id: discussId,
// container_id: challenge.id,
@@ -354,7 +359,7 @@ class MemoDetail extends Component {
type: comments[commentIndex].user_praise === true ? 0 : 1, // "踩0;赞1"
},
{
- withCredentials: true
+ // withCredentials: true
}
).then((response) => {
if (response.data.praise_count === 0 || response.data.praise_count) {
@@ -379,7 +384,7 @@ class MemoDetail extends Component {
handleComment = childComment;
}
let handleCommentId = handleComment.id;
- const url = `/api/v1/discusses/${handleCommentId}/reward_code`
+ const url = `/discusses/${handleCommentId}/reward_code.json`
axios.post(url, {
id: handleCommentId,
@@ -389,7 +394,7 @@ class MemoDetail extends Component {
user_id: handleComment.user_id
},
{
- withCredentials: true
+ // withCredentials: true
}
).then((response) => {
if (response.data && response.data.code) {
@@ -423,7 +428,7 @@ class MemoDetail extends Component {
const id = item.id
const { showSnackbar } = this.props;
const user = this._getUser();
- const url = `/api/v1/memos/${id}/hidden`
+ const url = `/memos/${id}/hidden.json`
const { comments } = this.state;
const commentIndex = this._findById(id, comments);
@@ -432,14 +437,14 @@ class MemoDetail extends Component {
hidden: !comment.hidden ? "1" : "0"
},
{
- withCredentials: true
+ // withCredentials: true
}
).then((response) => {
if (response.data.status === -1) {
showSnackbar(response.data.message)
return;
}
- if (response.data.status === 1) {
+ if (response.data.status === 0) {
if (!childCommentId) {
comment.hidden = !comment.hidden;
@@ -473,14 +478,16 @@ class MemoDetail extends Component {
return;
}
}
- const url = `/api/v1/memos/${memo.id}/reply`;
+ // /${memo.id}
+ const url = `/memos/reply.json`;
let { comments } = this.state;
const user = this._getUser();
axios.post(url, {
+ parent_id: memo.id,
content: content
},
{
- withCredentials: true
+ // withCredentials: true
}
).then((response) => {
if (response.data.status === -1) {
@@ -488,6 +495,7 @@ class MemoDetail extends Component {
return;
}
if (response.data) {
+ response.data.memo = response.data
const newMemo = response.data.memo;
// ke
editor.html && editor.html('');
@@ -536,12 +544,12 @@ class MemoDetail extends Component {
let { comments, pageCount } = this.state;
let { memo } = this.props;
const user = this._getUser();
- const url = `/api/v1/memos/${memo.id}/more_reply?page=${pageCount}`;
+ const url = `/memos/${memo.id}/more_reply.json?page=${pageCount}`;
axios.get(url, {
},
{
- withCredentials: true
+ // withCredentials: true
}
).then((response) => {
if (response.data.status === -1) {
@@ -584,10 +592,10 @@ class MemoDetail extends Component {
params.forum_id = this.state.p_forum_id;
}
let paramsUrl = urlStringify(params)
- const set_top_or_down_Url = `/api/v1/memos/${memo.id}/set-top-or-down?${paramsUrl}`;
+ const set_top_or_down_Url = `/memos/${memo.id}/sticky_or_cancel.json?${paramsUrl}`;
// 获取memo list
- axios.get(set_top_or_down_Url, {
- withCredentials: true,
+ axios.post(set_top_or_down_Url, {
+ // withCredentials: true,
})
.then((response) => {
const status = response.data.status
@@ -608,9 +616,8 @@ class MemoDetail extends Component {
const { memo, author_info } = this.props;
const newMemo = Object.assign({}, memo);
const _reward = parseInt(inputVal)
- const newMemoUrl = `/api/v1/memos/${memo.id}/update`
- const url = `/api/v1/discusses/${memo.id}/reward_code`
+ const url = `/discusses/${memo.id}/reward_code.json`
axios.post(url, {
id: memo.id,
@@ -619,7 +626,7 @@ class MemoDetail extends Component {
score: _reward,
user_id: author_info.user_id
}, {
- withCredentials: true,
+ // withCredentials: true,
})
.then((response) => {
const { code } = response.data;
@@ -659,14 +666,24 @@ class MemoDetail extends Component {
const { memo, recommend_shixun, current_user,author_info } = this.props;
const { comments, hasMoreComments, goldRewardDialogOpen } = this.state;
- if (this.state.memoLoading) {
+ if (!memo || this.state.memoLoading) {
return
}
- current_user.user_url = `/users/${current_user.login}`;
+ let _current_user = {}
+ if (current_user) {
+ _current_user = current_user
+ }
+ (_current_user.user_url = `/users/${_current_user.login}`);
memo.isDetailPage = true;
// TODO 图片上传地址
return (
- {/* fl with100 */}
+
{/* fl with100 */}
+
+
{memo.reward}
}
- { current_user && (current_user.admin === true || current_user.user_id === author_info.user_id) &&
-
+ { _current_user && (_current_user.admin === true || _current_user.user_id === author_info.user_id) &&
+
- { current_user.admin === true &&
+ { _current_user.admin === true &&
( memo.sticky === true ?
- this.setTop(memo)}>取消置顶
:
@@ -701,15 +718,22 @@ class MemoDetail extends Component {
}
-
+
返回
{moment(memo.time).fromNow()} 发布
-
- { current_user.admin &&
+
+
+ { _current_user.admin &&
@@ -770,7 +794,7 @@ class MemoDetail extends Component {
{memo.replies_count}
- {
var commentMDEditor = window.create_editorMD_4comment("memo_comment_editorMd", '', this.props.height || 240, placeholder, imageUrl, () => {
- commentMDEditor.focus()
+ // commentMDEditor.focus()
this.isMDInited = true
this.initDrag()
diff --git a/public/react/src/modules/forums/MemoNew.js b/public/react/src/modules/forums/MemoNew.js
index 1a293eae3..98d95ddce 100644
--- a/public/react/src/modules/forums/MemoNew.js
+++ b/public/react/src/modules/forums/MemoNew.js
@@ -15,6 +15,7 @@ import Upload from 'rc-upload';
import axios from 'axios'
import 'antd/lib/select/style/index.css'
+import TPMMDEditor from '../tpm/challengesnew/TPMMDEditor'
import { getUrl } from 'educoder'
const Option = Select.Option;
@@ -130,6 +131,7 @@ const languageSeparator = '/'
class MemoNew extends Component {
constructor(props) {
super(props)
+ this.mdRef = React.createRef();
// https://testbdweb.trustie.net/uploads.js?attachment_id=1&filename=jqui.js
// https://ant.design/components/upload-cn/
@@ -179,7 +181,7 @@ class MemoNew extends Component {
}
let mdVal;
try {
- mdVal = this.taskpass_editormd.getValue()
+ mdVal = this.mdRef.current.getValue()
} catch (e) {
showSnackbar('编辑器还未加载完毕,请稍后')
@@ -205,6 +207,7 @@ class MemoNew extends Component {
// collect attachments
const $ = window.$;
const attachmentsMap = {};
+ const attachmentIds = []
$('#attachments_fields .attachment').each(( index, item ) => {
const filename = $(item).find('.upload_filename').val();
// $($('#attachments_fields .attachment')[0]).find('input:nth-child(6)').val()
@@ -215,13 +218,14 @@ class MemoNew extends Component {
token,
attachment_id
}
+ attachmentIds.push(attachment_id)
})
if (currentMemoId) {
- this.updateMemo(attachmentsMap)
+ this.updateMemo(attachmentIds)
} else {
- this.newMemo(attachmentsMap)
+ this.newMemo(attachmentIds)
}
}
onCancel() {
@@ -235,23 +239,23 @@ class MemoNew extends Component {
}
updateMemo(attachmentsMap) {
const { memoSubject, memoRepertoire, memoLanguage, memoType, currentMemoId, content } = this.state;
- const mdVal = this.taskpass_editormd.getValue()
+ const mdVal = this.mdRef.current.getValue()
console.log('isContentEdit: ', mdVal === content);
- const newMemoUrl = `/api/v1/memos/${currentMemoId}/update`
- axios.post(newMemoUrl, {
+ const newMemoUrl = `/memos/${currentMemoId}.json`
+ axios.put(newMemoUrl, {
content_changed: this.contentChanged,
tags: memoLanguage,
- memo:{
+ // memo:{
subject: memoSubject ,
content: mdVal,
forum_id: memoType,
repertoire_name: memoRepertoire,
// language: memoLanguage.join(languageSeparator),
//
- },
+ // },
attachments: attachmentsMap
}, {
- withCredentials: true,
+ // withCredentials: true,
})
.then((response) => {
const { status, message, memo_id } = response.data;
@@ -267,21 +271,21 @@ class MemoNew extends Component {
}
newMemo(attachmentsMap) {
const { memoSubject, memoRepertoire, memoLanguage, memoType } = this.state;
- const mdVal = this.taskpass_editormd.getValue()
+ const mdVal = this.mdRef.current.getValue()
- const newMemoUrl = `/api/v1/memos/create`
+ const newMemoUrl = `/memos.json`
axios.post(newMemoUrl, {
tags: memoLanguage,
- memo:{
+ // memo:{
subject: memoSubject ,
content: mdVal,
forum_id: memoType,
- repertoire_name: memoRepertoire,
+ // repertoire_name: memoRepertoire,
- },
+ // },
attachments: attachmentsMap
}, {
- withCredentials: true,
+ // withCredentials: true,
})
.then((response) => {
const { status, message, memo_id } = response.data;
@@ -296,9 +300,9 @@ class MemoNew extends Component {
})
}
componentDidMount() {
- const newMemoUrl = `/api/v1/memos/new`
+ const newMemoUrl = `/memos/new.json`
axios.get(newMemoUrl,{
- withCredentials: true,
+ // withCredentials: true,
})
.then((response) => {
const data = response.data;
@@ -319,9 +323,9 @@ class MemoNew extends Component {
// repertoiresTagMap
})
- const user = response.data.current_user;
- user.tidding_count = response.data.tidding_count;
- this.props.initCommonState(user)
+ // const user = response.data.current_user;
+ // user.tidding_count = response.data.tidding_count;
+ // this.props.initCommonState(user)
// 初始化 csrf meta
const $ = window.$
@@ -336,18 +340,20 @@ class MemoNew extends Component {
const { match } = this.props
const memoId = match.params.memoId;
if (memoId) {
- const memoUrl = `/api/v1/memos/${match.params.memoId}/edit`;
+ const memoUrl = `/memos/${match.params.memoId}/edit.json`;
axios.get(memoUrl,{
- withCredentials: true,
+ // withCredentials: true,
})
.then((response) => {
const tag_list = response.data.tag_list
if (tag_list) {
// this.setState({...response.data})
- const { content, forum_id, id, tag, repertoire_name, subject,
- current_user, tag_list, attachments_url } = response.data;
+ const { content, forum_id, id, repertoire_name, subject,
+ current_user, tag_list, attachments_url, memo_tags } = response.data;
this.initMD(content);
// this.onRepertoiresChange(repertoire_name)
+ // tag -> memo_tags
+ const tag = memo_tags;
let memoLanguage = []
if (tag) {
memoLanguage = tag.map((item, index) => {
@@ -355,7 +361,7 @@ class MemoNew extends Component {
})
}
this.setState({
- currentMemoId: id,
+ currentMemoId: memoId,
memoSubject: subject,
memoType: forum_id,
memoRepertoire: repertoire_name,
@@ -377,7 +383,7 @@ class MemoNew extends Component {
window.$("html,body").animate({"scrollTop":0})
this.props.initForumState({
- current_user,
+ // current_user,
tag_list
})
}
@@ -394,6 +400,8 @@ class MemoNew extends Component {
}
initMD(initValue) {
+ return;
+
this.contentChanged = false;
const placeholder = "";
// amp;
@@ -566,9 +574,12 @@ class MemoNew extends Component {
*
diff --git a/public/react/src/modules/forums/Post.css b/public/react/src/modules/forums/Post.css
index d10857a60..7b9792dea 100644
--- a/public/react/src/modules/forums/Post.css
+++ b/public/react/src/modules/forums/Post.css
@@ -8,6 +8,9 @@
min-height: 400px;
position: relative;
}
+ #forum_index_list .forum_table .forum_table_item {
+ background: #fff;
+ }
.noMemosTip {
position: absolute;
right: 10px;
diff --git a/public/react/src/modules/forums/PostItem.js b/public/react/src/modules/forums/PostItem.js
index aa610184f..02d9fa273 100644
--- a/public/react/src/modules/forums/PostItem.js
+++ b/public/react/src/modules/forums/PostItem.js
@@ -29,7 +29,7 @@ class PostItem extends Component {
-
+
{/* target="_blank" */}
@@ -46,16 +46,16 @@ class PostItem extends Component {
-
{memo.username}
+
{memo.user_name}
{/*最后回复:todo{memo.username}
memo.language && memo.language != 'other' &&
{memo.language}
*/}
-
{moment(memo.updated_at).fromNow()}
+ {/*
{moment(memo.updated_at).fromNow()} */}
{memo.tag && memo.tag.length ?
来自 {memo.tag.join('/')} : ''}
{/*
C++*/}
-
+
{/* data-tip-down="回复数" {memo.replies_count}
{memo.praise_count}*/}
{memo.replies_count ?
diff --git a/public/react/src/modules/forums/PostPaginationHOC.js b/public/react/src/modules/forums/PostPaginationHOC.js
index 25e397318..3922eae41 100644
--- a/public/react/src/modules/forums/PostPaginationHOC.js
+++ b/public/react/src/modules/forums/PostPaginationHOC.js
@@ -165,7 +165,7 @@ return function wrap(WrappedComponent) {
let paramsUrl = queryString.stringify(params)
- const memosUrl = '/api/v1/memos?' + paramsUrl // /${challenge.identifier}/star
+ const memosUrl = '/memos.json?' + paramsUrl // /${challenge.identifier}/star
this.setState({
currentPage,
@@ -174,7 +174,7 @@ return function wrap(WrappedComponent) {
})
// 获取memo list
axios.get(memosUrl,{
- withCredentials: true,
+ // withCredentials: true,
})
.then((response) => {
const memo_count = response.data.memo_count
@@ -186,9 +186,9 @@ return function wrap(WrappedComponent) {
this.fetchMemos(maxPage);
return;
}
- const user = response.data.current_user;
- user.tidding_count = response.data.tidding_count;
- this.props.initCommonState(user)
+ // const user = response.data.current_user;
+ // user.tidding_count = response.data.tidding_count;
+ // this.props.initCommonState(user)
this.props.initForumState(response.data)
this.setState({
p_forum_id: params.forum,
@@ -242,16 +242,18 @@ return function wrap(WrappedComponent) {
params.forum_id = this.state.p_forum_id;
}
let paramsUrl = urlStringify(params)
- const set_top_or_down_Url = `/api/v1/memos/${memo.id}/set-top-or-down?${paramsUrl}`;
+ const set_top_or_down_Url = `/memos/${memo.id}/sticky_or_cancel.json?${paramsUrl}`;
// 获取memo list
- axios.get(set_top_or_down_Url, {
- withCredentials: true,
+ axios.post(set_top_or_down_Url, {
+ // withCredentials: true,
})
.then((response) => {
const status = response.data.status
if (status === 0) {
- const { memo_list } = response.data;
- this.props.initForumState({ memo_list })
+ this.fetchMemos(1, '')
+
+ // const { memo_list } = response.data;
+ // this.props.initForumState({ memo_list })
// 刷新列表
// TODO 服务端直接返回第一页列表
// this.props.history.replace('/')
@@ -268,7 +270,7 @@ return function wrap(WrappedComponent) {
const deleteUrl = `/api/v1/memos/${memo.id}`;
// 获取memo list
axios.delete(deleteUrl, {
- withCredentials: true,
+ // withCredentials: true,
})
.then((response) => {
const status = response.data.status
diff --git a/public/react/src/modules/forums/RecommendShixun.js b/public/react/src/modules/forums/RecommendShixun.js
index 9ebaf3cae..aa9dec952 100644
--- a/public/react/src/modules/forums/RecommendShixun.js
+++ b/public/react/src/modules/forums/RecommendShixun.js
@@ -33,7 +33,7 @@ class RecommendShixun extends Component {
+ className="color-grey-6 task-hide mb10 recomment-name" style={{maxWidth:'147px'}}>
{_shixun.name}
{_shixun.myshixuns_count} 人学习
@@ -50,7 +50,7 @@ class RecommendShixun extends Component {
// 参考 TPMShixunDiscuss.js 推荐实训, 页面路径:http://localhost:3007/shixuns/uznmbg54/shixun_discuss
return (
-
推荐实训
+
推荐实训
{this.showRecommandShixun()}
diff --git a/public/react/src/modules/forums/UserSection.js b/public/react/src/modules/forums/UserSection.js
index 4610c2441..8376a2369 100644
--- a/public/react/src/modules/forums/UserSection.js
+++ b/public/react/src/modules/forums/UserSection.js
@@ -1,62 +1,87 @@
-import React, { Component } from 'react';
-
-import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
-
-import PropTypes from 'prop-types';
-
-import classNames from 'classnames'
-
-import axios from 'axios'
-
-class UserSection extends Component {
- constructor(props) {
- super(props)
-
- this.state = {
-
- }
- }
- /*点击关注或者取消关注*/
- AboutFocus(){
- const { author_info } = this.props
- /*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/
-
- const focusUrl = `/api/v1/users/${author_info.user_id}/${this.props.author_info.watched ? 'unwatch' : 'watch'}?object_id=${author_info.user_id}&object_type=user`
-
- axios.get(focusUrl,{
- })
- .then((response) => {
- const status = response.data.status;
- console.log(status);
- if(status == 1){
- const new_author_info = Object.assign({}, this.props.author_info)
- new_author_info.watched = !new_author_info.watched
- this.props.initForumState({author_info: new_author_info})
- }
- }).catch((error) => {
- console.log(error)
- })
- }
-
-
- render() {
- const { match, history, author_info , current_user } = this.props
- if (!author_info) {
- return
- }
- return (
-
- );
- }
-}
-
-export default UserSection;
+import React, { Component } from 'react';
+
+import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
+
+import PropTypes from 'prop-types';
+
+import classNames from 'classnames'
+
+import axios from 'axios'
+
+class UserSection extends Component {
+ constructor(props) {
+ super(props)
+
+ this.state = {
+
+ }
+ }
+ /*点击关注或者取消关注*/
+ AboutFocus(){
+ const { author_info } = this.props
+ /*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/
+
+ // const focusUrl = `/api/v1/users/${author_info.user_id}/${this.props.author_info.watched ? 'unwatch' : 'watch'}?object_id=${author_info.user_id}&object_type=user`
+
+ // axios.get(focusUrl,{
+ // })
+ // .then((response) => {
+ // const status = response.data.status;
+ // console.log(status);
+ // if(status == 1){
+ // const new_author_info = Object.assign({}, this.props.author_info)
+ // new_author_info.watched = !new_author_info.watched
+ // this.props.initForumState({author_info: new_author_info})
+ // }
+ // }).catch((error) => {
+ // console.log(error)
+ // })
+
+ let url=`/users/${author_info.user_id}/watch.json`;
+ // 取消关注
+ if(author_info.watched){
+ axios.delete(url).then((result)=>{
+ if(result){
+ const new_author_info = Object.assign({}, this.props.author_info)
+ new_author_info.watched = !new_author_info.watched
+ this.props.initForumState({author_info: new_author_info})
+ }
+ }).catch((error)=>{
+ console.log(error)
+ })
+ }else{
+ // 关注
+ axios.post(url).then((result)=>{
+ if(result){
+ const new_author_info = Object.assign({}, this.props.author_info)
+ new_author_info.watched = !new_author_info.watched
+ this.props.initForumState({author_info: new_author_info})
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }
+ }
+
+
+ render() {
+ const { match, history, author_info , current_user } = this.props
+ if (!author_info || !current_user) {
+ return
+ }
+ return (
+
+ );
+ }
+}
+
+export default UserSection;
diff --git a/public/react/src/modules/forums/shixun/MemoShixun.css b/public/react/src/modules/forums/shixun/MemoShixun.css
index c76000ccf..c1421e02f 100644
--- a/public/react/src/modules/forums/shixun/MemoShixun.css
+++ b/public/react/src/modules/forums/shixun/MemoShixun.css
@@ -11,7 +11,7 @@
height:48px;
width: 48px;
float: left;
- margin-top: 7px;
+ margin-top: 4px;
}
.shixunReply{
max-width: 604px;
diff --git a/public/react/src/modules/forums/shixun/MemoShixun.js b/public/react/src/modules/forums/shixun/MemoShixun.js
index 9d75da00d..664b844ac 100644
--- a/public/react/src/modules/forums/shixun/MemoShixun.js
+++ b/public/react/src/modules/forums/shixun/MemoShixun.js
@@ -83,7 +83,7 @@ class MemoShixun extends Component {
}
const stringifid = queryString.stringify(paramsObject);
- const url = `/api/v1/discusses?${stringifid}` // /${challenge.identifier}/star
+ const url = `/discusses/forum_discusses.json?${stringifid}` // /${challenge.identifier}/star
// 获取memo list
this.setState({
@@ -91,13 +91,13 @@ class MemoShixun extends Component {
loadingMemos: true
})
axios.get(url,{
- withCredentials: true,
+ // withCredentials: true,
})
.then((response) => {
if (response.data) {
- const user = response.data.current_user;
- user.tidding_count = response.data.tidding_count;
- this.props.initCommonState(user)
+ // const user = response.data.current_user;
+ // user.tidding_count = response.data.tidding_count;
+ // this.props.initCommonState(user)
this.props.initForumState(response.data)
// const { hot_tags } = response.data;
diff --git a/public/react/src/modules/forums/shixun/ShiXunPostItem.js b/public/react/src/modules/forums/shixun/ShiXunPostItem.js
index 1f8c0d379..961e16ff1 100644
--- a/public/react/src/modules/forums/shixun/ShiXunPostItem.js
+++ b/public/react/src/modules/forums/shixun/ShiXunPostItem.js
@@ -39,7 +39,7 @@ class ShiXunPostItem extends Component
width="48px" height="48px" className="radius"/>