评论发布后页面刷新显示信息错误

forge
caicai8 5 years ago
parent 31e2866e5d
commit 5d4c909020

@ -329,7 +329,7 @@ class ApplicationController < ActionController::Base
def current_user
# User.current
if Rails.env.development?
user_id = 36390
user_id = 50207
else
user_id = 130328
end

@ -47,8 +47,8 @@ export function initAxiosInterceptors(props) {
// TODO 读取到package.json中的配置
var //proxy = "http://localhost:3000"
proxy="http://123.59.135.93:56666"
//proxy="http://localhost:3000"
// proxy="http://123.59.135.93:56666"
proxy="http://localhost:3000"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
// 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制

@ -215,6 +215,7 @@ class Detail extends Component{
}
renderJournalList=(list)=>{
console.log(list);
if(list && list.length >0){
return(
list.map((item,key)=>{
@ -315,7 +316,7 @@ class Detail extends Component{
</p>
<div className="detail_right" style={{display: current_user && (current_user.admin || current_user.login === item.user_login) ? "block" : "none"}}>
<span onClick={()=>this.editdetail(item.content,item.id)} className="detail_edit_action">编辑</span>
<Popconfirm placement="bottom" title={'确定要删除当前评论吗'} okText="是" cancelText="否" onConfirm={()=>this.deleteorder(item.id)}>
<Popconfirm placement="bottom" title={'确定要删除当前评论吗?'} okText="是" cancelText="否" onConfirm={()=>this.deleteorder(item.id)}>
<span className="detail_edit_action">删除</span>
</Popconfirm>
</div>
@ -331,7 +332,7 @@ class Detail extends Component{
</div>
}
{
item && item.attachments.length > 0 ?
item && item.attachments && item.attachments.length > 0 ?
<Attachments attachments={item.attachments} showNotification={this.props.showNotification} canDelete={current_user && (current_user.admin || current_user.login === item.user_login)}/>
:
""
@ -408,7 +409,7 @@ class Detail extends Component{
{ data && data.description }
</div>
{
data && data.attachments.length > 0 ?
data && data.attachments && data.attachments.length > 0 ?
<Attachments attachments={data.attachments} showNotification={this.props.showNotification}/>
:
""

@ -6,7 +6,6 @@ class Attachment extends Component{
constructor(props){
super(props);
this.state={
attachments:undefined,
canDelete: false,
Deleted:[]
}
@ -18,7 +17,6 @@ class Attachment extends Component{
getDetail=()=>{
this.setState({
attachments: this.props.attachments,
canDelete: this.props.canDelete
})
}
@ -43,7 +41,8 @@ class Attachment extends Component{
}
render(){
const { Deleted, attachments, canDelete } = this.state;
const { Deleted , canDelete } = this.state;
const { attachments }= this.props
return(
<div>
{

Loading…
Cancel
Save