关注和取消关注

This commit is contained in:
caishi 2021-02-25 14:08:35 +08:00
parent 2ceaead909
commit 19f66b0bcc
5 changed files with 13 additions and 13 deletions

View File

@ -16,7 +16,7 @@ const Img = styled.img`{
height:30px; height:30px;
border-radius:50%; border-radius:50%;
}` }`
const limit = 15 const limit = 15;
export default ((props) => { export default ((props) => {
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const [total, setTotal] = useState(0); const [total, setTotal] = useState(0);
@ -58,9 +58,9 @@ export default ((props) => {
axios.delete(url) axios.delete(url)
.then((result) => { .then((result) => {
if (result && result.data) { if (result && result.data) {
setPage(1) setPage(1);
setQuery(undefined) setQuery(undefined);
setIdentify(undefined) setIdentify(undefined);
getMember(); getMember();
} }
}) })

View File

@ -93,7 +93,7 @@ class CommonUsers extends Component {
{count === 0 ? ( {count === 0 ? (
<NoneData _html="暂时还没有相关数据!" /> <NoneData _html="暂时还没有相关数据!" />
) : ( ) : (
<UserList users={users} userClass={'w-25'} {...this.props}></UserList> <UserList users={users} userClass={'w-25'} successFunc={this.getUsersList} {...this.props}></UserList>
)} )}
</div> </div>
</Spin> </Spin>

View File

@ -5,7 +5,7 @@ import { Button } from "antd";
import "./list.css"; import "./list.css";
class UserList extends Component { class UserList extends Component {
renderList = (users, userClass, current_user, type_title) => { renderList = (users, userClass, current_user, type_title , successFunc) => {
if (users && users.length > 0) { if (users && users.length > 0) {
return users.map((item, key) => { return users.map((item, key) => {
return ( return (
@ -40,7 +40,7 @@ class UserList extends Component {
current_user && current_user.login === item.login ? current_user && current_user.login === item.login ?
<Button type="default">当前用户</Button> <Button type="default">当前用户</Button>
: :
<FocusButton is_watch={item.is_watch} id={item.login} /> <FocusButton is_watch={item.is_watch} id={item.login} successFunc={successFunc}/>
} }
</div> </div>
</div> </div>
@ -50,9 +50,9 @@ class UserList extends Component {
} }
} }
render() { render() {
const { users, userClass, current_user , type_title } = this.props; const { users, userClass, current_user , type_title , successFunc } = this.props;
return ( return (
this.renderList(users, userClass, current_user, type_title) this.renderList(users, userClass, current_user, type_title , successFunc)
); );
} }
} }

View File

@ -87,7 +87,7 @@ class CommonList extends Component {
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
<div className="pd20 minH-670"> <div className="pd20 minH-670">
<div className="grid-item pb20 bbt"> <div className="grid-item pb20 bbt">
<h3>{userType === "watchers" ? `${title_type}关注的` : `关注${title_type}`}</h3> <h3 style={{marginBottom:"0px"}}>{userType === "watchers" ? `${title_type}关注的` : `关注${title_type}`}</h3>
<div className="text-right"> <div className="text-right">
<Search <Search
placeholder="输入名称进行搜索" placeholder="输入名称进行搜索"
@ -103,7 +103,7 @@ class CommonList extends Component {
{users && users.length > 0 ? ( {users && users.length > 0 ? (
<div className="w-100 inline-block"> <div className="w-100 inline-block">
<UserList users={users} userClass={"w-33"} current_user={current_user}></UserList> <UserList users={users} userClass={"w-33"} current_user={current_user} successFunc={this.get_watchers}></UserList>
</div> </div>
) : ( ) : (
<Nodata _html={`暂时没有数据~`} /> <Nodata _html={`暂时没有数据~`} />