Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_cs_new
hjm 6 years ago
commit 7192422b39

@ -130,15 +130,15 @@ module ApplicationHelper
if source.class.to_s == 'User'
File.join(relative_path, ["#{source.class}", "#{source.id}"])
else
File.join("images/avatars", ["#{source.class}", "#{source.id}"])
File.join("avatars", ["#{source.class}", "#{source.id}"])
end
elsif source.class.to_s == 'User'
str = source.user_extension.try(:gender).to_i == 0 ? "b" : "g"
File.join(relative_path, "#{source.class}", str)
elsif source.class.to_s == 'Subject'
File.join("images","educoder", "index", "subject", "subject#{rand(17)}.jpg")
File.join("educoder", "index", "subject", "subject#{rand(17)}.jpg")
elsif source.class.to_s == 'Shixun'
File.join("images","educoder", "index", "shixun", "shixun#{rand(23)}.jpg")
File.join("educoder","index", "shixun", "shixun#{rand(23)}.jpg")
end
end

@ -9,16 +9,15 @@ class Tiding < ApplicationRecord
def identifier
value = nil
if Object.const_defined?(container_type)
value = container.try(:identifier)
end
if value.blank? && parent_container_type && Object.const_defined?(parent_container_type)
value = parent_container_type.try(:identifier)
value = container.try(:identifier) rescue nil
if value.blank? && parent_container_type
value = parent_container_type.try(:identifier) rescue nil
end
if value.blank? && belong_container_type && Object.const_defined?(belong_container_type)
value = belong_container.try(:identifier)
if value.blank? && belong_container_type
value = belong_container.try(:identifier) rescue nil
end
value

