Merge remote-tracking branch 'origin/dev_Ysl' into dev_Ysl

dev_cs_new
杨树林 6 years ago
commit c8504513ff

@ -24,8 +24,9 @@ class MessagChat extends Component{
componentDidMount(){ componentDidMount(){
this.getdata(1); this.getdata(1);
this.getChatList(1)
// console.log("MessagChat111111"); // console.log("MessagChat111111");
// console.log(this.props); console.log(this.props.myysluser);
this.setState({ this.setState({
myyslusers:this.props.myysluser myyslusers:this.props.myysluser
}) })
@ -47,13 +48,49 @@ class MessagChat extends Component{
} }
}; };
//获取数据地方
getdata=(page)=>{ getChatList=(page)=>{
this.setState({ this.setState({
isSpins:true, 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{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`; // let url = `/users/71519/private_messages.json`;
axios.get((url),{params:{ axios.get((url),{params:{
page:page, page:page,
@ -103,21 +140,21 @@ class MessagChat extends Component{
// 点击了用户 // 点击了用户
Clickedontheuser=(user)=>{ Clickedontheuser=(user)=>{
debugger // debugger
// console.log("点击了用户"); // console.log("点击了用户");
// console.log(user); // console.log(user);
this.setState({ // this.setState({
myyslusers:user, // myyslusers:user,
mess:true, // mess:true,
}) // })
this.props.history.replace(`/message/${user}/user_tidings`); this.props.history.replace(`/message/${user.id}/message_detail`);
} }
setreplyfun=()=>{ setreplyfun=()=>{
let contents=this.messageRef.current.getValue().trim(); let contents=this.messageRef.current.getValue().trim();
let target_ids=this.props.match.params.userid; 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, { axios.post(url, {
target_id: target_ids, target_id: target_ids,
content: contents content: contents

Loading…
Cancel
Save