dev_cs_new
杨树林 6 years ago
parent cad8f2fbbd
commit f3a744b712

@ -19,8 +19,6 @@ import Trialapplicationysl from './modules/login/Trialapplicationysl';
import Trialapplicationreview from './modules/user/Trialapplicationreview'; import Trialapplicationreview from './modules/user/Trialapplicationreview';
import Addcourses from "./modules/courses/coursesPublic/Addcourses"; import Addcourses from "./modules/courses/coursesPublic/Addcourses";
import AccountProfile from "./modules/user/AccountProfile"; import AccountProfile from "./modules/user/AccountProfile";
import Messagerouting from "./modules/message/js/Messagerouting";
import Trialapplication from './modules/login/Trialapplication' import Trialapplication from './modules/login/Trialapplication'
import NotFoundPage from './NotFoundPage' import NotFoundPage from './NotFoundPage'
@ -225,7 +223,10 @@ const Interestpage = Loadable({
loader: () => import('./modules/login/EducoderInteresse'), loader: () => import('./modules/login/EducoderInteresse'),
loading: Loading, loading: Loading,
}) })
const Messagerouting= Loadable({
loader: () => import('./modules/message/js/Messagerouting'),
loading: Loading,
})
class App extends Component { class App extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

@ -43,7 +43,6 @@ export function initAxiosInterceptors(props) {
// proxy = "https://testeduplus2.educoder.net" // proxy = "https://testeduplus2.educoder.net"
proxy="http://47.96.87.25:48080/" proxy="http://47.96.87.25:48080/"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求 // 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
// 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制 // 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制
const requestMap = {}; const requestMap = {};

@ -41,9 +41,9 @@ class MemoDetailMDEditortwo extends Component {
window.__tt = 400; window.__tt = 400;
setTimeout(() => { setTimeout(() => {
var commentMDEditor = window.create_editorMD_4comment("memo_comment_editorMd", '', this.props.height || 240, placeholder, imageUrl, () => { var commentMDEditor = window.create_editorMD_4comment("memo_comment_editorMd", '', this.props.height || 240, placeholder, imageUrl, () => {
commentMDEditor.focus() commentMDEditor.focus();
this.initDrag() this.initDrag();
commentMDEditor.cm.on("change", (_cm, changeObj) => { commentMDEditor.cm.on("change", (_cm, changeObj) => {
this.setState({ this.setState({
@ -59,7 +59,7 @@ class MemoDetailMDEditortwo extends Component {
window.commentMDEditor = commentMDEditor; window.commentMDEditor = commentMDEditor;
}, window.__tt) }, window.__tt)
} };
componentDidMount() { componentDidMount() {
!this.props.usingMockInput && this.initMDEditor() !this.props.usingMockInput && this.initMDEditor()
} }

@ -4,3 +4,66 @@
.myh120{ .myh120{
height: 120px; height: 120px;
} }
.myimgw48{
width: 48px;
}
.myimgh48{
height: 48px;
}
.mycenter{
display: flex;
justify-content: center
}
.myw100baifenbi{
width: 100%;
}
.ant-modal-header{
border-radius: 0px !important;
}
.search-new{
width: 100% !important;
margin-bottom: 0px !important;
height: 32px;
position: relative;}
.search-span{
display: block;
position: absolute;
width: 100%;
height: 100%;
left: 0px;
top: 0px;
background-color: #F4F4F4;
border: 1px solid #EAEAEA;
border-radius: 4px;
z-index: 1;
}
.search-new-input{
width: 100% !important;
height: 32px;
padding-left: 5px;
border: none;
box-sizing: border-box;
background: none;
outline: none;
position: absolute;
left: 0px;
top: 1px;
z-index: 2;}
.search-new img,.search-new a,.search-new .searchicon{
cursor: pointer;
position: absolute;
right: 2px;
top: 2px;
z-index: 2;
}
.search-new a{top: 0px}
.search-new-input:focus + .search-span{background-color: #fff;}
.task-hide-2
{height: 40px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}

@ -1,21 +1,230 @@
import React, { Component } from 'react'; 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';
//私信聊天页面 //私信聊天页面
class MessagChat extends Component{ class MessagChat extends Component{
constructor(props) { constructor(props) {
super(props); super(props);
this.state={ this.state={
isSpin:false,
isSpins:false,
limit:20,
page:1,
datay:[],
} }
} }
componentDidMount(){ 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<result.data.private_messages.length;i++){
this.state.datay.push(result.data.private_messages[i]);
}
}
}
}
this.setState({
page:page,
isSpins:false,
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);
}
}).catch((error) => {
console.log(error);
this.setState({
isSpins:false,
})
})
};
// 跳转页面
smyJump =(i)=>{
console.log("跳转页面");
console.log(i);
this.props.Modifyur(i);
};
FormatTime=(timestamp)=> {
var datetime = new Date(timestamp.replace(/-/,"/"))
var mistiming = Math.round(new Date() / 1000) - datetime;
var postfix = mistiming > 0 ? '前' : '后'
mistiming = Math.abs(mistiming)
var arrr = ['年', '个月', '星期', '天', '小时', '分钟', '秒'];
var arrn = [31536000, 2592000, 604800, 86400, 3600, 60, 1];
for (var i = 0; i < 7; i++) {
var inm = Math.floor(mistiming / arrn[i])
if (inm != 0) {
return inm + arrr[i] + postfix
}
}
} }
render() { render() {
let{isSpins,datay}=this.state;
return ( return (
<div> <div className="edu-back-white ml20">
{/*私信对话框*/}
<div className="df clearfix">
{/*左边*/}
<div className="flex1">
<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>
117llj与你的私信
</p>
{/*聊天页面*/}
<div className="dialogPanel">
<div className="dialogPanel">
<div>
<p className="mt30 edu-txt-center"><span className="letter-time">2019/07/20</span></p>
{/*右边*/}
<div className="ThisSide clearfix" id="message_content_25137">
<a href="/users/innov"><img alt="1?1558048024" className="ml10 radius fr myimgw48 myimgh48" src={"/images/avatars/User/1?1558048024"} /></a>
<div className="fr pr ThisSide-info">
<span className="trangle"></span>
<div className="sms break_word" id="message_content_show_25137">hello</div>
<div className="edu-txt-left mt5">
<a href="javascript:void(0)" className="color-grey-c"
>删除</a>
</div>
</div>
<span className="fr mr15 color-grey-c lineh-15 mt15">22:20</span>
</div>
</div>
</div>
</div>
{/*回复*/}
<div className="bor-top-greyE padding20">
</div>
</div>
{/*右边*/}
<div className="bor-left-greyE" style={{width:"290px"}}>
{/*右边头部*/}
<p className="pt30 pb30 pl30 edu-txt-left font-16 bor-bottom-greyE">私信列表</p>
<Spin size="large" className="myw100baifenbi" spinning={isSpins}>
<div className="private-list " style={{maxHeight:"628px"}} onScroll={this.contentViewScrolledit}>
{/*列表数据*/}
{
datay===undefined?
""
:datay.map((item,key)=>{
return(
<div className="private-part clearfix" key={key}>
<div className="part-line df">
<img src={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="color-grey-c fr">{(time)=>this.FormatTime(item.send_time)}</span>
</p>
<p className="color-grey-6 lineh-20 justify break_word task-hide-2" style={{wordBreak:"break-word"}} dangerouslySetInnerHTML={{__html:item.content}}></p>
</div>
</div>
</div>
)
})}
</div>
</Spin>
</div>
</div>
</div> </div>
) )
} }
} }
export default MessagChat; export default MessagChat;
// onClick="delete_confirm_box('/users/innov/delete_message?mess_id=25137', '确定要删除该条记录吗?')"
//
// {/*左边*/}
// <div className="OtherSide clearfix" id="message_content_25148">
// <a href="/users/p94531287"><img alt="71519?1564061748" className="mr10 radius fl" height="48"
// src="/images/avatars/User/71519?1564061748" width="48"></a>
// <div className="fl pr OtherSide-info">
// <span className="trangle"></span>
// <div className="sms break_word" id="message_content_show_25148">你好</div>
// <div className="edu-txt-right mt5">
// <a href="javascript:void(0)" className="color-grey-c"
// onClick="delete_confirm_box('/users/innov/delete_message?mess_id=25148', '确定要删除该条记录吗?')">删除</a>
// </div>
// </div>
// <span className="fl ml15 color-grey-c lineh-15 mt15">22:21</span>
// </div>

@ -4,7 +4,8 @@ import {
Pagination, Pagination,
} from "antd"; } from "antd";
import axios from 'axios'; import axios from 'axios';
import {getImageUrl} from 'educoder';
import "../css/messagemy.css"
//消息页面 //消息页面
class MessagSub extends Component{ class MessagSub extends Component{
constructor(props) { constructor(props) {
@ -14,14 +15,15 @@ class MessagSub extends Component{
limit:10, limit:10,
typeysl:"", typeysl:"",
count:0, count:0,
isSpin:true, isSpin:false,
data:undefined,
} }
} }
// 初始化数据 // 初始化数据
componentDidMount(){ componentDidMount(){
debugger
console.log("初始化数据了"); console.log("初始化数据了");
this.getdata("",this.state.page); this.getdata("",this.state.page);
// this.Messageprivatemessageunreadmessage();
} }
//塞选页数 //塞选页数
@ -45,18 +47,20 @@ class MessagSub extends Component{
per_page:limit, per_page:limit,
}}).then((result) => { }}).then((result) => {
if (result) { if (result) {
console.log(types); // console.log(types);
console.log(result); // console.log(result);
if(result.data.message!==undefined){ if(result.data.message!==undefined){
console.log("5151515151"); // console.log("5151515151");
return; return;
} }
console.log("调用了消失的方法"); // console.log("调用了消失的方法");
console.log("5454545454"); // console.log("5454545454");
this.setState({ this.setState({
page:page,
count:result.data.count, count:result.data.count,
typeysl:types, typeysl:types,
isSpin:false, isSpin:false,
data:result.data.tidings===null?undefined:result.data.tidings===undefined?undefined:result.data.tidings===[]?undefined:result.data.tidings==="[]"?undefined:result.data.tidings.length===0?undefined:result.data.tidings,
}) })
} }
}).catch((error) => { }).catch((error) => {
@ -74,48 +78,93 @@ class MessagSub extends Component{
} }
} }
render() { render() {
let{page,limit,typeysl,count,isSpin}=this.state; let{page,limit,typeysl,count,isSpin,data}=this.state;
console.log("6868686868"); // console.log("6868686868");
console.log(isSpin); // console.log(data);
return ( return (
<div className="clearfix ml20"> <div className="clearfix ml20">
{/*头部筛选数据*/} {/*头部筛选数据*/}
<ul className="pl10 ridingNav clearfix edu-back-white"> <ul className="pl10 ridingNav clearfix edu-back-white">
<li className={typeysl===""?"active":""}><a onClick={()=>this.getdata("")}>全部消息</a></li> <li className={typeysl===""?"active":""}><a onClick={(s,i)=>this.getdata("",1)}>全部</a></li>
<li className={typeysl&&typeysl==="course"?"active":""} ><a onClick={()=>this.getdata("course")}>课堂提醒</a></li> <li className={typeysl&&typeysl==="course"?"active":""} ><a onClick={(s,i)=>this.getdata("course",1)}>课堂提醒</a></li>
<li className={typeysl&&typeysl==="project"?"active":""} ><a onClick={()=>this.getdata("project")}>项目提醒</a></li> <li className={typeysl&&typeysl==="project"?"active":""} ><a onClick={(s,i)=>this.getdata("project",1)}>项目提醒</a></li>
<li className={typeysl&&typeysl==="project_package"?"active":""}><a onClick={()=>this.getdata("project_package")}>众包</a></li> <li className={typeysl&&typeysl==="project_package"?"active":""}><a onClick={(s,i)=>this.getdata("project_package",1)}>众包提醒</a></li>
<li className={typeysl&&typeysl==="apply"?"active":""}><a onClick={()=>this.getdata("apply")}>审核</a></li> <li className={typeysl&&typeysl==="interactive"?"active":""}><a onClick={(s,i)=>this.getdata("interactive",1)}>互动提醒</a></li>
<li className={typeysl&&typeysl==="system"?"active":""}><a onClick={()=>this.getdata("system")}>通知</a></li> <li className={typeysl&&typeysl==="apply"?"active":""}><a onClick={(s,i)=>this.getdata("apply",1)}>审核</a></li>
<li className={typeysl&&typeysl==="system"?"active":""}><a onClick={(s,i)=>this.getdata("system",1)}>通知</a></li>
<li className={typeysl&&typeysl==="interactive"?"active":""}><a onClick={()=>this.getdata("interactive")}>互动提醒</a></li>
</ul> </ul>
{/*下面内容页面*/} {/*下面内容页面*/}
<div className="bor-top-greyE"> <div className="bor-top-greyE mycenter">
{/*这里可以进行数据处理*/} {/*这里可以进行数据处理*/}
<Spin size="large" spinning={isSpin}> <div className="myw100baifenbi">
<div className="pl25 ridinglist edu-back-white"> <Spin size="large" className="myw100baifenbi" spinning={isSpin}>
{
</div> data===undefined?
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">暂无数据哦~</p>
</div>
:data.map((item,key)=>{
return(
<div className="pl25 ridinglist edu-back-white" key={key}>
<div className="ridinglist-sub clearfix df tiding_item">
<img src={item.trigger_user.image_url} className="radius mr10 fl myimgw48 myimgh48"/>
<div className="fl flex1">
<p>
<span className="mr20">{item.trigger_user.name}</span>
<span className="color-grey-c">{item.time}</span>
{this.state.typeysl==="apply"?(
item.status===0?
<span className="edu-filter-btn ml20 edu-filter-btn-red">待处理</span>:""
):""}
{this.state.typeysl==="apply"?(
item.status===1?
<span className="edu-filter-btn ml20 edu-filter-btn-green">已处理</span>:""
):""}
</p>
<p className="color-grey-6 break_word_firefox" style={{wordBreak: "break-word"}}>
{
item.content
}
</p>
</div>
<span className={item.new_tiding===true?"new-point fr mr40 mt22":""}></span>
</div>
</div>
)
})}
</Spin> </Spin>
{/*页数*/} {/*页数*/}
<div style={{textAlign:"center"}} class="new_expand mt10"> { data===undefined?""
<div className="edu-txt-center mt30"> :
<Pagination showQuickJumper current={page} (count>10?
onChange={this.paginationonChanges} pageSize={limit} <div style={{textAlign: "center"}} className="new_expand mt10">
total={count}></Pagination> <div className="edu-txt-center mt30">
<Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={limit}
total={count}></Pagination>
</div>
</div>:""
)
}
</div> </div>
</div>
</div> </div>
</div> </div>

@ -1,20 +1,158 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {
Spin,
Pagination,
} from "antd";
import axios from 'axios';
import {getImageUrl} from 'educoder';
import "../css/messagemy.css"
import WriteaprivateletterModal from '../messagemodal/WriteaprivateletterModal';
//私信页面 //私信页面
class MessagePrivate extends Component{ class MessagePrivate extends Component{
constructor(props) { constructor(props) {
super(props); super(props);
this.state={ this.state={
page:1,
} limit:10,
count:0,
data:undefined,
isSpin:false,
modalsType:false,
};
console.log("MessagePrivate");
console.log(this.props);
} }
componentDidMount(){ componentDidMount(){
this.getdata(1);
};
//获取数据地方
getdata=(page)=>{
this.setState({
isSpin: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");
this.setState({
page:page,
count:result.data.count,
isSpin:false,
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,
})
}
}).catch((error) => {
console.log(error);
this.setState({
isSpin:false,
})
})
};
paginationonChanges=(pageNumber)=>{
this.setState({
page: pageNumber,
})
this.getdata(pageNumber);
};
okmodalsType=()=>{
this.setState({
modalsType:true,
})
}
cancelmodalsType=()=>{
this.setState({
modalsType:false,
})
};
// 跳转页面
smyJump =(i)=>{
console.log("跳转页面");
console.log(i);
this.props.Modifyur(i);
} }
render() { render() {
let{page,limit,typeysl,count,isSpin,data,modalsType}=this.state;
// console.log( this.props);
// console.log("37");
return ( return (
<div> <div>
{
modalsType===true?
<WriteaprivateletterModal {...this.state} {...this.props} modalsType={modalsType} cancelmodalsType={this.cancelmodalsType} smyJump={(is)=>this.smyJump(is)} ></WriteaprivateletterModal>
:""
}
<div className="edu-back-white ml25">
<p className="clearfix font-16 padding30-20 bor-bottom-greyE">
<span className="fl">全部私信</span>
<a href="javascript:void(0);" className="color-blue fr" onClick={()=>this.okmodalsType()}>写私信</a>
</p>
<Spin size="large" className="myw100baifenbi" spinning={isSpin}>
{
data===undefined?
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">暂无数据哦~</p>
</div>
:data.map((item,key)=>{
return(
<div className="private-item clearfix df" key={key} onClick={(i)=>this.smyJump(3)}>
<a className="fl mr10 private_message_a">
<img src={item.target.image_url} className="radius myimgw48 myimgh48"/>
</a>
<div className="fl flex1">
<p>
<a href="javascript:void(0);" onClick={()=>this.smyJump()} 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">{item.send_time}</span>
</p>
<span className="color-grey-6 break_word_firefox " dangerouslySetInnerHTML={{__html:item.content}}></span>
</div>
{item.unread === true ?<span className="new-point fr mt22"></span>:""}
</div>
)
})}
</Spin>
</div>
{/*页数*/}
{ data===undefined?""
:
(count>10?
<div style={{textAlign: "center"}} className="new_expand mt10">
<div className="edu-txt-center mt30">
<Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={limit}
total={count}></Pagination>
</div>
</div>
:""
)
}
</div> </div>
) )
} }
} }

@ -16,21 +16,71 @@ class Messagerouting extends Component{
super(props); super(props);
this.state={ this.state={
routing:1, routing:1,
unread_message_count:0,
unread_tiding_count:0,
} }
} }
componentDidMount(){ componentDidMount(){
} }
// 切换路由 componentDidUpdate(prevProps) {
// console.log("11111111111");
// console.log(prevProps);
// console.log("22222222222");
// console.log(this.props);
// console.log("33333333333");
if(prevProps.current_user !== this.props.current_user){
this.Messageprivatemessageunreadmessage(this.props.current_user.user_id);
}
}
//消息未读
Messageprivatemessageunreadmessage=(user_id)=>{
const url=`/users/${user_id}/unread_message_info.json`
axios.get(url).then((result) => {
if(result===undefined){
return
}
console.log("消息未读1");
console.log(result);
this.setState({
unread_message_count:result.data.unread_message_count,
unread_tiding_count:result.data.unread_tiding_count,
})
}).catch((error) => {
console.log(error)
})
};
SwitchonClick=(value)=>{ SwitchonClick=(value)=>{
this.setState({ this.setState({
routing:value, routing:value,
}) });
this.Messageprivatemessageunreadmessage(this.props.current_user.user_id);
};
Message2=(data)=>{
console.log("64");
console.log(data);
this.setState({
unread_message_count:data.unread_message_count,
unread_tiding_count:data.unread_tiding_count,
})
};
//跳转到链接
Modifyur=(i)=>{
console.log("跳转到链接");
console.log(i);
this.setState({
routing:i,
})
} }
render() { render() {
let{routing} =this.state; let{routing,unread_message_count,unread_tiding_count} =this.state;
console.log(this.props);
return ( return (
<div className="newMain clearfix"> <div className="newMain clearfix">
<div className="educontent mt20 mb80 clearfix"> <div className="educontent mt20 mb80 clearfix">
@ -38,34 +88,36 @@ class Messagerouting extends Component{
<div className="leftPanel"> <div className="leftPanel">
{/*头像*/} {/*头像*/}
<div className="mb20 edu-back-white pt40 pb40 edu-txt-center"> <div className="mb20 edu-back-white pt40 pb40 edu-txt-center">
<a> <a href="javascript:void(0);">
<img className="person radius myw120 myh120" src={"/images/avatars/User/71519?1564061748"}/> <img className="person radius myw120 myh120" src={this.props.current_user&&this.props.current_user.image_url}/>
</a> </a>
<p className="font-24 lineh-25 mt10" >杨树林</p> <p className="font-24 lineh-25 mt10" >{this.props.current_user&&this.props.current_user.username}</p>
<p className="color-grey-6 mt5" >工程师</p> <p className="color-grey-6 mt5" >{this.props.current_user&&this.props.current_user.user_identity}</p>
</div> </div>
{/*路由跳转*/} {/*路由跳转*/}
<ul className="edu-back-white"> <ul className="edu-back-white">
<li className={routing ===1?"nav pr active":"nav pr"}> <li className={routing ===1?"nav pr active":"nav pr"}>
<a onClick={(value)=>this.SwitchonClick(1)}>消息</a> <a onClick={(value)=>this.SwitchonClick(1)}>消息</a>
{unread_tiding_count>0?<span className="new-info">{unread_message_count}</span>:""}
</li> </li>
<li className={routing ===2?"nav pr active":"nav pr"}> <li className={routing ===2?"nav pr active":routing ===3?"nav pr active":"nav pr"}>
<a onClick={(value)=>this.SwitchonClick(2)}>私信</a> <a onClick={(value)=>this.SwitchonClick(2)}>私信</a>
{unread_tiding_count>0?<span className="new-info">{unread_tiding_count}</span>:""}
</li> </li>
</ul> </ul>
</div> </div>
{/*右边*/} {/*右边*/}
<div className="rightPanel"> <div className="rightPanel">
<div className="clearfix ml20"> <div className="clearfix">
{/*消息自路由*/} {/*消息自路由*/}
{routing===1?<MessagSub></MessagSub> :""} {routing===1?<MessagSub {...this.state} {...this.props} Message2={()=>this.Message2()}></MessagSub> :""}
{/*私信*/} {/*私信*/}
{routing===2?<MessagePrivate></MessagePrivate> :""} {routing===2?<MessagePrivate {...this.state} {...this.props} Message2={()=>this.Message2()} Modifyur={(i)=>this.Modifyur(i)}></MessagePrivate> :""}
{/*私信聊天页面*/} {/*私信聊天页面*/}
{routing===3?<MessagChat></MessagChat>:""} {routing===3?<MessagChat {...this.state} {...this.props} Message2={()=>this.Message2()} Modifyur={(i)=>this.Modifyur(i)}></MessagChat>:""}
</div> </div>
</div> </div>
</div> </div>

@ -0,0 +1,354 @@
import React, { Component } from 'react';
import { Modal,Input,Icon,Tooltip,Spin} from 'antd';
import axios from 'axios';
// import '../../modules/user/common.css';
//完善个人资料
class WriteaprivateletterModal extends Component {
constructor(props) {
super(props)
this.state ={
modalsType:false,
Pleaseselectthesender:false,
Pleaseselectthesenders:false,
inputvulue:"",
inputvulues:"",
floatingboxdisplay:false,
users:[],
Personalid:undefined,
isSpin:false,
Recentcontacts:false,
floatingboxdisplays:false,
}
}
componentDidMount() {
//用户id
console.log(this.props.current_user.user_id);
this.Recentcontacts();
}
//获取最近联系人
Recentcontacts=()=>{
this.setState({
isSpin:true
});
const url =`/users/${this.props.current_user.user_id}/recent_contacts.json`
axios.get(url).then((result) => {
if(result===undefined){
return
}
console.log(result);
this.setState({
users:result.data.users,
Recentcontacts:false,
floatingboxdisplay:true,
isSpin:false
})
}).catch((error) => {
console.log(error)
this.setState({
isSpin:false
})
})
};
//发送私信
SendprivatemessageAPI=(idvalue,contentvalue)=>{
const url =`/users/${this.props.current_user.user_id}/private_messages.json`
let data={
target_id:idvalue,
content:contentvalue,
}
axios.post(url, data).then((result) => {
if(result===undefined){
return
}
this.setState({
floatingboxdisplays:false,
Pleaseselectthesender:false,
});
this.props.smyJump(3);
console.log(result);
}).catch((error) => {
console.log(error)
})
};
//搜索私信人
Retrieveprivatemessageusers=(value)=>{
this.setState({
isSpin:true
})
const url =`/users_for_private_messages.json`
axios.get((url),{params:{
keyword:value,
}}).then((result) => {
if(result===undefined){
return
}
this.setState({
users:result.data.users,
Recentcontacts:true,
floatingboxdisplay:true,
isSpin:false
})
console.log(result);
}).catch((error) => {
console.log(error)
this.setState({
isSpin:false
})
})
};
modalCancel=()=>{
// var weekArray = JSON.parse(window.sessionStorage.getItem('yslgeturls'));
// if(weekArray===undefined){
// weekArray="/";
// }
// if(weekArray===null){
// weekArray="/";
// }
// if(weekArray==="null"){
// weekArray="/";
// }
// window.location.href = weekArray;
}
setDownload=()=>{
// window.location.href ='/account/profile';
};
// 搜索
search_message_person=()=>{
console.log("点击搜索按钮");
if(this.state.inputvulue.length===0){
this.Recentcontacts();
}else {
this.Retrieveprivatemessageusers(this.state.inputvulue);
}
};
//取消事件
HideModal=()=>{
this.props.cancelmodalsType();
};
//确认事件
OKModal=()=>{
let{inputvulue,Personalid,inputvulues}=this.state;
// console.log("发送私信了");
// console.log(inputvulue);
// console.log(Personalid);
// console.log(inputvulues);
if(inputvulue.length===0){
this.setState({
Pleaseselectthesender:true
});
return;
}
if(inputvulues.length===0){
this.setState({
floatingboxdisplays:true
})
return;
}
else {
if(Personalid===undefined){
this.setState({
Pleaseselectthesender:true
});
return
}
this.SendprivatemessageAPI(Personalid,inputvulues)
}
};
// 回车事件
Myοnkeydοwn=()=>{
console.log("点击了回车事件");
if(this.state.inputvulue.length===0){
this.Recentcontacts();
}else {
this.Retrieveprivatemessageusers(this.state.inputvulue);
}
};
//判断点击的键盘的keyCode是否为13是就调用上面的搜索函数
handleEnterKey = (e) => {
console.log("");
if(e.nativeEvent.keyCode === 13){ //e.nativeEvent获取原生的事件对像
this.Myοnkeydοwn()
}
};
// 查找联系人输入模式
setdatafunsval=(e)=>{
if(e.target.value.length===0){
this.setState({
inputvulue:e.target.value,
Pleaseselectthesender:false,
floatingboxdisplay:true,
Personalid:undefined
});
this.Recentcontacts();
}else {
this.setState({
inputvulue:e.target.value,
Pleaseselectthesender:false,
floatingboxdisplay:true,
});
}
console.log(e.target.value);
};
// 输入内容
setdatafunsvals=(e)=>{
console.log(e.target.value);
this.setState({
inputvulues:e.target.value,
Pleaseselectthesenders:false,
floatingboxdisplays:false,
floatingboxdisplay:false,
});
}
//失去焦点
myonBlur=(e)=>{
console.log("失去焦点了");
e.preventDefault();
this.setState({
// floatingboxdisplay:false,
})
};
//获取焦点
myonFocus=(e)=>{
console.log("获取到焦点了");
this.setState({
floatingboxdisplay:true,
})
};
//获取用户信息
Getuserinformation=(item)=>{
console.log("获取到了用户信息");
console.log(item.id);
this.setState({
Personalid:item.id===undefined?undefined:item.id===null?undefined:item.id,
inputvulue:item.name,
floatingboxdisplay:false,
})
}
render() {
// console.log(this.props)
let{Pleaseselectthesender,inputvulue,inputvulues,floatingboxdisplay,users,floatingboxdisplays,Recentcontacts,isSpin}=this.state;
return(
<Modal
keyboard={false}
closable={false}
footer={null}
destroyOnClose={true}
title={"写私信"}
centered={true}
visible={this.props.modalsType}
width="550px"
>
<div >
<div className="mb20 pr">
{/*搜索框*/}
{/*<div className="search-new myw100baifenbi" >*/}
{/* <input type="text" className="search-new-input fl " value={inputvulue} onKeyPress={this.handleEnterKey} onBlur={this.myonBlur} onFocus={this.myonFocus} onChange={this.setdatafunsval} utoComplete="off"*/}
{/* placeholder="发送给..." id="sendFor"/>*/}
{/* <span className="search-span"></span>*/}
{/* <img src={"/images/educoder/icon/search.svg"} className="fl mt5"*/}
{/* onClick={()=>this.search_message_person()}/>*/}
{/*</div>*/}
<div className="myw100baifenbi">
<Input
className=""
placeholder="发送给..."
value={inputvulue}
onKeyPress={this.handleEnterKey}
onBlur={this.myonBlur}
onFocus={this.myonFocus}
onChange={this.setdatafunsval}
suffix={
<img src={"/images/educoder/icon/search.svg"} onClick={()=>this.search_message_person()}/>
}
/>
</div>
{/*搜索框下面悬浮框*/}
<div className="recently_person" style={floatingboxdisplay===false?{display: "none"}:{display: "block"}}>
<Spin size="large" className="myw100baifenbi" spinning={isSpin}>
<p className="padding10-20 color-grey-9 cdefault">{Recentcontacts===false?"最近联系人":"搜索结果"}</p>
{
users.map((item,key)=>{
return(
<p className="clearfix recently_item" onMouseDown={(c)=>this.Getuserinformation(item)}>
<img alt="1?1558048024" className="radius fl mr10 myimgw48 myimgh48" src={item.image_url}
/>
<span className="recently_name">{item.name}</span>
</p>
)
})
}
</Spin>
{/*<p className="clearfix recently_item">*/}
{/* <img alt="1?1558048024" className="radius fl mr10 myimgw48 myimgh48" src={"/images/avatars/User/1?1558048024"}*/}
{/* />*/}
{/* <span className="recently_name" data-user="1">实践教学</span>*/}
{/*</p>*/}
{/*<p className="clearfix recently_item">*/}
{/* <img alt="B?1532489442" className="radius fl mr10 myimgw48 myimgh48" src={"/images/avatars/User/b?1532489442"}*/}
{/* />*/}
{/* <span className="recently_name" data-user="20523">innov</span>*/}
{/*</p>*/}
</div>
</div>
{/*私信内容*/}
<div className="writeLetter_Info">
<textarea className="writeLetter_text greyInput" value={inputvulues} onChange={this.setdatafunsvals} name="content" id="writeLetter_text"
maxLength="200"></textarea>
<span className="longchar">200</span>
</div>
</div>
{
Pleaseselectthesender === true ?
<p className="color-orange-tip " style={{height: "25px"}}><span id="notice_send_person">请选择发送对象</span></p>
:(floatingboxdisplays ===false?<p style={{height:"25px"}}></p>:"")
}
{
floatingboxdisplays===true?
<p className="color-orange-tip " style={{height: "25px"}}><span id="notice_send_person">请输入发送内容</span></p>
: ""
}
{/*确认事件*/}
<p className="clearfix edu-txt-center">
<a href="javascript:void(0);" onClick={()=>this.HideModal()} className="pop_close task-btn mr30">取消</a>
<a href="javascript:void(0);" className="task-btn task-btn-orange" onClick={()=>this.OKModal()} id="submit_send_letter">确定</a>
</p>
{/*<div className="educouddiv">*/}
{/* <div className={"tabeltext-alignleft"}><p style={{fontSize: "16px"}}>完善您的资料,将获得更多的使用权限</p></div>*/}
{/* <div className="clearfix mt30 edu-txt-center">*/}
{/* <a className="task-btn mr30" onClick={()=>this.modalCancel()}>取消</a>*/}
{/* <a className="task-btn task-btn-orange" onClick={()=>this.setDownload()}>立即完善</a>*/}
{/* </div>*/}
{/*</div>*/}
</Modal>
)
}
}
export default WriteaprivateletterModal;
Loading…
Cancel
Save