@ -365,7 +365,7 @@ class App extends Component {
<Route path="/testCodeMirror" component={TestCodeMirrorComponent}/>
<Route path="/testRCComponent" component={TestComponent}/>
<Route path="/testUrlQuery" component={TestUrlQueryComponent}/>
<Route path="/message"
<Route path="/messages"
render={
(props)=>(<Messagerouting {...this.props} {...props} {...this.state}></Messagerouting>)
}

@ -1,87 +1,87 @@
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)
// })
let url=`/users/${author_info.user_id}/watch.json`;
// 取消关注
if(author_info.watched){
axios.delete(url).then((result)=>{
if(result){
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)
})
}else{
// 关注
axios.post(url).then((result)=>{
if(result){
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 || !current_user) {
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)
// })
let url=`/users/${author_info.user_id}/watch.json`;
// 取消关注
if(author_info.watched){
axios.delete(url).then((result)=>{
if(result){
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)
})
}else{
// 关注
axios.post(url).then((result)=>{
if(result){
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 || !current_user) {
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={`/messages/${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;

@ -402,7 +402,7 @@ class MessagChat extends Component{
myuserl:user,
})
this.props.history.replace(`/message/${this.props.current_user.user_id}/message_detail?target_ids=${user.id}`);
this.props.history.replace(`/messages/${this.props.current_user.login}/message_detail?target_ids=${user.id}`);
// this.getdatatwo(this.state.page);
this.getChatListtwo(1,this.state.mypagey,user.id);

@ -200,7 +200,7 @@ class MessagSub extends Component{
// 课堂详情页 :id = container_id
return window.location.href=`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`;
case "Shixun" :
return window.location.href=`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`;
return window.location.href=`/shixuns/${item.identifier}/challenges`;
case "Subject" :
// 实践课程详情页 :id = container_id
return window.location.href=`/paths/${item.identifier}`;

@ -43,7 +43,8 @@ class Messagerouting extends Component{
// // courstype=courstype[3];
// // console.log("45");
// console.log(courstype);
// console.log("Messagerouting46");
// console.log(this.props.current_user);
}
@ -54,7 +55,9 @@ class Messagerouting extends Component{
// console.log(this.props);
// console.log("33333333333");
if(prevProps.current_user !== this.props.current_user){
this.Messageprivatemessageunreadmessage(this.props.current_user.user_id);
this.Messageprivatemessageunreadmessage(this.props.current_user.login);
// console.log("Messagerouting59");
// console.log(this.props.current_user);
}
}
//消息未读
@ -79,13 +82,13 @@ class Messagerouting extends Component{
this.setState({
routing:value,
});
this.Messageprivatemessageunreadmessage(this.props.current_user.user_id);
this.Messageprivatemessageunreadmessage(this.props.current_user.login);
if(value===1){
this.props.history.replace(`/message/${this.props.current_user.user_id}/user_tidings`);
this.props.history.replace(`/messages/${this.props.current_user.login}/user_tidings`);
this.homeworkendss1(child);
}
if(value===2){
this.props.history.replace(`/message/${this.props.current_user.user_id}/private_messages`);
this.props.history.replace(`/messages/${this.props.current_user.login}/private_messages`);
this.homeworkendss2(child);
}
@ -114,10 +117,10 @@ class Messagerouting extends Component{
routing:i,
});
if(i===1){
this.props.history.replace(`/message/${this.props.current_user.user_id}/user_tidings`);
this.props.history.replace(`/messages/${this.props.current_user.login}/user_tidings`);
}
if(i===2){
this.props.history.replace(`/message/${this.props.current_user.user_id}/private_messages`);
this.props.history.replace(`/messages/${this.props.current_user.login}/private_messages`);
}
}else {
@ -125,7 +128,7 @@ class Messagerouting extends Component{
routing:i,
});
console.log("22222222222");
this.props.history.replace(`/message/${this.props.current_user.user_id}/message_detail?target_ids=${id}`);
this.props.history.replace(`/messages/${this.props.current_user.login}/message_detail?target_ids=${id}`);
}
};
@ -156,14 +159,24 @@ class Messagerouting extends Component{
// console.log(child);
// // console.log(this.refs.childModel);
// console.log(child);
child.getdatas();
try {
child.getdatas();
}catch (e) {
}
//
}
homeworkendss2(child){
// console.log(child);
// // console.log(this.refs.childModel);
// console.log(child);
child.getdatas2();
try {
child.getdatas2();
}catch (e) {
}
//
}
render() {
@ -215,19 +228,19 @@ class Messagerouting extends Component{
<Switch>
{/*/!*消息自路由*! name 是 /message/info/:userid/*/}
<Route path="/message/:userid/user_tidings"
<Route path="/messages/:userid/user_tidings"
render={
(props) => (<MessagSub triggerRef={this.bindRef} {...this.state} {...this.props} {...props} Message2={()=>this.Message2()} Mtab={(i)=>this.myxiaoxisixintab(i)}></MessagSub>)
}
></Route>
{/*/!*私信*! name 是letter/*/}
<Route path="/message/:userid/private_messages"
<Route path="/messages/:userid/private_messages"
render={
(props) => (<MessagePrivate triggerRef={this.bindRef} {...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"
<Route path="/messages/:userid/message_detail"
render={
(props) => (<MessagChat triggerRef={this.bindRef} {...this.state} {...this.props} {...props} Message2={()=>this.Message2()} Modifyur={(i)=>this.Modifyur(i)} Mtab={(i)=>this.myxiaoxisixintab(i)}></MessagChat>)
}

@ -18,7 +18,7 @@ class DownloadMessage extends Component {
setDownload=()=>{
this.modalCancel();
window.open(`/message/${this.props.user.login}/message_detail?target_ids=1`)
window.open(`/messages/${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(`/message/${this.props.user.login}/message_detail?target_ids=1`)
window.open(`/messages/${this.props.user.login}/message_detail?target_ids=1`)
}
render() {

@ -297,8 +297,8 @@ class PackageIndexNEITaskDetails extends Component {
onMouseOver={this.setover}
onMouseOut={this.setout}
>
{overtype===false?<a className="ContacttheTA fl" target="_blank" href={`/message/${this.props.current_user&&this.props.current_user.user_id}/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/${this.props.current_user&&this.props.current_user.user_id}/message_detail?target_ids=${data&&data.creator.id}`}> <img alt="头像" className="mr5"
{overtype===false?<a className="ContacttheTA fl" target="_blank" href={`/messages/${this.props.current_user&&this.props.current_user.login}/message_detail?target_ids=${data&&data.creator.login}`}> <img alt="头像" class="mr5" src={require('./newsone.png')} />联系TA</a>:
<a className="ContacttheTAs fl" target="_blank" href={`/messages/${this.props.current_user&&this.props.current_user.login}/message_detail?target_ids=${data&&data.creator.login}`}> <img alt="头像" className="mr5"
src={require('./newstwo.png')}/>联系TA</a>}
</div>}
</div>
@ -411,7 +411,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={`/message/${this.props.current_user&&this.props.current_user.user_id}/message_detail?target_ids=${item.id}`}>
{this.props.current_user&&this.props.current_user.login!=item.login?<a className="ContacttheTAs fl none" target="_blank" href={`/messages/${this.props.current_user&&this.props.current_user.login}/message_detail?target_ids=${item.login}`}>
<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={`/message/${user.user_id}/user_tidings`}
href={`/messages/${user.login}/user_tidings`}
style={{position:'relative'}}
>
<i className="iconfont icon-xiaoxilingdang color-white"></i>

@ -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}/message/${login}/message_detail?target_ids=${id}`} className="user_default_btn user_private_btn fl">私信</a>
<a href={`${this.props.Headertop && this.props.Headertop.old_url}/messages/${login}/message_detail?target_ids=${id}`} className="user_default_btn user_private_btn fl">私信</a>
</div>
}
</div>

@ -132,18 +132,19 @@ class InfosPackage extends Component{
delectproject=(id)=>{
let {cate,status}=this.state;
let {category,status}=this.state;
debugger
let url=`/project_packages/${id}.json`
axios.delete(url).then((response) => {
if (response.data.status == 0) {
this.getCourses(cate,status,1);
this.getCourses(category,status,1);
}
})
.catch(function (error) {
console.log(error);
});
this.cancelProject;
this.cancelProject();
}
render(){
let{

Loading…
Cancel
Save