Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

# Conflicts:
#	public/react/public/css/edu-all.css
#	public/stylesheets/educoder/edu-all.css
dev_admin
杨树明 6 years ago
commit 3bfaeb7a6b

@ -9,8 +9,7 @@ class BiddingUsersController < ApplicationController
end
def win
package = current_user.project_packages.find(params[:project_package_id])
ProjectPackages::WinBiddingService.call(package, params)
ProjectPackages::WinBiddingService.call(current_package, current_user, params)
render_ok
rescue ProjectPackages::WinBiddingService::Error => ex
render_error(ex.message)

@ -17,8 +17,8 @@ class FilesController < ApplicationController
sort_type = params[:sort_type] || 'created_on' # created_on时间排序 downloads下载次数排序; quotes: 引用次数排序
course_second_category_id = params[:course_second_category_id] || 0 # 0: 为主目录, 其他为次目录id
@user = current_user
@attachments = @course.attachments.by_course_second_category_id(course_second_category_id)
.includes(attachment_group_settings: :course_group, author: [:user_extension, :course_members])
@attachments = course_second_category_id.to_i == 0 ? @course.attachments : @course.attachments.by_course_second_category_id(course_second_category_id)
@attachments = @attachments.includes(attachment_group_settings: :course_group, author: [:user_extension, :course_members])
.ordered(sort: sort.to_i, sort_type: sort_type.strip)
get_category(@course, course_second_category_id)

@ -3,7 +3,7 @@ class MemosController < ApplicationController
before_action :set_memo, only: [:show, :edit, :update, :destroy, :sticky_or_cancel, :hidden, :more_reply]
before_action :validate_memo_params, only: [:create, :update]
before_action :owner_or_admin, only: [:edit, :update, :destroy]
before_action :is_admin, only: [:sticky_or_cancel, :hidden]
before_action :require_business, only: [:sticky_or_cancel, :hidden]
include ApplicationHelper
# GET /memos
@ -132,7 +132,7 @@ class MemosController < ApplicationController
def hidden
tip_exception("不能对主贴进行隐藏操作") if @memo.parent_id.nil?
begin
@memo.update_attributes!(hidden: !@memo.hidden)
@memo.update_attributes!(hidden: @memo.hidden == 0 ? 1 : 0)
normal_status("更新成功")
rescue Exception => e
tip_exception("更新失败,原因:#{e}")
@ -182,10 +182,6 @@ class MemosController < ApplicationController
tip_exception(403, "无权限操作") unless @memo.author == current_user || current_user.admin? || current_user.business?
end
def is_admin
tip_exception(403, "无权限操作") unless current_user.admin? || current_user.business?
end
# Never trust parameters from the scary internet, only allow the white list through.
def memo_params
params.require(:memo).permit(:subject, :content, :forum_id)

@ -406,9 +406,10 @@ class ShixunsController < ApplicationController
end
end
@shixun.update_attributes(shixun_params)
logger.info("##########shixun_info_params: #{shixun_info_params}")
logger.info("##########params[:shixun_info][:evaluate_script]: #{params[:shixun_info][:evaluate_script]}")
@shixun.shixun_info.update_attributes(shixun_info_params)
@shixun.shixun_schools.delete_all
logger.info("##########scope_partment:###{params[:scope_partment]}")
# scope_partment: 高校的名称
if params[:scope_partment].present?
arr = []

@ -2,6 +2,9 @@ module TidingDecorator
def content
method_name = "#{container_type.underscore}_content"
respond_to?(method_name) ? send(method_name) : ''
rescue => ex
Util.logger_error(ex)
''
end
def how_long_time
@ -261,16 +264,16 @@ module TidingDecorator
def journal_content
case tiding_type
when 'Mentioned' then
I18n.t(locale_format(tiding_type)) % message_content_helper(container.notes)
I18n.t(locale_format(tiding_type)) % message_content_helper(container&.notes)
when 'Comment' then
I18n.t(locale_format(tiding_type, container.parent.present?)) % message_content_helper(container.notes)
I18n.t(locale_format(tiding_type, container.parent.present?)) % message_content_helper(container&.notes)
else
I18n.t(locale_format) % container.issue.subject
I18n.t(locale_format) % container&.issue&.subject
end
end
def issue_content
I18n.t(locale_format) % container.subject
I18n.t(locale_format) % container&.subject
end
def pull_request_content
@ -291,15 +294,15 @@ module TidingDecorator
end
def poll_content
I18n.t(locale_format(parent_container_type)) % container.polls_name
I18n.t(locale_format(parent_container_type)) % container&.polls_name
end
def exercise_content
I18n.t(locale_format(parent_container_type)) % container.exercise_name
I18n.t(locale_format(parent_container_type)) % container&.exercise_name
end
def student_graduation_topic_content
I18n.t(locale_format) % container.graduation_topic.try(:name)
I18n.t(locale_format) % container&.graduation_topic.try(:name)
end
def deal_student_topic_select_content
@ -307,27 +310,27 @@ module TidingDecorator
end
def graduation_task_content
I18n.t(locale_format(parent_container_type)) % container.name
I18n.t(locale_format(parent_container_type)) % container&.name
end
def graduation_work_content
I18n.t(locale_format(extra.nil?)) % container.graduation_task.try(:name)
I18n.t(locale_format(extra.nil?)) % container&.graduation_task.try(:name)
end
def graduation_work_score_content
I18n.t(locale_format) % container.graduation_work.graduation_task.try(:name)
I18n.t(locale_format) % container&.graduation_work&.graduation_task.try(:name)
end
def homework_common_content
I18n.t(locale_format(parent_container_type), name: container.name, reason: extra)
I18n.t(locale_format(parent_container_type), name: container&.name, reason: extra)
end
def student_work_content
I18n.t(locale_format(extra.nil?)) % container.homework_common.try(:name)
I18n.t(locale_format(extra.nil?)) % container&.homework_common.try(:name)
end
def student_works_score_content
I18n.t(locale_format(extra)) % container.student_work.homework_common.try(:name)
I18n.t(locale_format(extra)) % container&.student_work&.homework_common.try(:name)
end
def challenge_work_score_content

