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' if source.class.to_s == 'User'
File.join(relative_path, ["#{source.class}", "#{source.id}"]) File.join(relative_path, ["#{source.class}", "#{source.id}"])
else else
File.join("images/avatars", ["#{source.class}", "#{source.id}"]) File.join("avatars", ["#{source.class}", "#{source.id}"])
end end
elsif source.class.to_s == 'User' elsif source.class.to_s == 'User'
str = source.user_extension.try(:gender).to_i == 0 ? "b" : "g" str = source.user_extension.try(:gender).to_i == 0 ? "b" : "g"
File.join(relative_path, "#{source.class}", str) File.join(relative_path, "#{source.class}", str)
elsif source.class.to_s == 'Subject' 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' 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
end end

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

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

@ -1,87 +1,87 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames' import classNames from 'classnames'
import axios from 'axios' import axios from 'axios'
class UserSection extends Component { class UserSection extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
} }
} }
/*点击关注或者取消关注*/ /*点击关注或者取消关注*/
AboutFocus(){ AboutFocus(){
const { author_info } = this.props const { author_info } = this.props
/*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/ /*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` // 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,{ // axios.get(focusUrl,{
// }) // })
// .then((response) => { // .then((response) => {
// const status = response.data.status; // const status = response.data.status;
// console.log(status); // console.log(status);
// if(status == 1){ // if(status == 1){
// const new_author_info = Object.assign({}, this.props.author_info) // const new_author_info = Object.assign({}, this.props.author_info)
// new_author_info.watched = !new_author_info.watched // new_author_info.watched = !new_author_info.watched
// this.props.initForumState({author_info: new_author_info}) // this.props.initForumState({author_info: new_author_info})
// } // }
// }).catch((error) => { // }).catch((error) => {
// console.log(error) // console.log(error)
// }) // })
let url=`/users/${author_info.user_id}/watch.json`; let url=`/users/${author_info.user_id}/watch.json`;
// 取消关注 // 取消关注
if(author_info.watched){ if(author_info.watched){
axios.delete(url).then((result)=>{ axios.delete(url).then((result)=>{
if(result){ if(result){
const new_author_info = Object.assign({}, this.props.author_info) const new_author_info = Object.assign({}, this.props.author_info)
new_author_info.watched = !new_author_info.watched new_author_info.watched = !new_author_info.watched
this.props.initForumState({author_info: new_author_info}) this.props.initForumState({author_info: new_author_info})
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
}) })
}else{ }else{
// 关注 // 关注
axios.post(url).then((result)=>{ axios.post(url).then((result)=>{
if(result){ if(result){
const new_author_info = Object.assign({}, this.props.author_info) const new_author_info = Object.assign({}, this.props.author_info)
new_author_info.watched = !new_author_info.watched new_author_info.watched = !new_author_info.watched
this.props.initForumState({author_info: new_author_info}) this.props.initForumState({author_info: new_author_info})
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
} }
render() { render() {
const { match, history, author_info , current_user } = this.props const { match, history, author_info , current_user } = this.props
if (!author_info || !current_user) { if (!author_info || !current_user) {
return <div className="edu-back-white" id="forum_index_list"></div> return <div className="edu-back-white" id="forum_index_list"></div>
} }
return ( return (
<div className="edu-back-white padding40-20 edu-txt-center"> <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> <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="font-20 userPrivateName">{author_info.username}</p>
<p className="color-grey-9 userPrivatePost">{author_info.identity}</p> <p className="color-grey-9 userPrivatePost">{author_info.identity}</p>
{ author_info.user_id !== current_user.user_id && { author_info.user_id !== current_user.user_id &&
<p className="clearfix mt30"> <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="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> <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> } </p> }
</div> </div>
); );
} }
} }
export default UserSection; export default UserSection;

@ -402,7 +402,7 @@ class MessagChat extends Component{
myuserl:user, 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.getdatatwo(this.state.page);
this.getChatListtwo(1,this.state.mypagey,user.id); this.getChatListtwo(1,this.state.mypagey,user.id);

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

@ -43,7 +43,8 @@ class Messagerouting extends Component{
// // courstype=courstype[3]; // // courstype=courstype[3];
// // console.log("45"); // // console.log("45");
// console.log(courstype); // 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(this.props);
// console.log("33333333333"); // console.log("33333333333");
if(prevProps.current_user !== this.props.current_user){ 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({ this.setState({
routing:value, routing:value,
}); });
this.Messageprivatemessageunreadmessage(this.props.current_user.user_id); this.Messageprivatemessageunreadmessage(this.props.current_user.login);
if(value===1){ 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); this.homeworkendss1(child);
} }
if(value===2){ 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); this.homeworkendss2(child);
} }
@ -114,10 +117,10 @@ class Messagerouting extends Component{
routing:i, routing:i,
}); });
if(i===1){ 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){ 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 { }else {
@ -125,7 +128,7 @@ class Messagerouting extends Component{
routing:i, routing:i,
}); });
console.log("22222222222"); 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(child);
// // console.log(this.refs.childModel); // // console.log(this.refs.childModel);
// console.log(child); // console.log(child);
child.getdatas(); try {
child.getdatas();
}catch (e) {
}
// //
} }
homeworkendss2(child){ homeworkendss2(child){
// console.log(child); // console.log(child);
// // console.log(this.refs.childModel); // // console.log(this.refs.childModel);
// console.log(child); // console.log(child);
child.getdatas2(); try {
child.getdatas2();
}catch (e) {
}
// //
} }
render() { render() {
@ -215,19 +228,19 @@ class Messagerouting extends Component{
<Switch> <Switch>
{/*/!*消息自路由*! name 是 /message/info/:userid/*/} {/*/!*消息自路由*! name 是 /message/info/:userid/*/}
<Route path="/message/:userid/user_tidings" <Route path="/messages/:userid/user_tidings"
render={ render={
(props) => (<MessagSub triggerRef={this.bindRef} {...this.state} {...this.props} {...props} Message2={()=>this.Message2()} Mtab={(i)=>this.myxiaoxisixintab(i)}></MessagSub>) (props) => (<MessagSub triggerRef={this.bindRef} {...this.state} {...this.props} {...props} Message2={()=>this.Message2()} Mtab={(i)=>this.myxiaoxisixintab(i)}></MessagSub>)
} }
></Route> ></Route>
{/*/!*私信*! name 是letter/*/} {/*/!*私信*! name 是letter/*/}
<Route path="/message/:userid/private_messages" <Route path="/messages/:userid/private_messages"
render={ 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> ) (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> ></Route>
{/*/!*私信聊天页面*! letters/*/} {/*/!*私信聊天页面*! letters/*/}
<Route path="/message/:userid/message_detail" <Route path="/messages/:userid/message_detail"
render={ 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>) (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=()=>{ setDownload=()=>{
this.modalCancel(); 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 = () => { modalCancel = () => {
this.setState({ this.setState({

@ -11,7 +11,7 @@ class DownloadMessageysl extends Component {
setDownload=()=>{ setDownload=()=>{
this.props.modalCancel(); 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() { render() {

@ -297,8 +297,8 @@ class PackageIndexNEITaskDetails extends Component {
onMouseOver={this.setover} onMouseOver={this.setover}
onMouseOut={this.setout} 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>: {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={`/message/${this.props.current_user&&this.props.current_user.user_id}/message_detail?target_ids=${data&&data.creator.id}`}> <img alt="头像" className="mr5" <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>} src={require('./newstwo.png')}/>联系TA</a>}
</div>} </div>}
</div> </div>
@ -411,7 +411,7 @@ class PackageIndexNEITaskDetails extends Component {
{item.status==="bidding_won"?<img src={gouxuan} className="yslgouxuanimg"/>:""} {item.status==="bidding_won"?<img src={gouxuan} className="yslgouxuanimg"/>:""}
<a href={`/users/${item.login}`}><img className="div1imgs" src={getImageUrl("images/"+item.image_url)}/></a> <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> <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 <img alt="头像" className="mr5" src={require('./newstwo.png')}/>联系TA
</a>:""} </a>:""}
</div> </div>

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

@ -357,7 +357,7 @@ class Infos extends Component{
: :
<div className="inline"> <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="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>
} }
</div> </div>

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

Loading…
Cancel
Save