Merge branch 'dev_Ysl' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysl
commit
e119f8195b
@ -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;
|
||||
|
@ -1,93 +1,97 @@
|
||||
.navInfo{
|
||||
border:none!important;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: -8px;
|
||||
}
|
||||
.navInfo li {
|
||||
float: left;
|
||||
margin: 0px 40px;
|
||||
padding:0px;
|
||||
height: 45px;
|
||||
line-height: 40px;
|
||||
font-size: 16px;
|
||||
position: relative;
|
||||
}
|
||||
.navInfo li.active::after{
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
height: 2px;
|
||||
width: 100%;
|
||||
content: '';
|
||||
bottom: 0px;
|
||||
background: #05101A!important;
|
||||
color: #666!important;
|
||||
}
|
||||
.navInfo li,.navInfo li.ant-menu-item-active{
|
||||
border-bottom: none!important;
|
||||
color: #666!important;
|
||||
}
|
||||
.navInfo li.ant-menu-item-selected{
|
||||
border-bottom: 2px solid #05101A!important;
|
||||
color: #05101A!important;
|
||||
}
|
||||
.navInfo ul.ant-menu{float: left!important;border:none!important;}
|
||||
|
||||
.substancenenew{
|
||||
width: 236px;
|
||||
height: 206px;
|
||||
background: rgba(248,248,248,1);
|
||||
border: 2px dotted rgba(225,225,225,1);
|
||||
opacity: 1;
|
||||
border-radius: 4px;
|
||||
padding-top: 50px;
|
||||
position: inherit;
|
||||
}
|
||||
|
||||
.substancepad{
|
||||
padding: 20px 20px 0px 20px;
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
.substancefont{
|
||||
height:24px;
|
||||
font-size:18px;
|
||||
font-family:Microsoft YaHei;
|
||||
font-weight:400;
|
||||
line-height:21px;
|
||||
color:rgba(153,153,153,1);
|
||||
opacity:1;
|
||||
margin-top: -8px;
|
||||
}
|
||||
.topten{
|
||||
width: 1px;
|
||||
height: 100px;
|
||||
border: 2px soild rgba(225,225,225,1);
|
||||
background: rgba(225,225,225,1);
|
||||
border: 1px solid rgba(225,225,225,1);
|
||||
margin: 0 auto;
|
||||
}
|
||||
.leftten{
|
||||
width: 100px;
|
||||
height: 1px;
|
||||
background: rgba(225,225,225,1);
|
||||
border: 1px solid rgba(225,225,225,1);
|
||||
margin: 0px auto;
|
||||
position: absolute;
|
||||
top: 120px;
|
||||
left: 88px;
|
||||
}
|
||||
.squarebox{
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
/*题库的标签--和资源标签样式相似*/
|
||||
.bankTag{max-height: 82px;overflow-y: auto}
|
||||
.bankTag #sourceTag li{margin-left: 0px;margin-right: 5px;}
|
||||
.bank_list_Tag{cursor: default}
|
||||
/*资源标签*/
|
||||
#sourceTag li,.bank_list_Tag{font-size: 12px;color: #4E7A9B;background-color: #E5F3FF;padding: 0px 4px;height: 20px;line-height: 20px; margin-left: 5px;display: inline-block;cursor: pointer;margin-bottom: 5px;}
|
||||
#sourceTag li a{color: #4e7a9b!important;}
|
||||
#sourceTag li.active{background-color: #4CACFF;color: #fff;}
|
||||
#sourceTag li.active a{background-color: #4CACFF;color: #fff!important;}
|
||||
.navInfo{
|
||||
border:none!important;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: -8px;
|
||||
}
|
||||
.navInfo li {
|
||||
float: left;
|
||||
margin: 0px 40px;
|
||||
padding:0px;
|
||||
height: 45px;
|
||||
line-height: 40px;
|
||||
font-size: 16px;
|
||||
position: relative;
|
||||
}
|
||||
.navInfo li.active::after{
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
height: 2px;
|
||||
width: 100%;
|
||||
content: '';
|
||||
bottom: 0px;
|
||||
background: #05101A!important;
|
||||
color: #666!important;
|
||||
}
|
||||
.navInfo li,.navInfo li.ant-menu-item-active{
|
||||
border-bottom: none!important;
|
||||
color: #666!important;
|
||||
}
|
||||
.navInfo li.ant-menu-item-selected{
|
||||
border-bottom: 2px solid #05101A!important;
|
||||
color: #05101A!important;
|
||||
}
|
||||
.navInfo ul.ant-menu{float: left!important;border:none!important;}
|
||||
|
||||
.substancenenew{
|
||||
width: 236px;
|
||||
height: 206px;
|
||||
background: rgba(248,248,248,1);
|
||||
border: 2px dotted rgba(225,225,225,1);
|
||||
opacity: 1;
|
||||
border-radius: 4px;
|
||||
padding-top: 50px;
|
||||
position: inherit;
|
||||
}
|
||||
|
||||
.substancepad{
|
||||
padding: 20px 20px 0px 20px;
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
.substancefont{
|
||||
height:24px;
|
||||
font-size:18px;
|
||||
font-family:Microsoft YaHei;
|
||||
font-weight:400;
|
||||
line-height:21px;
|
||||
color:rgba(153,153,153,1);
|
||||
opacity:1;
|
||||
margin-top: -8px;
|
||||
}
|
||||
.topten{
|
||||
width: 1px;
|
||||
height: 100px;
|
||||
border: 2px soild rgba(225,225,225,1);
|
||||
background: rgba(225,225,225,1);
|
||||
border: 1px solid rgba(225,225,225,1);
|
||||
margin: 0 auto;
|
||||
}
|
||||
.leftten{
|
||||
width: 100px;
|
||||
height: 1px;
|
||||
background: rgba(225,225,225,1);
|
||||
border: 1px solid rgba(225,225,225,1);
|
||||
margin: 0px auto;
|
||||
position: absolute;
|
||||
top: 120px;
|
||||
left: 88px;
|
||||
}
|
||||
.squarebox{
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
/*题库的标签--和资源标签样式相似*/
|
||||
.bankTag{max-height: 82px;overflow-y: auto}
|
||||
.bankTag #sourceTag li{margin-left: 0px;margin-right: 5px;}
|
||||
.bank_list_Tag{cursor: default}
|
||||
/*资源标签*/
|
||||
#sourceTag li,.bank_list_Tag{font-size: 12px;color: #4E7A9B;background-color: #E5F3FF;padding: 0px 4px;height: 20px;line-height: 20px; margin-left: 5px;display: inline-block;cursor: pointer;margin-bottom: 5px;}
|
||||
#sourceTag li a{color: #4e7a9b!important;}
|
||||
#sourceTag li.active{background-color: #4CACFF;color: #fff;}
|
||||
#sourceTag li.active a{background-color: #4CACFF;color: #fff!important;}
|
||||
|
||||
.mtf15{
|
||||
margin-top:-15px;
|
||||
}
|
Loading…
Reference in new issue