@ -194,7 +194,7 @@ module CoursesHelper
# 获取课堂的资源数
def get_attachment_count(course, category_id)
course.attachments.where(course_second_category_id: category_id).size
category_id.to_i == 0 ? course.attachments.size : course.attachments.where(course_second_category_id: category_id).size
end
# 获取课堂的作业数

@ -1,14 +1,16 @@
class ProjectPackages::WinBiddingService < ApplicationService
Error = Class.new(StandardError)
attr_reader :package, :params
attr_reader :package, :user, :params
def initialize(package, params)
def initialize(package, user, params)
@package = package
@user = user
@params = params
end
def call
raise Error, '没有权限' unless package.creator_id == user.id || user.admin_or_business?
raise Error, '竞标报名还未结束' unless package.bidding_end?
raise Error, '该状态下不能选择中标者' unless package.may_finish_bidding?

@ -1 +1,2 @@
json.course_id @course.id
json.course_id @course.id
json.first_category_url module_url(@course.none_hidden_course_modules.first, @course)

@ -4,7 +4,7 @@ json.courses @courses do |course|
json.avatar_url url_to_avatar(course.teacher)
json.creator course.teacher.real_name
json.school course.school&.name
json.technical_title course.teacher.identity
json.technical_title "" # course.teacher.identity
json.course_members_count course.course_members_count
json.tasks_count get_tasks_count course
json.visits course.visits

@ -11,6 +11,11 @@ json.libraries do
json.published_at library.display_published_at
json.created_at library.display_created_at
json.tags library.library_tags.map(&:name)
# 标签
json.tags do
json.array! library.library_tags.each do |tag|
json.extract! tag, :id, :name
end
end
end
end

@ -10,6 +10,7 @@ json.created_at library.display_created_at
# 创建者
json.creator do
json.partial! 'users/user_simple', user: library.user
json.school_name library.user.school_name
end
# 封面

@ -1,6 +1,9 @@
json.extract! tiding, :id, :status, :viewed, :user_id, :tiding_type, :container_id, :container_type, :parent_container_id, :parent_container_type
json.content tiding.content
json.identifier tiding.identifier
json.auth_type tiding.container_type == 'ApplyUserAuthentication' ? tiding.container.auth_type : nil
json.time tiding.how_long_time
json.new_tiding tiding.unread?(@onclick_time)

@ -3,6 +3,7 @@ json.message 'success'
json.private_message do
json.extract! @message, :id, :user_id, :receiver_id, :sender_id, :content
json.send_day @message.send_time.strftime('%Y-%m-%d')
json.send_time @message.display_send_time
json.sender do
json.partial! 'users/user_simple', user: @message.sender

@ -16,5 +16,11 @@ json.project_packages do
json.deadline_at package.display_deadline_at
json.published_at package.display_published_at
json.operation do
can_manage = current_user&.id == observed_user.id || current_user&.admin_or_business?
json.can_edit can_manage && package.editable?
json.can_delete can_manage && package.deletable?
end
end
end

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -72,6 +72,7 @@
"react-infinite-scroller": "^1.2.4",
"react-loadable": "^5.3.1",
"react-monaco-editor": "^0.25.1",
"react-player": "^1.11.1",
"react-redux": "5.0.7",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",

