Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
ec2c3ce5ec
File diff suppressed because one or more lines are too long
@ -1,57 +1,57 @@
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #222;
|
||||
height: 150px;
|
||||
padding: 20px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-title {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.App-intro {
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 控制md编辑器列行的宽度
|
||||
见 codermirror maybeUpdateLineNumberWidth方法
|
||||
*/
|
||||
.editormd .CodeMirror-linenumbers {
|
||||
padding: 0;
|
||||
}
|
||||
.editormd-html-preview hr, .editormd-preview-container hr {
|
||||
/* 颜色加深 */
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
/* 重置掉antd的一些样式 */
|
||||
html, body {
|
||||
-webkit-font-smoothing: auto !important;
|
||||
}
|
||||
|
||||
.ant-progress-textyes {
|
||||
color: #52c41a;
|
||||
}
|
||||
.ant-progress-textno{
|
||||
color: #f5222d;
|
||||
}
|
||||
/* md多空格 */
|
||||
.markdown-body p {
|
||||
white-space: pre-wrap;
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #222;
|
||||
height: 150px;
|
||||
padding: 20px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-title {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.App-intro {
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 控制md编辑器列行的宽度
|
||||
见 codermirror maybeUpdateLineNumberWidth方法
|
||||
*/
|
||||
.editormd .CodeMirror-linenumbers {
|
||||
padding: 0;
|
||||
}
|
||||
.editormd-html-preview hr, .editormd-preview-container hr {
|
||||
/* 颜色加深 */
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
/* 重置掉antd的一些样式 */
|
||||
html, body {
|
||||
-webkit-font-smoothing: auto !important;
|
||||
}
|
||||
|
||||
.ant-progress-textyes {
|
||||
color: #52c41a;
|
||||
}
|
||||
.ant-progress-textno{
|
||||
color: #f5222d;
|
||||
}
|
||||
/* md多空格 */
|
||||
.markdown-body p {
|
||||
white-space: pre-wrap;
|
||||
}
|
@ -1,62 +1,62 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import classNames from 'classnames'
|
||||
|
||||
import axios from 'axios'
|
||||
|
||||
class UserSection extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
|
||||
}
|
||||
}
|
||||
/*点击关注或者取消关注*/
|
||||
AboutFocus(){
|
||||
const { author_info } = this.props
|
||||
/*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/
|
||||
|
||||
const focusUrl = `/api/v1/users/${author_info.user_id}/${this.props.author_info.watched ? 'unwatch' : 'watch'}?object_id=${author_info.user_id}&object_type=user`
|
||||
|
||||
axios.get(focusUrl,{
|
||||
})
|
||||
.then((response) => {
|
||||
const status = response.data.status;
|
||||
console.log(status);
|
||||
if(status == 1){
|
||||
const new_author_info = Object.assign({}, this.props.author_info)
|
||||
new_author_info.watched = !new_author_info.watched
|
||||
this.props.initForumState({author_info: new_author_info})
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
const { match, history, author_info , current_user } = this.props
|
||||
if (!author_info) {
|
||||
return <div className="edu-back-white" id="forum_index_list"></div>
|
||||
}
|
||||
return (
|
||||
<div className="edu-back-white padding40-20 edu-txt-center">
|
||||
<a href={`/users/${author_info.login}`} target="_blank"><img src={`/images/${author_info.image_url}`} width="90" height="90" className="radius mb5"/></a>
|
||||
<p className="font-20 userPrivateName">{author_info.username}</p>
|
||||
<p className="color-grey-9 userPrivatePost">{author_info.identity}</p>
|
||||
{ author_info.user_id !== current_user.user_id &&
|
||||
<p className="clearfix mt30">
|
||||
<a href="javascript:void(0)" className="fl font-16 mr10 user_default_btn edu-blueback-btn" onClick={()=>{this.AboutFocus()}}>{ author_info.watched == true ? "取消关注" : "关注" }</a>
|
||||
<a href={`/users/${current_user.login}/message_detail?user_id=${author_info.user_id}`} className="fr font-16 user_default_btn user_private_btn" target="_blank">私信</a>
|
||||
</p> }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default UserSection;
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import classNames from 'classnames'
|
||||
|
||||
import axios from 'axios'
|
||||
|
||||
class UserSection extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
|
||||
}
|
||||
}
|
||||
/*点击关注或者取消关注*/
|
||||
AboutFocus(){
|
||||
const { author_info } = this.props
|
||||
/*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/
|
||||
|
||||
const focusUrl = `/api/v1/users/${author_info.user_id}/${this.props.author_info.watched ? 'unwatch' : 'watch'}?object_id=${author_info.user_id}&object_type=user`
|
||||
|
||||
axios.get(focusUrl,{
|
||||
})
|
||||
.then((response) => {
|
||||
const status = response.data.status;
|
||||
console.log(status);
|
||||
if(status == 1){
|
||||
const new_author_info = Object.assign({}, this.props.author_info)
|
||||
new_author_info.watched = !new_author_info.watched
|
||||
this.props.initForumState({author_info: new_author_info})
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
const { match, history, author_info , current_user } = this.props
|
||||
if (!author_info) {
|
||||
return <div className="edu-back-white" id="forum_index_list"></div>
|
||||
}
|
||||
return (
|
||||
<div className="edu-back-white padding40-20 edu-txt-center">
|
||||
<a href={`/users/${author_info.login}`} target="_blank"><img src={`/images/${author_info.image_url}`} width="90" height="90" className="radius mb5"/></a>
|
||||
<p className="font-20 userPrivateName">{author_info.username}</p>
|
||||
<p className="color-grey-9 userPrivatePost">{author_info.identity}</p>
|
||||
{ author_info.user_id !== current_user.user_id &&
|
||||
<p className="clearfix mt30">
|
||||
<a href="javascript:void(0)" className="fl font-16 mr10 user_default_btn edu-blueback-btn" onClick={()=>{this.AboutFocus()}}>{ author_info.watched == true ? "取消关注" : "关注" }</a>
|
||||
<a href={`/message/${current_user.login}/message_detail?target_ids=${author_info.user_id}`} className="fr font-16 user_default_btn user_private_btn" target="_blank">私信</a>
|
||||
</p> }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default UserSection;
|
||||
|
@ -0,0 +1,109 @@
|
||||
.myw120{
|
||||
width: 120px;
|
||||
}
|
||||
.myh120{
|
||||
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;
|
||||
}
|
||||
|
||||
.msheight30{
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
/*滚动条*/
|
||||
.private-list::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
|
||||
.private-list::-webkit-scrollbar-thumb {
|
||||
background-color: #E3EBF4;
|
||||
box-shadow: 0px 0px black;
|
||||
}
|
||||
|
||||
|
||||
.private-list::-webkit-scrollbar-track {
|
||||
border-radius:3px;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
|
||||
background-color: white;
|
||||
}
|
||||
/*滚动条*/
|
||||
.dialogPanel::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
|
||||
.dialogPanel::-webkit-scrollbar-thumb {
|
||||
background-color: #E3EBF4;
|
||||
box-shadow: 0px 0px black;
|
||||
}
|
||||
|
||||
|
||||
.dialogPanel::-webkit-scrollbar-track {
|
||||
border-radius:3px;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
|
||||
background-color: white;
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
Spin,
|
||||
Pagination,
|
||||
} from "antd";
|
||||
import axios from 'axios';
|
||||
import moment from 'moment';
|
||||
import {getImageUrl,markdownToHTML} from 'educoder';
|
||||
import "../css/messagemy.css"
|
||||
import WriteaprivateletterModal from '../messagemodal/WriteaprivateletterModal';
|
||||
//私信页面
|
||||
class Leftdialogue extends Component{
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state={
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
console.log("Leftdialogue");
|
||||
console.log(this.props);
|
||||
};
|
||||
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.getdata(1);
|
||||
// }
|
||||
}
|
||||
mydelete=(user_id,id)=>{
|
||||
this.props.DELETEsetreplyfun(user_id,id);
|
||||
}
|
||||
myCome=(e)=>{
|
||||
window.location.href="/users/"+e.login;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
return (
|
||||
<div className="OtherSide clearfix" id="message_content_25148">
|
||||
<a onMouseDown={()=>this.myCome(this.props.objeysl.sender)}>
|
||||
{
|
||||
this.props.objeysl&&this.props.objeysl.sender.image_url ?
|
||||
<img alt="头像" className="mr10 radius fl myimgw48 myimgh48"
|
||||
src={getImageUrl("/images/" + this.props.objeysl.sender.image_url)} />:""
|
||||
}
|
||||
</a>
|
||||
<div className="fl pr OtherSide-info">
|
||||
<span className="trangle"></span>
|
||||
<div className="sms break_word" id="message_content_show_25148" dangerouslySetInnerHTML={{__html: markdownToHTML(this.props.objeysl.content).replace(/▁/g, "▁▁▁")}}></div>
|
||||
<div className="edu-txt-right mt5">
|
||||
<a className="color-grey-c" onClick={()=>this.mydelete(this.props.objeysl.sender.id,this.props.objeysl.id)} >删除</a>
|
||||
</div>
|
||||
</div>
|
||||
<span className="fl ml15 color-grey-c lineh-15 mt15">{moment(this.props.objeysl.send_time).hour()}:{moment(this.props.objeysl.send_time).minute()<10?"0"+moment(this.props.objeysl.send_time).minute():moment(this.props.objeysl.send_time).minute()}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default Leftdialogue;
|
||||
// onClick="delete_confirm_box('/users/innov/delete_message?mess_id=25148', '确定要删除该条记录吗?')"
|
@ -0,0 +1,176 @@
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
Spin,
|
||||
Pagination,
|
||||
} from "antd";
|
||||
import axios from 'axios';
|
||||
import {getImageUrl} from 'educoder';
|
||||
import "../css/messagemy.css"
|
||||
//消息页面
|
||||
class MessagSub extends Component{
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state={
|
||||
page:1,
|
||||
limit:10,
|
||||
typeysl:"",
|
||||
count:0,
|
||||
isSpin:false,
|
||||
data:undefined,
|
||||
}
|
||||
}
|
||||
// 初始化数据
|
||||
componentDidMount(){
|
||||
// console.log("初始化数据了MessagSub");
|
||||
// console.log(this.props);
|
||||
this.getdata("",this.state.page);
|
||||
// this.Messageprivatemessageunreadmessage();
|
||||
try {
|
||||
this.props.Mtab(1);
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//塞选页数
|
||||
paginationonChanges=(pageNumber)=>{
|
||||
this.setState({
|
||||
page: pageNumber,
|
||||
})
|
||||
this.getdata(this.state.typeysl,pageNumber);
|
||||
|
||||
}
|
||||
//获取数据源
|
||||
getdata=(types,page)=>{
|
||||
this.setState({
|
||||
isSpin:true,
|
||||
})
|
||||
let{limit}=this.state;
|
||||
let url = `/users/tidings.json`;
|
||||
axios.get((url),{params:{
|
||||
type:types,
|
||||
page:page,
|
||||
per_page:limit,
|
||||
}}).then((result) => {
|
||||
if (result) {
|
||||
// if (result.data.status === 0) {
|
||||
|
||||
this.setState({
|
||||
page: page,
|
||||
count: result.data.count,
|
||||
typeysl: types,
|
||||
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) => {
|
||||
console.log(error);
|
||||
this.setState({
|
||||
isSpin:false,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
componentWillUnmount(){
|
||||
// 卸载异步操作设置状态
|
||||
this.setState = (state, callback) => {
|
||||
return;
|
||||
}
|
||||
}
|
||||
render() {
|
||||
let{page,limit,typeysl,count,isSpin,data}=this.state;
|
||||
// console.log("6868686868");
|
||||
// console.log(data);
|
||||
return (
|
||||
<div className="clearfix ml20">
|
||||
{/*头部筛选数据*/}
|
||||
<ul className="pl10 ridingNav clearfix edu-back-white">
|
||||
<li className={typeysl===""?"active":""}><a onClick={(s,i)=>this.getdata("",1)}>全部</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={(s,i)=>this.getdata("project",1)}>项目提醒</a></li>
|
||||
|
||||
<li className={typeysl&&typeysl==="project_package"?"active":""}><a onClick={(s,i)=>this.getdata("project_package",1)}>众包提醒</a></li>
|
||||
|
||||
<li className={typeysl&&typeysl==="interactive"?"active":""}><a onClick={(s,i)=>this.getdata("interactive",1)}>互动提醒</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>
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
{/*下面内容页面*/}
|
||||
<div className="bor-top-greyE mycenter">
|
||||
{/*这里可以进行数据处理*/}
|
||||
<div className="myw100baifenbi">
|
||||
<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)=>{
|
||||
console.log(data)
|
||||
return(
|
||||
<div className="pl25 ridinglist edu-back-white" key={key}>
|
||||
<div className="ridinglist-sub clearfix df tiding_item">
|
||||
<img onMouseDown={()=>this.myCome(item)} src={getImageUrl("/images/"+item.trigger_user.image_url)} className="radius mr10 fl myimgw48 myimgh48"/>
|
||||
<div className="fl flex1">
|
||||
<p>
|
||||
<a className="mr20 private_message_a" onMouseDown={()=>this.myCome(item)}>{item.trigger_user.name}</a>
|
||||
<span className="color-grey-c">{item.time}</span>
|
||||
{item.tiding_type==="Apply"?(
|
||||
item.status===0?
|
||||
<span className="edu-filter-btn ml20 edu-filter-btn-red">待处理</span>:""
|
||||
):""}
|
||||
{item.tiding_type==="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>
|
||||
|
||||
{/*页数*/}
|
||||
{ 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>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default MessagSub;
|
@ -0,0 +1,180 @@
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
Spin,
|
||||
Pagination,
|
||||
} from "antd";
|
||||
import axios from 'axios';
|
||||
import moment from 'moment';
|
||||
import {getImageUrl} from 'educoder';
|
||||
import "../css/messagemy.css"
|
||||
import WriteaprivateletterModal from '../messagemodal/WriteaprivateletterModal';
|
||||
//私信页面
|
||||
class MessagePrivate extends Component{
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state={
|
||||
page:1,
|
||||
limit:10,
|
||||
count:0,
|
||||
data:undefined,
|
||||
isSpin:false,
|
||||
modalsType:false,
|
||||
};
|
||||
// console.log("MessagePrivate");
|
||||
// console.log(this.props);
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
this.getdata(1);
|
||||
try {
|
||||
this.props.Mtab(2);
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
// console.log("MessagePrivate");
|
||||
// console.log(this.props);
|
||||
// console.log(this.props.match.params.userid);
|
||||
};
|
||||
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.getdata(1);
|
||||
}
|
||||
}
|
||||
//获取数据地方
|
||||
getdata=(page)=>{
|
||||
this.setState({
|
||||
isSpin:true,
|
||||
});
|
||||
let{limit}=this.state;
|
||||
let url = `/users/${this.props.match&&this.props.match.params.userid}/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);
|
||||
|
||||
// console.log("调用了消失的方法");
|
||||
// console.log("5454545454");
|
||||
// if (result.data.status === 0) {
|
||||
|
||||
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,id)=>{
|
||||
// console.log("跳转页面");
|
||||
// console.log(i);
|
||||
this.props.Modifyur(i,id);
|
||||
};
|
||||
myCome=(e)=>{
|
||||
window.location.href="/users/"+e.target.login;
|
||||
}
|
||||
render() {
|
||||
let{page,limit,typeysl,count,isSpin,data,modalsType}=this.state;
|
||||
// console.log( this.props);
|
||||
// console.log("37");
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
modalsType===true?
|
||||
<WriteaprivateletterModal {...this.state} {...this.props} modalsType={modalsType} cancelmodalsType={this.cancelmodalsType} smyJump={(is,item)=>this.smyJump(is,item)} ></WriteaprivateletterModal>
|
||||
:""
|
||||
}
|
||||
<div className="edu-back-white ml25">
|
||||
<p className="clearfix font-16 padding30-20 bor-bottom-greyE">
|
||||
<span className="fl">全部私信</span>
|
||||
<a 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={()=>this.smyJump(3,item.target.id)}>
|
||||
<a className="fl mr10 private_message_a" onMouseDown={()=>this.myCome(item)}>
|
||||
<img onMouseDown={()=>this.myCome(item)} src={getImageUrl("/images/"+item.target.image_url)} className="radius myimgw48 myimgh48"/>
|
||||
</a>
|
||||
<div className="fl flex1">
|
||||
<p>
|
||||
<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>
|
||||
</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>
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
export default MessagePrivate;
|
@ -0,0 +1,227 @@
|
||||
import React, { Component } from 'react';
|
||||
import {Input,Pagination,Tooltip} from 'antd';
|
||||
import {TPMIndexHOC} from "../../../modules/tpm/TPMIndexHOC";
|
||||
import { WordsBtn ,ActionBtn,SnackbarHOC,markdownToHTML,getImageUrl} from 'educoder';
|
||||
import axios from 'axios';
|
||||
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);
|
||||
this.state={
|
||||
routing:1,
|
||||
unread_message_count:0,
|
||||
unread_tiding_count:0,
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
// console.log("Messagerouting");
|
||||
// console.log(this.props);
|
||||
// let courstype=this.props.location.search;
|
||||
// // courstype=courstype.splice('/');
|
||||
// // courstype=courstype[3];
|
||||
// // console.log("45");
|
||||
// console.log(courstype);
|
||||
|
||||
|
||||
}
|
||||
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)=>{
|
||||
this.setState({
|
||||
routing:value,
|
||||
});
|
||||
this.Messageprivatemessageunreadmessage(this.props.current_user.user_id);
|
||||
if(value===1){
|
||||
this.props.history.replace(`/message/${this.props.current_user.user_id}/user_tidings`);
|
||||
}
|
||||
if(value===2){
|
||||
this.props.history.replace(`/message/${this.props.current_user.user_id}/private_messages`);;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
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,id)=>{
|
||||
// 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/${this.props.current_user.user_id}/user_tidings`);
|
||||
}
|
||||
if(i===2){
|
||||
this.props.history.replace(`/message/${this.props.current_user.user_id}/private_messages`);
|
||||
}
|
||||
|
||||
}else {
|
||||
this.setState({
|
||||
routing:i,
|
||||
});
|
||||
console.log("22222222222");
|
||||
this.props.history.replace(`/message/${this.props.current_user.user_id}/message_detail?target_ids=${id}`);
|
||||
}
|
||||
|
||||
};
|
||||
myCome=(e)=>{
|
||||
window.location.href="/users/"+e.target.login;
|
||||
}
|
||||
|
||||
myxiaoxisixintab=(i)=>{
|
||||
if(i===1){
|
||||
this.setState({
|
||||
routing:1,
|
||||
});
|
||||
}
|
||||
if(i===2){
|
||||
this.setState({
|
||||
routing:2,
|
||||
});
|
||||
|
||||
}
|
||||
if(i===3){
|
||||
this.setState({
|
||||
routing:3,
|
||||
});
|
||||
}
|
||||
}
|
||||
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">
|
||||
{/*左边*/}
|
||||
<div className="leftPanel">
|
||||
{/*头像*/}
|
||||
<div className="mb20 edu-back-white pt40 pb40 edu-txt-center">
|
||||
<a >
|
||||
{
|
||||
this.props.current_user!== undefined?
|
||||
<img className="person radius myw120 myh120" src={getImageUrl("/images/"+this.props.current_user.image_url)}/>
|
||||
:""
|
||||
}
|
||||
|
||||
</a>
|
||||
<p className="font-24 lineh-25 mt10" >{this.props.current_user&&this.props.current_user.username}</p>
|
||||
<p className="color-grey-6 mt5" >{this.props.current_user&&this.props.current_user.user_identity}</p>
|
||||
</div>
|
||||
{/*路由跳转*/}
|
||||
<ul className="edu-back-white">
|
||||
<li className={routing ===1?"nav pr active":"nav pr"}>
|
||||
<a onClick={(value)=>this.SwitchonClick(1)}>消息</a>
|
||||
{parseInt(unread_tiding_count)>0?<span className="new-info">{unread_message_count}</span>:""}
|
||||
</li>
|
||||
<li className={routing ===2?"nav pr active":routing ===3?"nav pr active":"nav pr"}>
|
||||
<a onClick={(value)=>this.SwitchonClick(2)}>私信</a>
|
||||
{parseInt(unread_tiding_count)>0?<span className="new-info">{unread_tiding_count}</span>:""}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{/*右边*/}
|
||||
<div className="rightPanel">
|
||||
<div className="clearfix">
|
||||
{/*/!*消息自路由*!/*/}
|
||||
{/*{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>
|
||||
{/*/!*消息自路由*! name 是 /message/info/:userid/*/}
|
||||
<Route path="/message/:userid/user_tidings"
|
||||
render={
|
||||
(props) => (<MessagSub {...this.state} {...this.props} {...props} Message2={()=>this.Message2()} Mtab={(i)=>this.myxiaoxisixintab(i)}></MessagSub>)
|
||||
}
|
||||
></Route>
|
||||
{/*/!*私信*! name 是letter/*/}
|
||||
<Route path="/message/:userid/private_messages"
|
||||
render={
|
||||
(props) => (<MessagePrivate {...this.state} {...this.props} {...props} Message2={()=>this.Message2()} Modifyur={(i,item)=>this.Modifyur(i,item)} Mtab={(i)=>this.myxiaoxisixintab(i)}></MessagePrivate> )
|
||||
}
|
||||
></Route>
|
||||
{/*/!*私信聊天页面*! letters/*/}
|
||||
<Route path="/message/:userid/message_detail"
|
||||
render={
|
||||
(props) => (<MessagChat {...this.state} {...this.props} {...props} Message2={()=>this.Message2()} Modifyur={(i)=>this.Modifyur(i)} Mtab={(i)=>this.myxiaoxisixintab(i)}></MessagChat>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
|
||||
</Switch>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default SnackbarHOC() (TPMIndexHOC ( Messagerouting ));
|
@ -0,0 +1,65 @@
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
Spin,
|
||||
Pagination,
|
||||
} from "antd";
|
||||
import axios from 'axios';
|
||||
import moment from 'moment';
|
||||
import {getImageUrl,markdownToHTML} from 'educoder';
|
||||
import "../css/messagemy.css"
|
||||
import WriteaprivateletterModal from '../messagemodal/WriteaprivateletterModal';
|
||||
//私信页面
|
||||
class Rightdialogue extends Component{
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state={
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
// console.log("Rightdialogue");
|
||||
// console.log(this.props);
|
||||
|
||||
};
|
||||
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.getdata(1);
|
||||
// }
|
||||
}
|
||||
mydelete=(user_id,id)=>{
|
||||
this.props.DELETEsetreplyfun(user_id,id);
|
||||
}
|
||||
myCome=(e)=>{
|
||||
window.location.href="/users/"+e.login;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
return (
|
||||
<div className="ThisSide clearfix" id="message_content_25137">
|
||||
<a onMouseDown={()=>this.myCome(this.props.objeysl.sender)}>
|
||||
{this.props.objeysl&&this.props.objeysl.sender.image_url ?
|
||||
<img alt="头像" className="ml10 radius fr myimgw48 myimgh48"
|
||||
src={getImageUrl("/images/" + this.props.objeysl.sender.image_url)}/>:""
|
||||
}
|
||||
</a>
|
||||
<div className="fr pr ThisSide-info">
|
||||
<span className="trangle"></span>
|
||||
<div className="sms break_word" id="message_content_show_25137" dangerouslySetInnerHTML={{__html: markdownToHTML(this.props.objeysl.content).replace(/▁/g, "▁▁▁")}}></div>
|
||||
<div className="edu-txt-left mt5">
|
||||
<a className="color-grey-c" onClick={()=>this.mydelete(this.props.objeysl.sender.id,this.props.objeysl.id)}
|
||||
>删除</a>
|
||||
</div>
|
||||
</div>
|
||||
<span className="fr mr15 color-grey-c lineh-15 mt15">{moment(this.props.objeysl.send_time).hour()}:{moment(this.props.objeysl.send_time).minute()<10?"0"+moment(this.props.objeysl.send_time).minute():moment(this.props.objeysl.send_time).minute()}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default Rightdialogue;
|
Loading…
Reference in new issue