diff --git a/public/react/src/modules/forums/ForumsIndex.js b/public/react/src/modules/forums/ForumsIndex.js index 2e5693fa0..c24b92c95 100644 --- a/public/react/src/modules/forums/ForumsIndex.js +++ b/public/react/src/modules/forums/ForumsIndex.js @@ -42,6 +42,7 @@ import './ForumsIndex.css' import './RightSection.css' import { SnackbarHOC, getUrl } from 'educoder' +import { CNotificationHOC } from '../courses/common/CNotificationHOC' let _url_origin = getUrl() @@ -248,7 +249,7 @@ class ForumsIndex extends Component { } } -export default SnackbarHOC() ( TPMIndexHOC ( ForumsIndex ) ); +export default CNotificationHOC() (SnackbarHOC() ( TPMIndexHOC ( ForumsIndex ) )); /* : diff --git a/public/react/src/modules/forums/MemoDetail.js b/public/react/src/modules/forums/MemoDetail.js index 60c26b09d..0a0f4f4ac 100644 --- a/public/react/src/modules/forums/MemoDetail.js +++ b/public/react/src/modules/forums/MemoDetail.js @@ -65,7 +65,7 @@ class MemoDetail extends Component { const memo = response.data.memo if (response.data.status === -1) { setTimeout(() => { - this.props.showSnackbar('帖子不存在!') + this.props.showNotification('帖子不存在!') }, 300) this.props.history.push(`/forums`) return; @@ -127,11 +127,11 @@ class MemoDetail extends Component { const status = response.data.status if (status === 0) { - this.props.showSnackbar('删除成功'); + this.props.showNotification('删除成功'); this.props.history.push(`/forums`) } else if (status === -1) { - this.props.showSnackbar('帖子已被删除'); + this.props.showNotification('帖子已被删除'); this.props.history.push(`/forums`) } }).catch((error) => { @@ -213,9 +213,9 @@ class MemoDetail extends Component { } } replyComment = (commentContent, id, editor) => { - const { showSnackbar } = this.props; + const { showNotification } = this.props; if (!commentContent || commentContent.length === 0) { - showSnackbar('必须填写内容!') + showNotification('必须填写内容!') return; } @@ -375,7 +375,7 @@ class MemoDetail extends Component { }) } rewardCode = (parrentComment, childComment, amount) => { - const { showSnackbar } = this.props; + const { showNotification } = this.props; const { comments } = this.state; let handleComment = parrentComment if (childComment) { @@ -419,12 +419,12 @@ class MemoDetail extends Component { } }).catch((error) => { console.log(error) - showSnackbar('奖励失败,请联系系统管理员!') + showNotification('奖励失败,请联系系统管理员!') }) } hiddenComment = (item, childCommentId) => { const id = item.id - const { showSnackbar } = this.props; + const { showNotification } = this.props; const user = this._getUser(); const url = `/memos/${id}/hidden.json` const { comments } = this.state; @@ -439,7 +439,7 @@ class MemoDetail extends Component { } ).then((response) => { if (response.data.status === -1) { - showSnackbar(response.data.message) + showNotification(response.data.message) return; } if (response.data.status === 0) { @@ -598,7 +598,7 @@ class MemoDetail extends Component { .then((response) => { const status = response.data.status if (status === 0) { - this.props.showSnackbar( memo.sticky ? '取消置顶成功' : '置顶成功'); + this.props.showNotification( memo.sticky ? '取消置顶成功' : '置顶成功'); memo.sticky = memo.sticky ? false : true this.setState({ memo: Object.assign({}, memo) @@ -633,9 +633,9 @@ class MemoDetail extends Component { this.props.initForumState({ memo: newMemo }) - this.props.showSnackbar( '奖励成功' ); + this.props.showNotification( '奖励成功' ); } else { - this.props.showSnackbar( '奖励失败,请联系系统管理员!' ); + this.props.showNotification( '奖励失败,请联系系统管理员!' ); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/forums/MemoNew.js b/public/react/src/modules/forums/MemoNew.js index 3eb83dc06..e6482b8b6 100644 --- a/public/react/src/modules/forums/MemoNew.js +++ b/public/react/src/modules/forums/MemoNew.js @@ -176,9 +176,9 @@ class MemoNew extends Component { } onCommit() { const { memoSubject, memoRepertoire, memoLanguage, currentMemoId, memoType } = this.state; - const { showSnackbar } = this.props; + const { showNotification } = this.props; if (!memoSubject) { - showSnackbar('请先输入话题名称') + showNotification('请先输入话题名称') return } let mdVal; @@ -186,17 +186,17 @@ class MemoNew extends Component { mdVal = this.mdRef.current.getValue() } catch (e) { - showSnackbar('编辑器还未加载完毕,请稍后') + showNotification('编辑器还未加载完毕,请稍后') return } if (!mdVal) { - showSnackbar('请先输入话题内容') + showNotification('请先输入话题内容') return } // !memoRepertoire || if (memoType === 5 && ( !memoLanguage || memoLanguage.length === 0 )) { - showSnackbar('请先选择技术标签') + showNotification('请先选择技术标签') return } /* @@ -267,7 +267,7 @@ class MemoNew extends Component { window.$("html,body").animate({"scrollTop":0}) this.props.history.push(`/forums/${currentMemoId}`) } else { - this.props.showSnackbar(message) + this.props.showNotification(message) } }).catch((error) => { console.log(error) @@ -297,7 +297,7 @@ class MemoNew extends Component { window.$("html,body").animate({"scrollTop":0}) this.props.history.push(`/forums/${memo_id}`) } else { - this.props.showSnackbar(message) + this.props.showNotification(message) } }).catch((error) => { console.log(error) @@ -481,7 +481,7 @@ class MemoNew extends Component { onTagChange(value) { if (value && value.length > 3) { - this.props.showSnackbar(`最多选择3个技术标签`) + this.props.showNotification(`最多选择3个技术标签`) return; } diff --git a/public/react/src/modules/forums/PostPaginationHOC.js b/public/react/src/modules/forums/PostPaginationHOC.js index 99370051a..243cffeab 100644 --- a/public/react/src/modules/forums/PostPaginationHOC.js +++ b/public/react/src/modules/forums/PostPaginationHOC.js @@ -276,7 +276,7 @@ return function wrap(WrappedComponent) { const status = response.data.status if (status === 0) { - this.props.showSnackbar('删除成功'); + this.props.showNotification('删除成功'); // 刷新列表 this.fetchMemos(); }