From 33d8013b07b172dbf0693d628fa933539fd5903e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 1 Aug 2019 00:02:24 +0800 Subject: [PATCH] Merge branch 'dev_Ysl' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysl # Conflicts: # public/react/src/modules/message/js/MessagePrivate.js --- .../src/modules/message/js/MessagChat.js | 31 +++++-- .../src/modules/message/js/MessagePrivate.js | 8 +- .../src/modules/message/js/Messagerouting.js | 92 +++++++++++++++---- .../messagemodal/WriteaprivateletterModal.js | 5 +- 4 files changed, 103 insertions(+), 33 deletions(-) diff --git a/public/react/src/modules/message/js/MessagChat.js b/public/react/src/modules/message/js/MessagChat.js index 018546cc8..82d2ba2d7 100644 --- a/public/react/src/modules/message/js/MessagChat.js +++ b/public/react/src/modules/message/js/MessagChat.js @@ -18,13 +18,18 @@ class MessagChat extends Component{ page:1, datay:[], mess:false, + } } componentDidMount(){ this.getdata(1); - console.log("MessagChat"); - console.log(this.props); + console.log("MessagChat111111"); + console.log(this.props); + console.log(this.state); + this.setState({ + myyslusers:this.props.myysluser + }) } // 滑动刷新 contentViewScrolledit=(e)=>{ @@ -73,7 +78,7 @@ class MessagChat extends Component{ this.setState({ page:page, isSpins:false, - datay, + datay:this.state.datay, data:result.data.private_messages===null?undefined:result.data.private_messages===undefined?undefined:result.data.private_messages===[]?undefined:result.data.private_messages==="[]"?undefined:result.data.private_messages.length===0?undefined:result.data.private_messages, }); // console.log(this.state.datay); @@ -87,15 +92,17 @@ class MessagChat extends Component{ }; // 跳转页面 smyJump =(i)=>{ - console.log("跳转页面"); - console.log(i); + // console.log("跳转页面"); + // console.log(i); this.props.Modifyur(i); }; // 点击了用户 Clickedontheuser=(user)=>{ + console.log("点击了用户"); + console.log(user); this.setState({ - myysluser:user, + myyslusers:user, mess:true, }) } @@ -104,8 +111,12 @@ class MessagChat extends Component{ console.log(this.messageRef.current.getValue().trim()) } render() { - let{isSpins,datay,myysluser,mess}=this.state; - // + let{isSpins,datay,myyslusers,mess}=this.state; + // console.log(mess); + // console.log(myyslusers); + // console.log("MessagChat"); + // console.log(this.state); + // console.log("112"); return (
{/*私信对话框*/} @@ -115,7 +126,7 @@ class MessagChat extends Component{

this.smyJump(2)}> - {mess===false?(myysluser!==undefined?myysluser.name:""):(myysluser!==undefined?myysluser.name:"")}与你的私信 + {myyslusers!==undefined?myyslusers.name:""}与你的私信

