统一 noti

dev_admin
hjm 6 years ago
parent 85842e5226
commit 2fb774e243

@ -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 ) ));
/*
:

@ -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)

@ -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;
}

@ -276,7 +276,7 @@ return function wrap(WrappedComponent) {
const status = response.data.status
if (status === 0) {
this.props.showSnackbar('删除成功');
this.props.showNotification('删除成功');
// 刷新列表
this.fetchMemos();
}

Loading…
Cancel
Save