dev_cs_new
杨树明 6 years ago
parent c245781db7
commit 65dce68b92

@ -11,7 +11,7 @@ import Leftdialogue from './Leftdialogue'
class MessagChat extends Component{
constructor(props) {
super(props);
this.messageRef = React.createRef();
this.state={
isSpin:false,
isSpins:false,
@ -53,8 +53,12 @@ class MessagChat extends Component{
}
scrollToBottom() {
this.el.scrollIntoView({ behavior: 'smooth' });
const scrollHeight = this.messageList.scrollHeight;
const height = this.messageList.clientHeight;
const maxScrollTop = scrollHeight - height;
this.messageList.scrollTop = maxScrollTop > 0 ? maxScrollTop : 0;
}
// 滑动刷新
contentViewScrolledit=(e)=>{
@ -351,6 +355,8 @@ class MessagChat extends Component{
messages:this.state.messages,
isSpin:false,
})
this.scrollToBottom()
}
}
}
@ -391,10 +397,13 @@ class MessagChat extends Component{
{myuserl!==undefined?myuserl.name:""}与你的私信
</p>
{/*聊天页面*/}
<div className="dialogPanel">
<div className="dialogPanel"
ref={(div) => {
this.messageList = div;
}}>
<div >
<Spin size="large" className="myw100baifenbi" spinning={isSpin}>
<div id="yslysl" ref={el => { this.el = el; }}>
<div id="yslysl" >
{
messages===undefined?
""
@ -477,12 +486,12 @@ class MessagChat extends Component{
<img src={getImageUrl("/images/"+item.target.image_url)} className="radius mr10 myimgw48 myimgh48"/>
<div className="flex1">
<p className="clearfix mb15 lineh-17">
<span className="fl pr">
<span className="task-hide privatePartName">{item.target.name}</span>
{item.unread === true?
<span className="newLetter"></span>
:""}
</span>
<span className="fl pr">
<span className="task-hide privatePartName">{item.target.name}</span>
{item.unread === true?
<span className="newLetter"></span>
:""}
</span>
<span className="color-grey-c fr">{moment(item.send_time).fromNow()}</span>
</p>
<p className="color-grey-6 lineh-20 justify break_word task-hide-2" style={{wordBreak:"break-word"}} dangerouslySetInnerHTML={{__html:item.content}}></p>

Loading…
Cancel
Save