{/*聊天页面*/}
@@ -181,7 +192,7 @@ class MessagChat extends Component{ "" :datay.map((item,key)=>{ return( -
this.Clickedontheuser(item.target)}> +
this.Clickedontheuser(item.target)}>
diff --git a/public/react/src/modules/message/js/MessagePrivate.js b/public/react/src/modules/message/js/MessagePrivate.js index ffd6a72f5..1e21b2d76 100644 --- a/public/react/src/modules/message/js/MessagePrivate.js +++ b/public/react/src/modules/message/js/MessagePrivate.js @@ -87,7 +87,7 @@ class MessagePrivate extends Component{ this.props.Modifyur(i,item); }; myCome=(e)=>{ - window.location.href="/users/innov"; + window.location.href="/users/"+e.target.login; } render() { let{page,limit,typeysl,count,isSpin,data,modalsType}=this.state; @@ -117,12 +117,12 @@ class MessagePrivate extends Component{ return(
this.smyJump(3,item.target)}> - - + this.myCome(item)}> + this.myCome(item)} src={item.target.image_url} className="radius myimgw48 myimgh48"/>

- this.myCome(item)} className="mr20 private_message_a">{item.target.name} + this.myCome(item)} className="mr20 private_message_a">{item.target.name} 与你的私信 [{item.message_count}{"条"}] {moment(item.send_time).fromNow()} diff --git a/public/react/src/modules/message/js/Messagerouting.js b/public/react/src/modules/message/js/Messagerouting.js index 3bad873b0..70f04589a 100644 --- a/public/react/src/modules/message/js/Messagerouting.js +++ b/public/react/src/modules/message/js/Messagerouting.js @@ -1,16 +1,30 @@ import React, { Component } from 'react'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; import {Input,Pagination,Tooltip} from 'antd'; import {TPMIndexHOC} from "../../../modules/tpm/TPMIndexHOC"; -import {Link,NavLink} from 'react-router-dom'; import { WordsBtn ,ActionBtn,SnackbarHOC,markdownToHTML,getImageUrl} from 'educoder'; import axios from 'axios'; -import MessagSub from "./MessagSub"; -import MessagePrivate from "./MessagePrivate"; -import MessagChat from "./MessagChat"; import "../css/messagemy.css" +import { Redirect } from 'react-router'; +import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; +import Loading from '../../../Loading' +import Loadable from 'react-loadable'; + // MessagSub 消息自路由 // MessagePrivate 私信 +const MessagSub = Loadable({ + loader: () => import('./MessagSub'), + loading: Loading, +}) + +const MessagePrivate = Loadable({ + loader: () => import('./MessagePrivate'), + loading: Loading, +}) + +const MessagChat = Loadable({ + loader: () => import('./MessagChat'), + loading: Loading, +}) class Messagerouting extends Component{ constructor(props) { super(props); @@ -23,7 +37,8 @@ class Messagerouting extends Component{ } componentDidMount(){ - + console.log("Messagerouting"); + console.log(this.props); } componentDidUpdate(prevProps) { // console.log("11111111111"); @@ -58,6 +73,14 @@ class Messagerouting extends Component{ routing:value, }); this.Messageprivatemessageunreadmessage(this.props.current_user.user_id); + if(value===1){ + this.props.history.replace(`/message/info/${this.props.current_user.user_id}`); + return + } + if(value===2){ + this.props.history.replace(`/message/letter/${this.props.current_user.user_id}`); + return; + } }; @@ -73,23 +96,35 @@ class Messagerouting extends Component{ //跳转到链接 Modifyur=(i,item)=>{ - console.log("跳转到链接"); + console.log("跳转到链接1"); console.log(i); + console.log(item); + console.log("跳转到链接2"); if(i<3){ this.setState({ routing:i, - }) + }); + if(i===1){ + this.props.history.replace(`/message/info/${this.props.current_user.user_id}`); + } + if(i===2){ + this.props.history.replace(`/message/letter/${this.props.current_user.user_id}`); + } + }else { this.setState({ routing:i, myysluser:item, - }) + }); + console.log("22222222222"); + this.props.history.replace(`/message/letters/${this.props.current_user.user_id}`); } - } + }; render() { let{routing,unread_message_count,unread_tiding_count} =this.state; console.log(this.props); + console.log(routing); return (

@@ -97,7 +132,7 @@ class Messagerouting extends Component{
{/*头像*/}
- +

{this.props.current_user&&this.props.current_user.username}

@@ -119,14 +154,37 @@ class Messagerouting extends Component{ {/*右边*/}
- {/*消息自路由*/} - {routing===1?this.Message2()}> :""} + {/*/!*消息自路由*!/*/} + {/*{routing===1?this.Message2()}> :""}*/} + + {/*/!*私信*!/*/} + {/*{routing===2?this.Message2()} Modifyur={(i,item)=>this.Modifyur(i,item)}> :""}*/} + + {/*/!*私信聊天页面*!/*/} + {/*{routing===3?this.Message2()} Modifyur={(i)=>this.Modifyur(i)}>:""}*/} + + + {/*/!*消息自路由*!/*/} + (this.Message2()}>) + } + > + {/*/!*私信*!/*/} + (this.Message2()} Modifyur={(i,item)=>this.Modifyur(i,item)}> ) + } + > + {/*/!*私信聊天页面*!/*/} + (this.Message2()} Modifyur={(i)=>this.Modifyur(i)}>) + } + > - {/*私信*/} - {routing===2?this.Message2()} Modifyur={(i)=>this.Modifyur(i)}> :""} + - {/*私信聊天页面*/} - {routing===3?this.Message2()} Modifyur={(i)=>this.Modifyur(i)}>:""}
diff --git a/public/react/src/modules/message/messagemodal/WriteaprivateletterModal.js b/public/react/src/modules/message/messagemodal/WriteaprivateletterModal.js index 3e349ef2c..a22c9c2b3 100644 --- a/public/react/src/modules/message/messagemodal/WriteaprivateletterModal.js +++ b/public/react/src/modules/message/messagemodal/WriteaprivateletterModal.js @@ -43,7 +43,7 @@ class WriteaprivateletterModal extends Component { this.setState({ users:result.data.users, Recentcontacts:false, - floatingboxdisplay:true, + floatingboxdisplay:false, isSpin:false }) }).catch((error) => { @@ -248,8 +248,9 @@ class WriteaprivateletterModal extends Component { render() { - // console.log(this.props) + let{Pleaseselectthesender,inputvulue,inputvulues,floatingboxdisplay,users,floatingboxdisplays,Recentcontacts,isSpin}=this.state; + console.log(floatingboxdisplay); return(