# Conflicts:
#	public/react/src/modules/message/js/MessagePrivate.js
dev_cs_new
杨树林 6 years ago
parent 04eb6cdb65
commit 33d8013b07

@ -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 (
<div className="edu-back-white ml20">
{/*私信对话框*/}
@ -115,7 +126,7 @@ class MessagChat extends Component{
<p className="clearfix pt30 pb30 edu-txt-center font-16 bor-bottom-greyE">
<a onClick={()=>this.smyJump(2)}><i className="iconfont icon-zuojiantou font-14 fl ml25 color-grey-9"
data-tip-down="返回到列表"></i></a>
{mess===false?(myysluser!==undefined?myysluser.name:""):(myysluser!==undefined?myysluser.name:"")}与你的私信
{myyslusers!==undefined?myyslusers.name:""}与你的私信
</p>
{/*聊天页面*/}
<div className="dialogPanel">
@ -181,7 +192,7 @@ class MessagChat extends Component{
""
:datay.map((item,key)=>{
return(
<div className="private-part clearfix" key={key} onClick={(item)=>this.Clickedontheuser(item.target)}>
<div className="private-part clearfix" key={key} onClick={(i)=>this.Clickedontheuser(item.target)}>
<div className="part-line df">
<img src={item.target.image_url} className="radius mr10 myimgw48 myimgh48"/>
<div className="flex1">

@ -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(
<div className="private-item clearfix df" key={key} onClick={(i)=>this.smyJump(3,item.target)}>
<a className="fl mr10 private_message_a">
<img src={item.target.image_url} className="radius myimgw48 myimgh48"/>
<a className="fl mr10 private_message_a" onMouseDown={()=>this.myCome(item)}>
<img onMouseDown={()=>this.myCome(item)} src={item.target.image_url} className="radius myimgw48 myimgh48"/>
</a>
<div className="fl flex1">
<p>
<a onClick={()=>this.myCome(item)} className="mr20 private_message_a">{item.target.name}</a>
<a onMouseDown={()=>this.myCome(item)} className="mr20 private_message_a">{item.target.name}</a>
<span>与你的私信</span>
<span className="color-grey-c mr20">[{item.message_count}{"条"}]</span>
<span className="color-grey-c">{moment(item.send_time).fromNow()}</span>

@ -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 (
<div className="newMain clearfix">
<div className="educontent mt20 mb80 clearfix">
@ -97,7 +132,7 @@ class Messagerouting extends Component{
<div className="leftPanel">
{/*头像*/}
<div className="mb20 edu-back-white pt40 pb40 edu-txt-center">
<a href="javascript:void(0);">
<a >
<img className="person radius myw120 myh120" src={this.props.current_user&&this.props.current_user.image_url}/>
</a>
<p className="font-24 lineh-25 mt10" >{this.props.current_user&&this.props.current_user.username}</p>
@ -119,14 +154,37 @@ class Messagerouting extends Component{
{/*右边*/}
<div className="rightPanel">
<div className="clearfix">
{/*消息自路由*/}
{routing===1?<MessagSub {...this.state} {...this.props} Message2={()=>this.Message2()}></MessagSub> :""}
{/*/!*消息自路由*!/*/}
{/*{routing===1?<MessagSub {...this.state} {...this.props} Message2={()=>this.Message2()}></MessagSub> :""}*/}
{/*/!*私信*!/*/}
{/*{routing===2?<MessagePrivate {...this.state} {...this.props} Message2={()=>this.Message2()} Modifyur={(i,item)=>this.Modifyur(i,item)}></MessagePrivate> :""}*/}
{/*/!*私信聊天页面*!/*/}
{/*{routing===3?<MessagChat {...this.state} {...this.props} Message2={()=>this.Message2()} Modifyur={(i)=>this.Modifyur(i)}></MessagChat>:""}*/}
<Switch>
{/*/!*消息自路由*!/*/}
<Route path="/message/info/:userid"
render={
(props) => (<MessagSub {...this.state} {...this.props} Message2={()=>this.Message2()}></MessagSub>)
}
></Route>
{/*/!*私信*!/*/}
<Route path="/message/letter/:userid"
render={
(props) => (<MessagePrivate {...this.state} {...this.props} Message2={()=>this.Message2()} Modifyur={(i,item)=>this.Modifyur(i,item)}></MessagePrivate> )
}
></Route>
{/*/!*私信聊天页面*!/*/}
<Route path="/message/letters/:userid"
render={
(props) => (<MessagChat {...this.state} {...this.props} Message2={()=>this.Message2()} Modifyur={(i)=>this.Modifyur(i)}></MessagChat>)
}
></Route>
{/*私信*/}
{routing===2?<MessagePrivate {...this.state} {...this.props} Message2={()=>this.Message2()} Modifyur={(i)=>this.Modifyur(i)}></MessagePrivate> :""}
</Switch>
{/*私信聊天页面*/}
{routing===3?<MessagChat {...this.state} {...this.props} Message2={()=>this.Message2()} Modifyur={(i)=>this.Modifyur(i)}></MessagChat>:""}
</div>
</div>
</div>

@ -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(
<Modal
keyboard={false}

Loading…
Cancel
Save