|
|
|
@ -24,8 +24,9 @@ class MessagChat extends Component{
|
|
|
|
|
|
|
|
|
|
componentDidMount(){
|
|
|
|
|
this.getdata(1);
|
|
|
|
|
this.getChatList(1)
|
|
|
|
|
// console.log("MessagChat111111");
|
|
|
|
|
// console.log(this.props);
|
|
|
|
|
console.log(this.props.myysluser);
|
|
|
|
|
this.setState({
|
|
|
|
|
myyslusers:this.props.myysluser
|
|
|
|
|
})
|
|
|
|
@ -42,13 +43,49 @@ class MessagChat extends Component{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
//获取数据地方
|
|
|
|
|
getdata=(page)=>{
|
|
|
|
|
|
|
|
|
|
getChatList=(page)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
isSpins:true,
|
|
|
|
|
});
|
|
|
|
|
let target_ids=this.props.match.params.userid;
|
|
|
|
|
let url = `/users/${this.props.current_user&&this.props.current_user.user_id}/private_message_details.json`;
|
|
|
|
|
|
|
|
|
|
axios.get((url),{params:{
|
|
|
|
|
target_id:target_ids,
|
|
|
|
|
page: page,
|
|
|
|
|
per_page:20,
|
|
|
|
|
}}).then((result) => {
|
|
|
|
|
if (result) {
|
|
|
|
|
|
|
|
|
|
if(result.data.message!==undefined){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(result.data!==null){
|
|
|
|
|
console.log(result)
|
|
|
|
|
this.setState({
|
|
|
|
|
private_messages:result.data.private_messages
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
isSpins:false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error);
|
|
|
|
|
this.setState({
|
|
|
|
|
isSpins:false,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//获取数据地方
|
|
|
|
|
getdata=(page)=>{
|
|
|
|
|
|
|
|
|
|
let{limit}=this.state;
|
|
|
|
|
let url = `/users/${this.props.current_user.user_id}/private_messages.json`;
|
|
|
|
|
let url = `/users/${this.props.current_user&&this.props.current_user.user_id}/private_messages.json`;
|
|
|
|
|
// let url = `/users/71519/private_messages.json`;
|
|
|
|
|
axios.get((url),{params:{
|
|
|
|
|
page:page,
|
|
|
|
@ -98,21 +135,21 @@ class MessagChat extends Component{
|
|
|
|
|
|
|
|
|
|
// 点击了用户
|
|
|
|
|
Clickedontheuser=(user)=>{
|
|
|
|
|
debugger
|
|
|
|
|
// debugger
|
|
|
|
|
// console.log("点击了用户");
|
|
|
|
|
// console.log(user);
|
|
|
|
|
this.setState({
|
|
|
|
|
myyslusers:user,
|
|
|
|
|
mess:true,
|
|
|
|
|
})
|
|
|
|
|
this.props.history.replace(`/message/${user}/user_tidings`);
|
|
|
|
|
// this.setState({
|
|
|
|
|
// myyslusers:user,
|
|
|
|
|
// mess:true,
|
|
|
|
|
// })
|
|
|
|
|
this.props.history.replace(`/message/${user.id}/message_detail`);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setreplyfun=()=>{
|
|
|
|
|
let contents=this.messageRef.current.getValue().trim();
|
|
|
|
|
let target_ids=this.props.match.params.userid;
|
|
|
|
|
let url = `/users/${this.props.current_user.user_id}/private_messages.json`;
|
|
|
|
|
let url = `/users/${this.props.current_user&&this.props.current_user.user_id}/private_messages.json`;
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
target_id: target_ids,
|
|
|
|
|
content: contents
|
|
|
|
|