diff --git a/src/config/env.js b/src/config/env.js index 1966efe..010b90b 100644 --- a/src/config/env.js +++ b/src/config/env.js @@ -7,8 +7,8 @@ export const ENV_PROD = "prod"; const dev = { env: ENV_DEV, // BASE_URL: 'http://192.168.1.41:8080', - BASE_URL: 'http://47.94.97.168:8080', - // BASE_URL: 'http://127.0.0.1:8080', + // BASE_URL: 'http://47.94.97.168:8080', + BASE_URL: 'http://127.0.0.1:8080', }; const product = { diff --git a/src/pages/mineHomePage/fansOrAttention/fansOrAttention.jsx b/src/pages/mineHomePage/fansOrAttention/fansOrAttention.jsx index 083c280..953a02c 100644 --- a/src/pages/mineHomePage/fansOrAttention/fansOrAttention.jsx +++ b/src/pages/mineHomePage/fansOrAttention/fansOrAttention.jsx @@ -74,7 +74,7 @@ export default class FansOrAttention extends Component{ return {this.redirectToPerson(item.id, item.avatar, item.name)} } className='list'> {"头像"}/ {item.name} - {type===1?取消关注:null} + {type===1?取消关注:null} }) } diff --git a/src/pages/mineHomePage/mineHomePage.jsx b/src/pages/mineHomePage/mineHomePage.jsx index c90a084..687f75e 100644 --- a/src/pages/mineHomePage/mineHomePage.jsx +++ b/src/pages/mineHomePage/mineHomePage.jsx @@ -19,6 +19,8 @@ export default class MineHomePage extends Component{ nickName: '', fans: 0, follow: 0, + isFollowing: false, + followList: [], habitNumber: 0, bigIndex: 0, recordList: [], @@ -45,13 +47,44 @@ export default class MineHomePage extends Component{ habitNumber: res.data.total, }); }); + // myFollowing({ + // userId: this.state.userId, + // }).then( res => { + // that.setState({ + // followList: res.data, + // follow: res.data.length, + // }); + // res.data.map( (item) => { + // if( item.id === this.state.userId){ + // that.setState({ + // isFollowing: true + // }); + // } + // }); + // console.log('followList1',res.data); + // console.log('followList2',this.state.followList); + // }); + // followedMe({ + // userId: this.state.userId, + // }).then( res => { + // that.setState({ + // fans: res.data.length, + // }); + // }); + // console.log('isFollowing:',this.state.isFollowing) + } + + componentDidMount() { + let that = this; myFollowing({ userId: this.state.userId, }).then( res => { that.setState({ + followList: res.data, follow: res.data.length, }); - console.log('res',res); + console.log('followList1',res.data); + console.log('followList2',this.state.followList); }); followedMe({ userId: this.state.userId, @@ -60,7 +93,15 @@ export default class MineHomePage extends Component{ fans: res.data.length, }); console.log('res',res); - }) + }); + this.state.followList.map( (item) => { + if( item.id === this.state.userId){ + this.setState({ + isFollowing: true + }); + } + }); + console.log('isFollowing:',this.state.isFollowing) } selectBook(index){ @@ -161,6 +202,7 @@ export default class MineHomePage extends Component{ 粉丝 {fans} 关注 {follow} + {/*关注TA*/} {habitNumber === 0 ? 快去加入习惯吧! :