import React, { Component } from 'react'; import "../css/messagemy.css" import {getImageUrl} from 'educoder'; import { Modal,Input,Icon,Tooltip,Spin} from 'antd'; import axios from 'axios'; import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; import moment from 'moment'; //私信聊天页面 class MessagChat extends Component{ constructor(props) { super(props); this.messageRef = React.createRef(); this.state={ isSpin:false, isSpins:false, limit:20, page:1, datay:[], mess:false, } } componentDidMount(){ this.getdata(1); console.log("MessagChat"); console.log(this.props); } // 滑动刷新 contentViewScrolledit=(e)=>{ //滑动到底判断 if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ console.log("滑动到底判断"); let {page}=this.state; let newpage=page+1 this.getdata(newpage); } }; //获取数据地方 getdata=(page)=>{ this.setState({ isSpins:true, }); let{limit}=this.state; let url = `/users/${this.props.current_user.user_id}/private_messages.json`; // let url = `/users/71519/private_messages.json`; axios.get((url),{params:{ page:page, per_page:limit, }}).then((result) => { if (result) { // console.log(types); // console.log(result); if(result.data.message!==undefined){ // console.log("5151515151"); return; } // console.log("调用了消失的方法"); // console.log("5454545454"); if(result.data!==null){ if(result.data.private_messages!==null){ if(result.data.private_messages.length>0){ for (var i=0;i { console.log(error); this.setState({ isSpins:false, }) }) }; // 跳转页面 smyJump =(i)=>{ console.log("跳转页面"); console.log(i); this.props.Modifyur(i); }; // 点击了用户 Clickedontheuser=(user)=>{ this.setState({ myysluser:user, mess:true, }) } setreplyfun=()=>{ let contents=this.messageRef.current.getValue().trim(); let target_ids=""; let url = `/users/${this.props.current_user.user_id}/private_messages.json`; axios.post(url, { target_id: target_ids, content: contents }) .then((response) => { if (response.data.status == '0') { this.setState({ modulationModalVisible: false }) this.props.showNotification('调分成功') this.fetchList() } }) .catch(function (error) { console.log(error); }); } render() { let{isSpins,datay,myysluser,mess}=this.state; // return (
{/*私信对话框*/}
{/*左边*/}

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

{/*聊天页面*/}

2019/07/20

{/*右边*/}
头像
hello
22:20
{/*回复*/}
在问题反馈时,请同时发送问题发生页的网址链接,以便我们高效的为您服务 回复
{/*右边*/}
{/*右边头部*/}

私信列表

{/*列表数据*/} { datay===undefined? "" :datay.map((item,key)=>{ return(
this.Clickedontheuser(item.target)}>

{item.target.name} {item.unread === true? :""} {moment(item.send_time).fromNow()}

) })}
) } } export default MessagChat; // onClick="delete_confirm_box('/users/innov/delete_message?mess_id=25137', '确定要删除该条记录吗?')" // // {/*左边*/} //
// 71519?1564061748 //
// //
你好
//
// 删除 //
//
// 22:21 //