@ -577,7 +577,7 @@ p .activity-item:first-child{border-top: 1px solid #eee;}
.recently_name{float: left;line-height: 48px;display: block}
.recently_item:hover{background-color: #F9F9F9;}
/*私信对话框*/
.private-list{min-height: 660px;max-height: 810px;overflow-y: auto;overflow-x: hidden;}
.private-list{min-height: 660px;max-height: 831px;overflow-y: auto;overflow-x: hidden;}
.private-list .private-part{padding-left:20px;cursor: pointer}
.private-part:hover{background-color: #F5F5F5;}
.private-part.active{background-color: #F5F5F5;}

@ -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;
}

@ -18,9 +18,7 @@ import Notcompletedysl from './modules/user/Notcompletedysl';
import Trialapplicationysl from './modules/login/Trialapplicationysl';
import Trialapplicationreview from './modules/user/Trialapplicationreview';
import Addcourses from "./modules/courses/coursesPublic/Addcourses";
import AccountProfile from"./modules/user/AccountProfile";
import AccountProfile from "./modules/user/AccountProfile";
import Trialapplication from './modules/login/Trialapplication'
import NotFoundPage from './NotFoundPage'
@ -232,6 +230,10 @@ const ProjectPackages=Loadable({
loading: Loading,
})
const Messagerouting= Loadable({
loader: () => import('./modules/message/js/Messagerouting'),
loading: Loading,
})
class App extends Component {
constructor(props) {
super(props)
@ -351,17 +353,21 @@ class App extends Component {
{/* <Route path="/forums" component={ForumsIndexComponent}>
</Route> */}
<Route path="/comment" component={CommentComponent}/>
<Route path="/testMaterial" component={TestMaterialDesignComponent}/>
<Route path="/test" component={TestIndex}/>
<Route path="/testCodeMirror" component={TestCodeMirrorComponent}/>
<Route path="/testRCComponent" component={TestComponent}/>
<Route path="/testUrlQuery" component={TestUrlQueryComponent}/>
<Route path="/message"
render={
(props)=>(<Messagerouting {...this.props} {...props} {...this.state}></Messagerouting>)
}
></Route>
<Route exact path="/" component={ShixunsHome}/>
<Route component={Shixunnopage}/>
</Switch>
</Router>

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

@ -1,5 +1,6 @@
import React,{ Component } from "react";
import { getUrl2 } from "educoder";
import ReactPlayer from 'react-player'
const $ = window.$
let _url_origin = getUrl2()
@ -15,9 +16,12 @@ class Clappr extends Component{
}
componentDidMount() {
return;
const source = this.props.source || "http://your.video/here.mp4"
const { id, type } = this.props
const _id = `#_player${id}`
if (!window['Clappr'] && window['ClapprLoading'] == true) {
setTimeout(() => {
this.componentDidMount()
@ -26,6 +30,7 @@ class Clappr extends Component{
}
// && window['clappr-playback-rate-plugin']
if (window['Clappr'] ) {
// https://github.com/clappr/clappr/issues/1839
// http://clappr.github.io/classes/Player.html#method_mute
this['player'+id] = new window.Clappr.Player({
source: source, parentId: _id,
@ -83,12 +88,14 @@ class Clappr extends Component{
const _id = `_player${id}`
return(
<React.Fragment>
<style>{`
{/* https://github.com/CookPete/react-player/issues/686 */}
<ReactPlayer url={source} playing={false} controls={true} width={400} height={ type == 'mp3' ? 55 : 290}/>
{/* <style>{`
.playback_rate {
margin-right: 16px;
}
`}</style>
<div id={_id} className={className + ' ' + type}></div>
<div id={_id} className={className + ' ' + type}></div> */}
</React.Fragment>
)
}

@ -18,7 +18,7 @@ class EffectDisplayContent extends Component {
.effectDisplay .content>div {
flex: 1
}
.effectDisplay .clappr {
.effectDisplay .clappr, .effectDisplay .contentWrap {
display: flex;
justify-content: center;
}
@ -32,13 +32,13 @@ class EffectDisplayContent extends Component {
{content3 && <p className="content_title edu-txt-center fl font-18 mr03precent">预期输出{typeName}</p>}
</div>
<div className="clearfix df content" >
{content1 && <div className="fl mr03precent pt10 mb50">
{content1 && <div className="fl mr03precent pt10 mb50 contentWrap">
{content1}
</div>}
{content2 && <div className="fl mr03precent pt10 mb50">
{content2 && <div className="fl mr03precent pt10 mb50 contentWrap">
{content2}
</div>}
{content3 && <div className="fl mr03precent pt10 mb50">
{content3 && <div className="fl mr03precent pt10 mb50 contentWrap">
{content3}
</div>}
</div>

@ -171,7 +171,8 @@ class Testpapersettinghomepage extends Component{
}
console.log("170");
console.log(params);
axios.get(url+`?${queryString.stringify(params)}`+ '&export=true').then((response) => {
const urll=url+`?${queryString.stringify(params)}`;
axios.get(urll+ '&export=true').then((response) => {
if(response===undefined){
return
}
@ -195,13 +196,13 @@ class Testpapersettinghomepage extends Component{
}else {
this.setState({ donwloading: true })
downloadFile({
url: url+`?${queryString.stringify(params)}`,
url: urll,
successCallback: (url) => {
this.setState({ donwloading: false });
this.setState({ donwloading: false })
console.log('successCallback')
},
failCallback: (responseHtml, url) => {
this.setState({ donwloading: false });
this.setState({ donwloading: false })
console.log('failCallback')
}
})

@ -246,7 +246,7 @@ class TraineetraininginformationModal extends Component {
{this.props.boolgalist === false?
<div>
{
this.props.game_list === undefined?"" : this.props.game_list.length<4?
this.props.game_list === undefined?"" : this.props.game_list.length<5?
<div className="edu-table edu-back-white ">
<style>
{
@ -296,7 +296,7 @@ class TraineetraininginformationModal extends Component {
<div>
{
this.props.game_list === undefined?"" : this.props.game_list.length<4?
this.props.game_list === undefined?"" : this.props.game_list.length<5?
<div className="edu-table edu-back-white ">
<style>
{

@ -1,173 +1,173 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types';
import classNames from 'classnames'
import { isDev } from 'educoder'
import './MemoDetailEditor.css'
require('codemirror/lib/codemirror.css');
const $ = window.$;
///作业回答 专用
class MemoDetailMDEditortwo extends Component {
constructor(props) {
super(props)
this.state = {
isInited: this.props.usingMockInput ? false : true,
isError: false,
errorMsg: ''
}
}
componentDidUpdate(prevProps, prevState, snapshot) {
if (this.props.memo && (!prevProps.memo || this.props.memo.id != prevProps.memo.id)) {
// this.keEditor = window.sd_create_editor_from_data(this.props.memo.id, null, "100%", "Memo");
// window._kk = this.keEditor
}
}
initMDEditor = () => {
// 因为props.memo不存在时本组件不会被加载这里直接在didMount里初始化即可
const placeholder = '我要回复...'
// const imageUrl = `/upload_with_markdown?container_id=${this.props.memo.id}&container_type=Memo`;
const imageUrl = `/api/attachments.json`;
// 执行太快了,样式不正常
window.__tt = 400;
setTimeout(() => {
var commentMDEditor = window.create_editorMD_4comment("memo_comment_editorMd", '', this.props.height || 240, placeholder, imageUrl, () => {
commentMDEditor.focus()
this.initDrag()
commentMDEditor.cm.on("change", (_cm, changeObj) => {
this.setState({
isError: false,
errorMsg: ''
})
})
}, {
watch: false,
dialogLockScreen: false,
});
this.commentMDEditor = commentMDEditor;
window.commentMDEditor = commentMDEditor;
}, window.__tt)
}
componentDidMount() {
!this.props.usingMockInput && this.initMDEditor()
}
initDrag = () => {
window.initMDEditorDragResize(".editor__resize", this.commentMDEditor)
}
onCommit = () => {
const content = this.commentMDEditor.getValue();
// this.props.showError ==
if (this.props.showError == true) {
if (!content || content.trim() == "") {
this.setState({
isError: true,
errorMsg: '不能为空'
})
return;
} else if (content.length > 2000) {
this.setState({
isError: true,
errorMsg: '不能超过2000个字符'
})
return;
}
this.setState({
isError: false,
errorMsg: ''
})
}
window.$(document).trigger("onReply", { commentContent: content
, id: this.props.memo.id, editor: this.commentMDEditor } );
}
showEditor() {
$("html, body").animate({ scrollTop: $('#commentInput').offset().top - 100 }, 1000, () => {
if (this.commentMDEditor) {
this.commentMDEditor.cm.focus()
} else {
$('#commentInput input')[0].click()
}
});
}
onMockInputClick = () => {
this.setState({isInited: true})
this.initMDEditor()
}
render() {
const { match, history, memo, placeholder } = this.props
const { isInited, errorMsg } = this.state
if (!memo) {
return <div></div>
}
return (
<React.Fragment>
<style>{`
.mockInputWrapper {
display: flex;
padding: 30px;
}
.mockInputWrapper input {
flex:1;
padding-left: 10px;
height: 40px;
background: rgb(246,246,246);
margin-right: 20px;
}
.mockInputWrapper a.commentsbtn {
height: 40px;
display: inline-block;
margin-top: 0px !important;
vertical-align: text-top;
padding-top: 6px;
width: 60px;
margin-right: 0px !important;
}
#commentInput .editormd{
width:100%!important;
}
`}</style>
<div style={{ display: isInited ? 'none' : ''}} className="mockInputWrapper" id="commentInput">
<input onClick={this.onMockInputClick} placeholder={placeholder || '我要回复'}></input>
<a href="javascript:void(0)"
onClick={this.onMockInputClick} className="commentsbtn task-btn task-btn-blue">
发送
</a>
</div>
<div nhname={`new_message_${memo.id}`} className=""
style={{ padding: '30px',boxSizing:"border-box", display: isInited ? '' : 'none' }} id="commentInput">
<div id="memo_comment_editorMd" className="editorMD" style={{ marginBottom: '0px'
, border: errorMsg ? '1px solid red' : '1px solid #ddd'}}>
<textarea style={{'display': 'none'}}>
</textarea>
</div>
<div className="editor__resize" href="javascript:void(0);">调整高度</div>
{ errorMsg && <input className="fl" style={{color: 'red', marginTop: '6px',
marginLeft: '4px'}}>{errorMsg}</input> }
<a id={`new_message_submit_btn_${memo.id}`} href="javascript:void(0)"
onClick={this.onCommit} className="commentsbtn task-btn-blue task-btn fr ">
发送
</a>
</div>
</React.Fragment>
);
}
}
export default ( MemoDetailMDEditortwo );
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types';
import classNames from 'classnames'
import { isDev } from 'educoder'
import './MemoDetailEditor.css'
require('codemirror/lib/codemirror.css');
const $ = window.$;
///作业回答 专用
class MemoDetailMDEditortwo extends Component {
constructor(props) {
super(props)
this.state = {
isInited: this.props.usingMockInput ? false : true,
isError: false,
errorMsg: ''
}
}
componentDidUpdate(prevProps, prevState, snapshot) {
if (this.props.memo && (!prevProps.memo || this.props.memo.id != prevProps.memo.id)) {
// this.keEditor = window.sd_create_editor_from_data(this.props.memo.id, null, "100%", "Memo");
// window._kk = this.keEditor
}
}
initMDEditor = () => {
// 因为props.memo不存在时本组件不会被加载这里直接在didMount里初始化即可
const placeholder = '我要回复...'
// const imageUrl = `/upload_with_markdown?container_id=${this.props.memo.id}&container_type=Memo`;
const imageUrl = `/api/attachments.json`;
// 执行太快了,样式不正常
window.__tt = 400;
setTimeout(() => {
var commentMDEditor = window.create_editorMD_4comment("memo_comment_editorMd", '', this.props.height || 240, placeholder, imageUrl, () => {
commentMDEditor.focus();
this.initDrag();
commentMDEditor.cm.on("change", (_cm, changeObj) => {
this.setState({
isError: false,
errorMsg: ''
})
})
}, {
watch: false,
dialogLockScreen: false,
});
this.commentMDEditor = commentMDEditor;
window.commentMDEditor = commentMDEditor;
}, window.__tt)
};
componentDidMount() {
!this.props.usingMockInput && this.initMDEditor()
}
initDrag = () => {
window.initMDEditorDragResize(".editor__resize", this.commentMDEditor)
}
onCommit = () => {
const content = this.commentMDEditor.getValue();
// this.props.showError ==
if (this.props.showError == true) {
if (!content || content.trim() == "") {
this.setState({
isError: true,
errorMsg: '不能为空'
})
return;
} else if (content.length > 2000) {
this.setState({
isError: true,
errorMsg: '不能超过2000个字符'
})
return;
}
this.setState({
isError: false,
errorMsg: ''
})
}
window.$(document).trigger("onReply", { commentContent: content
, id: this.props.memo.id, editor: this.commentMDEditor } );
}
showEditor() {
$("html, body").animate({ scrollTop: $('#commentInput').offset().top - 100 }, 1000, () => {
if (this.commentMDEditor) {
this.commentMDEditor.cm.focus()
} else {
$('#commentInput input')[0].click()
}
});
}
onMockInputClick = () => {
this.setState({isInited: true})
this.initMDEditor()
}
render() {
const { match, history, memo, placeholder } = this.props
const { isInited, errorMsg } = this.state
if (!memo) {
return <div></div>
}
return (
<React.Fragment>
<style>{`
.mockInputWrapper {
display: flex;
padding: 30px;
}
.mockInputWrapper input {
flex:1;
padding-left: 10px;
height: 40px;
background: rgb(246,246,246);
margin-right: 20px;
}
.mockInputWrapper a.commentsbtn {
height: 40px;
display: inline-block;
margin-top: 0px !important;
vertical-align: text-top;
padding-top: 6px;
width: 60px;
margin-right: 0px !important;
}
#commentInput .editormd{
width:100%!important;
}
`}</style>
<div style={{ display: isInited ? 'none' : ''}} className="mockInputWrapper" id="commentInput">
<input onClick={this.onMockInputClick} placeholder={placeholder || '我要回复'}></input>
<a href="javascript:void(0)"
onClick={this.onMockInputClick} className="commentsbtn task-btn task-btn-blue">
发送
</a>
</div>
<div nhname={`new_message_${memo.id}`} className=""
style={{ padding: '30px',boxSizing:"border-box", display: isInited ? '' : 'none' }} id="commentInput">
<div id="memo_comment_editorMd" className="editorMD" style={{ marginBottom: '0px'
, border: errorMsg ? '1px solid red' : '1px solid #ddd'}}>
<textarea style={{'display': 'none'}}>
</textarea>
</div>
<div className="editor__resize" href="javascript:void(0);">调整高度</div>
{ errorMsg && <input className="fl" style={{color: 'red', marginTop: '6px',
marginLeft: '4px'}}>{errorMsg}</input> }
<a id={`new_message_submit_btn_${memo.id}`} href="javascript:void(0)"
onClick={this.onCommit} className="commentsbtn task-btn-blue task-btn fr ">
发送
</a>
</div>
</React.Fragment>
);
}
}
export default ( MemoDetailMDEditortwo );

@ -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,687 @@
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';
import Rightdialogue from './Rightdialogue'
import Leftdialogue from './Leftdialogue'
//私信聊天页面
class MessagChat extends Component{
constructor(props) {
super(props);
this.messageRef = React.createRef();
this.state={
isSpin:false,
isSpins:false,
limit:20,
page:1,
datay:[],
limits:20,
mess:false,
myuserl:[],
pages:1,
mypagey:20,
messages:[],
objc:[],
datanull:1,
}
}
componentDidMount(){
this.getdata(1);
const query = this.props.location.search;
let target_ids = query.split('?target_ids=');
this.getChatList(1,this.state.limits,target_ids[1]);
// console.log("MessagChat111111");
// console.log(this.props.myysluser);
this.setState({
myyslusers:this.props.myysluser
})
try {
this.props.Mtab(3);
}catch (e) {
}
// console.log("MessagChat111111");
// console.log(this.props);
// console.log(this.props.match.params.userid);
this.scrollToBottom();
}
componentDidUpdate() {
// this.scrollToBottom();
}
scrollToBottom() {
const scrollHeight = this.messageList.scrollHeight;
const height = this.messageList.clientHeight;
const maxScrollTop = scrollHeight - height;
this.messageList.scrollTop = maxScrollTop > 0 ? maxScrollTop : 0;
}
contentViewScrolltop=(e)=>{
if(e.currentTarget.scrollTop===0){
if(this.state.datanull===0){
return
}
console.log("调用了方法1111111");
let {pages}=this.state;
let newpage=pages+1
const query = this.props.location.search;
let target_ids = query.split('?target_ids=');
this.shuaxingetChatList(newpage,this.state.limits,target_ids[1],true);
this.messageList.scrollTop=50;
}
}
// 滑动刷新
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);
// let ls=newpage*20
// this.setState({
// limits:ls,
// })
}
//滑动到顶部
// 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("滑动到顶部判断");
//
// // let ls=newpage*20
// // this.setState({
// // limits:ls,
// // })
// }
};
shuaxingetChatList=(page,listl,target_ids,bool)=>{
this.setState({
isSpin:true,
});
let url = `/users/${this.props.match.params.userid}/private_message_details.json`;
axios.get((url),{params:{
target_id:target_ids,
page: page,
per_page:listl,
}}).then((result) => {
this.setState({
isSpin: false,
});
if (result) {
// if (result.data.status === 0) {
if (result.data !== null) {
if(result.data.messages.length===0){
console.log("没有数据了");
this.setState({
datanull:0,
})
return
}
var laoshuju=this.state.messages;
var datas = [];
var datay = result.data.messages;
datay = datay.reverse();
datay=datay.concat(laoshuju);
var obj = {};
for (var i = 0; i < datay.length; i++) {
if (i === 0) {
var timetwoy=datay[i].send_time.slice(0,10);
datay[i].send_day = timetwoy;
obj = datay[i];
datas.push(datay[i]);
} else {
try {
var timeone=obj.send_time.slice(0,10);
var timetwo=datay[i].send_time.slice(0,10);
if (moment(timeone).isSame(timetwo)) {
datay[i].send_day = "";
} else {
datay[i].send_day = timetwo;
obj = datay[i];
}
}catch (e) {
}
datas.push(datay[i]);
}
}
console.log("新数组+++++++++++++++++++++++++++++++++++++");
console.log(datas)
//颠倒数组
this.setState({
messages: datas,
myuserl: result.data.target,
pages:page,
})
// }
}
}
}).catch((error) => {
console.log(error);
this.setState({
isSpin:false,
})
})
};
getChatList=(page,listl,target_ids)=>{
this.setState({
isSpin:true,
});
let url = `/users/${this.props.match.params.userid}/private_message_details.json`;
axios.get((url),{params:{
target_id:target_ids,
page: page,
per_page:listl,
}}).then((result) => {
if (result) {
// if (result.data.status === 0) {
if (result.data !== null) {
var datas = [];
var datay = result.data.messages;
datay = datay.reverse();
var obj = {};
for (var i = 0; i < datay.length; i++) {
if (i === 0) {
var timetwoy=datay[i].send_time.slice(0,10);
datay[i].send_day = timetwoy;
obj = datay[i];
datas.push(datay[i]);
} else {
try {
var timeone=obj.send_time.slice(0,10);
var timetwo=datay[i].send_time.slice(0,10);
if (moment(timeone).isSame(timetwo)) {
datay[i].send_day = "";
} else {
datay[i].send_day = timetwo;
obj = datay[i];
}
}catch (e) {
}
datas.push(datay[i]);
}
}
//颠倒数组
this.setState({
messages: datas,
myuserl: result.data.target,
pages:page,
})
// }
this.scrollToBottom();
}
}
this.setState({
isSpin: false,
});
}).catch((error) => {
console.log(error);
this.setState({
isSpin:false,
})
})
};
getChatListtwo=(pages,listls,target_ids)=>{
this.setState({
isSpin:true,
});
let url = `/users/${this.props.match.params.userid}/private_message_details.json`;
axios.get((url),{params:{
target_id:target_ids,
page: pages,
per_page:listls,
}}).then((result) => {
if (result) {
// if (result.data.status === 0) {
if (result) {
// if (result.data.status === 0) {
if (result.data !== null) {
var datas = [];
var datay = result.data.messages;
datay = datay.reverse();
var obj = {};
for (var i = 0; i < datay.length; i++) {
if (i === 0) {
var timetwoy=datay[i].send_time.slice(0,10);
datay[i].send_day = timetwoy;
obj = datay[i];
datas.push(datay[i]);
} else {
try {
var timeone=obj.send_time.slice(0,10);
var timetwo=datay[i].send_time.slice(0,10);
if (moment(timeone).isSame(timetwo)) {
datay[i].send_day = "";
} else {
datay[i].send_day = timetwo;
obj = datay[i];
}
}catch (e) {
console.log("271271271271");
console.log(e);
}
datas.push(datay[i]);
}
}
//颠倒数组
this.setState({
messages: datas,
myuserl: result.data.target,
pages:pages,
datanull:1
})
this.scrollToBottom();
// }
}
}
}
this.setState({
isSpin: false,
});
}).catch((error) => {
console.log(error);
this.setState({
isSpin:false,
});
// this.getdatatwo(this.state.page);
})
};
//获取数据地方
getdata=(page)=>{
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) {
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: this.state.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,
})
})
};
//获取数据地方
getdatatwo=(page)=>{
let{limits}=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:limits,
}}).then((result) => {
if (result) {
// if(result.data.status===0){
this.setState({
page:page,
isSpins:false,
datay: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);
};
// 点击了用户
Clickedontheuser=(user)=>{
// debugger
// console.log("点击了用户");
// console.log(user);
// this.setState({
// myyslusers:user,
// mess:true,
// })
this.setState({
myuserl:user,
})
this.props.history.replace(`/message/${this.props.current_user.user_id}/message_detail?target_ids=${user.id}`);
// this.getdatatwo(this.state.page);
this.getChatListtwo(1,this.state.mypagey,user.id);
}
//回复
setreplyfun=()=>{
this.setState({
isSpin:true,
});
let contents=this.messageRef.current.getValue().trim();
const query = this.props.location.search;
let target_ids = query.split('?target_ids=');
let url = `/users/${this.props.match.params.userid}/private_messages.json`;
axios.post(url, {
target_id: target_ids[1],
content: contents
})
.then((response) => {
this.setState({
isSpin:false,
});
if(response===undefined){
return
}
if(response.data.status===0){
// console.log("回复成功");
// console.log(response);
// var datas=[];
// var dataso=this.state.messages;
// var datays=response.data.private_message;
// var obj={};
// for (var i=0;i<dataso.length;i++){
// if(i===0){
// obj=dataso[i];
// datas.push(dataso[i]);
// }else{
// if( moment(obj.send_day).isSame(dataso[i].send_day)){
// dataso[i].send_day="";
// }else {
// obj=dataso[i];
// }
// datas.push(dataso[i]);
// }
// }
this.getChatListtwo(1,this.state.mypagey,target_ids[1]);
// try {
// var time =dataso[dataso.length-1].send_time.slice(0,10);
// console.log(time);
// var timetwo=datays.send_time.slice(0,10);
// console.log(timetwo);
// if( moment(time).isSame(timetwo)){
// datays.send_day="";
// dataso.push(datays);
// }else {
// datays.send_day=timetwo;
// dataso.push(datays);
// }
// }catch (e) {
// console.log("回去出现错误");
// console.log(e);
// }
//
// //颠倒数组
// this.setState({
// messages: dataso,
//
// });
this.scrollToBottom();
this.messageRef.current.setValue('')
}
})
.catch(function (error) {
console.log(error);
this.setState({
isSpin:false,
});
});
};
//删除
DELETEsetreplyfun=(user_id,id)=>{
//user_id不用
// console.log("311");
this.setState({
isSpin:true,
});
let url = `/users/${this.props.match.params.userid}/private_messages/${id}.json`;
axios.delete(url)
.then((response) => {
if(response){
if(response.data.status===0){
if(this.state.messages.length>0){
for(var i=0;i<this.state.messages.length;i++){
if(parseInt(this.state.messages[i].id)===id){
this.state.messages.splice(i,1);
}
}
// setTimeout(()=>{
//
// }, 200);
this.setState({
messages:this.state.messages,
isSpin:false,
// datanull:1
})
// this.scrollToBottom()
}
}
}
})
.catch(function (error) {
console.log(error);
this.setState({
isSpin:false,
})
});
}
render() {
let{isSpins,datay,myyslusers,mess,limits,myuserl,messages,isSpin,datanull}=this.state;
// console.log(mess);
// console.log(myyslusers);
// console.log("MessagChat");
// console.log(this.state);
// console.log("112");
// console.log(limits);
// console.log(myuserl);
// console.log(messages);
return (
<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>
{myuserl!==undefined?myuserl.name:""}与你的私信
</p>
{/*聊天页面*/}
<div className="dialogPanel"
onScroll={this.contentViewScrolltop}
ref={(div) => {
this.messageList = div;
}}>
<div >
<Spin size="large" className="myw100baifenbi" spinning={isSpin}>
{
datanull===0?
<p className="mt30 edu-txt-center"><span className="letter-time">没有信息了</span></p>
:""
}
<div id="yslysl" >
{
messages===undefined?
""
:messages.map((item,key)=>{
// console.log("-----------------================-=-==-==");
// console.log(item.sender_id);
// console.log(this.props.match.params.userid);
return(
<div key={key}>
{
item.send_day===undefined?"":item.send_day===null?"":item.send_day===""?"":
<p className="mt30 edu-txt-center"><span className="letter-time">{item.send_day}</span></p>
}
{
parseInt(item.sender_id)===parseInt(this.props.match.params.userid)?
<Rightdialogue objeysl={item} {...this.state} {...this.props} DELETEsetreplyfun={(user_id,id)=>this.DELETEsetreplyfun(user_id,id)}>
{/*自己的*/}
</Rightdialogue>
:<Leftdialogue objeysl={item} {...this.state} {...this.props} DELETEsetreplyfun={(user_id,id)=>this.DELETEsetreplyfun(user_id,id)}>
{/*他人的*/}
</Leftdialogue>
}
</div>
)
})
}
</div>
</Spin>
</div>
</div>
{/*回复*/}
<div className="bor-top-greyE padding20">
<style>
{`
.rememberTip{
display:none;
}
`}
</style>
<TPMMDEditor ref={this.messageRef}
placeholder={'请输入您的回复'}
watch={false}
initValue={''}
mdID={'courseMessageMD'}
className="courseMessageMD"
height={200}
></TPMMDEditor>
<div className={"msheight30"}>
<span className="fl ml5 color-orange font-12">在问题反馈时请同时发送问题发生页的网址链接以便我们高效的为您服务</span>
<a className="fr task-btn task-btn-orange" onClick={()=>this.setreplyfun()}>回复</a>
</div>
</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" onScroll={this.contentViewScrolledit}>
{/*列表数据*/}
{
datay===undefined?
""
:datay.map((item,key)=>{
return(
<div className="private-part clearfix" key={key} onClick={(i)=>this.Clickedontheuser(item.target)}>
<div className="part-line df">
<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="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>
</div>
</div>
</div>
)
})}
</div>
</Spin>
</div>
</div>
</div>
)
}
}
export default MessagChat;
// onClick="delete_confirm_box('/users/innov/delete_message?mess_id=25137', '确定要删除该条记录吗?')"
//
// {/*左边*/}

@ -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:parseInt(data.unread_message_count),
unread_tiding_count:parseInt(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>
{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>
{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;

@ -0,0 +1,356 @@
import React, { Component } from 'react';
import { Modal,Input,Icon,Tooltip,Spin} from 'antd';
import axios from 'axios';
// import '../../modules/user/common.css';
import {getImageUrl} from 'educoder';
//完善个人资料
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:false,
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,result.data.private_message.receiver_id);
//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() {
let{Pleaseselectthesender,inputvulue,inputvulues,floatingboxdisplay,users,floatingboxdisplays,Recentcontacts,isSpin}=this.state;
//console.log(floatingboxdisplay);
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={getImageUrl("/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" key={key} onMouseDown={(c)=>this.Getuserinformation(item)}>
<img alt="1?1558048024" className="radius fl mr10 myimgw48 myimgh48" src={getImageUrl("/images/"+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 onClick={()=>this.HideModal()} className="pop_close task-btn mr30">取消</a>
<a 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;

@ -18,7 +18,7 @@ class DownloadMessage extends Component {
setDownload=()=>{
this.modalCancel();
window.open(`/users/${this.props.user.login}/message_detail?user_id=1`)
window.open(`/message/${this.props.user.login}/message_detail?target_ids=1`)
}
modalCancel = () => {
this.setState({

@ -11,7 +11,7 @@ class DownloadMessageysl extends Component {
setDownload=()=>{
this.props.modalCancel();
window.open(`/users/${this.props.user.login}/message_detail?user_id=1`)
window.open(`/message/${this.props.user.login}/message_detail?target_ids=1`)
}
render() {

@ -368,17 +368,20 @@ class MainContentContainer extends Component {
}
componentDidMount() {
window.$(window.documents).bind("submitChoose",function(){
alert("hello world!");
});
// if (this.binded == true) {
// return;
// } else {
// this.binded = true
// window.$(window).unload( ()=>{
// alert(111)
// var fileUpdatePromise = this.doFileUpdateRequest(true)
// });
// }
}
componentWillUnmount() {
// window.$(window).off( "unload" )
}
doFileUpdateRequestOnCodeMirrorBlur = () => {
var fileUpdatePromise = this.doFileUpdateRequest(true)

@ -293,8 +293,8 @@ class PackageIndexNEITaskDetails extends Component {
onMouseOver={this.setover}
onMouseOut={this.setout}
>
{overtype===false?<a className="ContacttheTA fl" target="_blank" href={`/users/${data&&data.creator.login}/message_detail?user_id=${data&&data.creator.id}`}> <img alt="头像" class="mr5" src={require('./newsone.png')} />联系TA</a>:
<a className="ContacttheTAs fl" target="_blank" href={`/users/${data&&data.creator.login}/message_detail?user_id=${data&&data.creator.id}`}> <img alt="头像" className="mr5"
{overtype===false?<a className="ContacttheTA fl" target="_blank" href={`/message/${data&&data.creator.login}/message_detail?target_ids=${data&&data.creator.id}`}> <img alt="头像" class="mr5" src={require('./newsone.png')} />联系TA</a>:
<a className="ContacttheTAs fl" target="_blank" href={`/message/${data&&data.creator.login}/message_detail?target_ids=${data&&data.creator.id}`}> <img alt="头像" className="mr5"
src={require('./newstwo.png')}/>联系TA</a>}
</div>}
</div>
@ -407,7 +407,7 @@ class PackageIndexNEITaskDetails extends Component {
{item.status==="bidding_won"?<img src={gouxuan} className="yslgouxuanimg"/>:""}
<a href={`/users/${item.login}`}><img className="div1imgs" src={getImageUrl("images/"+item.image_url)}/></a>
<div className="textall mt10" title={item.name}> <p className="ptext">{item.name}</p></div>
{this.props.current_user&&this.props.current_user.login!=item.login?<a className="ContacttheTAs fl none" target="_blank" href={`/users/${item.login}/message_detail?user_id=${item.id}`}>
{this.props.current_user&&this.props.current_user.login!=item.login?<a className="ContacttheTAs fl none" target="_blank" href={`/message/${item.login}/message_detail?target_ids=${item.id}`}>
<img alt="头像" className="mr5" src={require('./newstwo.png')}/>联系TA
</a>:""}
</div>

@ -934,7 +934,7 @@ submittojoinclass=(value)=>{
<div className="fl mr30 edu-menu-panel headIcon">
{ user===undefined?"":user.login===""?"": <a
href={this.props.Headertop===undefined?"":this.props.Headertop.message_url}
href={`/message/${user.user_id}/user_tidings`}
style={{position:'relative'}}
>
<i className="iconfont icon-xiaoxilingdang color-white"></i>

@ -264,7 +264,10 @@ export function TPMIndexHOC(WrappedComponent) {
"is_teacher": false,
"tidding_count": 0
}
*/
*/
if(response=== undefined){
return
}
if (response.data) {
this.initCommonState(response.data)
this.setState({

@ -357,7 +357,7 @@ class Infos extends Component{
:
<div className="inline">
<a href="javascript:void(0);" onClick={this.followPerson} className="user_default_btn user_watch_btn user_private_btn fl mr20">{followed ? "取消关注":"关注"}</a>
<a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${login}/message_detail?user_id=${id}`} className="user_default_btn user_private_btn fl">私信</a>
<a href={`${this.props.Headertop && this.props.Headertop.old_url}/message/${login}/message_detail?target_ids=${id}`} className="user_default_btn user_private_btn fl">私信</a>
</div>
}
</div>
@ -384,11 +384,11 @@ class Infos extends Component{
to={`/users/${username}/projects`}>项目</Link>
</li>
<li className={`${moduleName == 'package' ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'package'})}
to={`/users/${username}/package`}>众包</Link>
</li>
{/*<li className={`${moduleName == 'package' ? 'active' : '' }`}>*/}
{/*<Link*/}
{/*onClick={() => this.setState({moduleName: 'package'})}*/}
{/*to={`/users/${username}/package`}>众包</Link>*/}
{/*</li>*/}
{/*{ data && data.identity!="学生" && <li> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${username}?type=m_bank`}>题库</a></li>}*/}
@ -404,11 +404,11 @@ class Infos extends Component{
{/* 众包 */}
{/* http://localhost:3007/courses/1309/homework/9300/setting */}
<Route exact path="/users/:username/package"
render={
(props) => (<InfosPackage {...this.props} {...props} {...this.state} />)
}
></Route>
{/*<Route exact path="/users/:username/package"*/}
{/*render={*/}
{/*(props) => (<InfosPackage {...this.props} {...props} {...this.state} />)*/}
{/*}*/}
{/*></Route>*/}
{/* 课堂 */}
{/* http://localhost:3007/courses/1309/homework/9300/setting */}

@ -580,7 +580,7 @@ p .activity-item:first-child{border-top: 1px solid #eee;}
.recently_name{float: left;line-height: 48px;display: block}
.recently_item:hover{background-color: #F9F9F9;}
/*私信对话框*/
.private-list{min-height: 660px;max-height: 810px;overflow-y: auto;overflow-x: hidden;}
.private-list{min-height: 660px;max-height: 831px;overflow-y: auto;overflow-x: hidden;}
.private-list .private-part{padding-left:20px;cursor: pointer}
.private-part:hover{background-color: #F5F5F5;}
.private-part.active{background-color: #F5F5F5;}

Loading…
Cancel
Save