关注和取消关注

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

View File

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

View File

@ -5,7 +5,7 @@ import { Button } from "antd";
import "./list.css";
class UserList extends Component {
renderList = (users, userClass, current_user, type_title) => {
renderList = (users, userClass, current_user, type_title , successFunc) => {
if (users && users.length > 0) {
return users.map((item, key) => {
return (
@ -40,7 +40,7 @@ class UserList extends Component {
current_user && current_user.login === item.login ?
<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>
@ -50,9 +50,9 @@ class UserList extends Component {
}
}
render() {
const { users, userClass, current_user , type_title } = this.props;
const { users, userClass, current_user , type_title , successFunc } = this.props;
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}>
<div className="pd20 minH-670">
<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">
<Search
placeholder="输入名称进行搜索"
@ -103,7 +103,7 @@ class CommonList extends Component {
{users && users.length > 0 ? (
<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>
) : (
<Nodata _html={`暂时没有数据~`} />

View File

@ -5,8 +5,8 @@ class WatcherUsers extends Component {
const {user, current_user} = this.props
return (
<div className="minH-650">
{user && user.login && <CommonLists userType="watchers" login={user.login} current_user={current_user} />}
</div>
{user && user.login && <CommonLists userType="watchers" login={user.login} current_user={current_user} />}
</div>
);
}
}