dev_cs_new
杨树林 6 years ago
parent 040e2843a2
commit 18463d1bbd

@ -300,6 +300,9 @@ class MessagChat extends Component{
} }
//回复 //回复
setreplyfun=()=>{ setreplyfun=()=>{
this.setState({
isSpin:true,
});
let contents=this.messageRef.current.getValue().trim(); let contents=this.messageRef.current.getValue().trim();
let target_ids=this.props.match.params.private let target_ids=this.props.match.params.private
let url = `/users/${this.props.match.params.userid}/private_messages.json`; let url = `/users/${this.props.match.params.userid}/private_messages.json`;
@ -308,6 +311,9 @@ class MessagChat extends Component{
content: contents content: contents
}) })
.then((response) => { .then((response) => {
this.setState({
isSpin:false,
});
if(response===undefined){ if(response===undefined){
return return
} }
@ -317,31 +323,50 @@ class MessagChat extends Component{
var datas=[]; var datas=[];
var dataso=this.state.messages; var dataso=this.state.messages;
var datays=response.data.private_message; var datays=response.data.private_message;
var obj={}; // var obj={};
for (var i=0;i<dataso.length;i++){ // for (var i=0;i<dataso.length;i++){
if(i===0){ // if(i===0){
obj=dataso[i]; // obj=dataso[i];
datas.push(dataso[i]); // datas.push(dataso[i]);
}else{ // }else{
if( moment(obj.send_day).isSame(dataso[i].send_day)){ // if( moment(obj.send_day).isSame(dataso[i].send_day)){
dataso[i].send_day=""; // dataso[i].send_day="";
// }else {
// obj=dataso[i];
// }
// datas.push(dataso[i]);
// }
// }
try {
var time =dataso[dataso.length-1].send_time.slice(0,10);
console.log(time);
var timetwo=datays.send_time.slice(0,10);
console.log(timetwo);
if( moment(time).isSame(timetwo)){
datays.send_day="";
dataso.push(datays);
}else { }else {
obj=dataso[i]; datays.send_day=timetwo;
} dataso.push(datays);
datas.push(dataso[i]);
} }
}catch (e) {
console.log("回去出现错误");
console.log(e);
} }
datas.push(datays);
//颠倒数组 //颠倒数组
this.setState({ this.setState({
messages: datas, messages: dataso,
}) });
this.messageRef.current.setValue('') this.messageRef.current.setValue('')
} }
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
this.setState({
isSpin:false,
});
}); });
}; };
//删除 //删除

@ -98,10 +98,10 @@ class MessagePrivate extends Component{
}) })
}; };
// 跳转页面 // 跳转页面
smyJump =(i,item)=>{ smyJump =(i,id)=>{
// console.log("跳转页面"); // console.log("跳转页面");
// console.log(i); // console.log(i);
this.props.Modifyur(i,item); this.props.Modifyur(i,id);
}; };
myCome=(e)=>{ myCome=(e)=>{
window.location.href="/users/"+e.target.login; window.location.href="/users/"+e.target.login;

@ -32,7 +32,6 @@ class Messagerouting extends Component{
routing:1, routing:1,
unread_message_count:0, unread_message_count:0,
unread_tiding_count:0, unread_tiding_count:0,
myysluser:undefined,
} }
} }
@ -100,7 +99,7 @@ class Messagerouting extends Component{
}; };
//跳转到链接 //跳转到链接
Modifyur=(i,item)=>{ Modifyur=(i,id)=>{
// console.log("跳转到链接1"); // console.log("跳转到链接1");
// console.log(i); // console.log(i);
// console.log(item); // console.log(item);
@ -119,10 +118,9 @@ class Messagerouting extends Component{
}else { }else {
this.setState({ this.setState({
routing:i, routing:i,
myysluser:item,
}); });
console.log("22222222222"); console.log("22222222222");
this.props.history.replace(`/message/${this.props.current_user.user_id}/${item.id}/message_detail`); this.props.history.replace(`/message/${this.props.current_user.user_id}/${id}/message_detail`);
} }
}; };

@ -70,7 +70,7 @@ class WriteaprivateletterModal extends Component {
floatingboxdisplays:false, floatingboxdisplays:false,
Pleaseselectthesender:false, Pleaseselectthesender:false,
}); });
this.props.smyJump(3,this.state.users); this.props.smyJump(3,result.data.private_message.receiver_id);
//console.log(result); //console.log(result);
}).catch((error) => { }).catch((error) => {
//console.log(error) //console.log(error)

Loading…
Cancel
Save