|
|
|
@ -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,
|
|
|
|
@ -25,7 +25,6 @@ class MessagChat extends Component{
|
|
|
|
|
mypagey:20,
|
|
|
|
|
messages:[],
|
|
|
|
|
objc:[],
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentDidMount(){
|
|
|
|
@ -59,6 +58,15 @@ class MessagChat extends Component{
|
|
|
|
|
this.messageList.scrollTop = maxScrollTop > 0 ? maxScrollTop : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contentViewScrolltop=(e)=>{
|
|
|
|
|
|
|
|
|
|
if(e.currentTarget.scrollHeight===0){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 滑动刷新
|
|
|
|
|
contentViewScrolledit=(e)=>{
|
|
|
|
|
|
|
|
|
@ -74,10 +82,10 @@ class MessagChat extends Component{
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
//滑动到顶部
|
|
|
|
|
console.log("滑动到顶部判断");
|
|
|
|
|
console.log(e.currentTarget.clientHeight);
|
|
|
|
|
console.log(e.currentTarget.scrollTop);
|
|
|
|
|
console.log(e.currentTarget.scrollHeight);
|
|
|
|
|
// console.log("滑动到顶部判断");
|
|
|
|
|
// console.log(e.currentTarget.clientHeight);
|
|
|
|
|
// console.log(e.currentTarget.scrollTop);
|
|
|
|
|
// console.log(e.currentTarget.scrollHeight);
|
|
|
|
|
// if(e.currentTarget.scrollHeight+e.currentTarget.scrollTop===e.currentTarget.clientHeight){
|
|
|
|
|
// console.log("滑动到顶部判断");
|
|
|
|
|
//
|
|
|
|
@ -325,10 +333,11 @@ class MessagChat extends Component{
|
|
|
|
|
}
|
|
|
|
|
datas.push(datays);
|
|
|
|
|
//颠倒数组
|
|
|
|
|
console.log(datas);
|
|
|
|
|
this.setState({
|
|
|
|
|
messages: datas,
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
this.messageRef.current.setValue('')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
@ -405,6 +414,7 @@ class MessagChat extends Component{
|
|
|
|
|
</p>
|
|
|
|
|
{/*聊天页面*/}
|
|
|
|
|
<div className="dialogPanel"
|
|
|
|
|
onScroll={this.contentViewScrolltop}
|
|
|
|
|
ref={(div) => {
|
|
|
|
|
this.messageList = div;
|
|
|
|
|
}}>
|
|
|
|
@ -460,7 +470,7 @@ class MessagChat extends Component{
|
|
|
|
|
<TPMMDEditor ref={this.messageRef}
|
|
|
|
|
placeholder={'请输入您的回复'}
|
|
|
|
|
watch={false}
|
|
|
|
|
initValue={""}
|
|
|
|
|
initValue={''}
|
|
|
|
|
mdID={'courseMessageMD'}
|
|
|
|
|
className="courseMessageMD"
|
|
|
|
|
height={200}
|
|
|
|
|