|
@@ -27,24 +27,30 @@ import user from "./services/user";
|
|
|
|
|
|
export default class userCenter extends BasePage {
|
|
|
componentDidMount() {
|
|
|
- console.log(4444);
|
|
|
- user.userMember().then(res => {
|
|
|
- console.log("个人列表", res);
|
|
|
- // 收藏
|
|
|
- const favoritesList = res.data.favoritesList;
|
|
|
- //观看记录
|
|
|
- const playLogList = res.data.playLogList;
|
|
|
- // 用户消息
|
|
|
- const user = res.data.user;
|
|
|
- // VIP
|
|
|
- const vip = res.data.vip;
|
|
|
- this.setState({
|
|
|
- favoritesList,
|
|
|
- playLogList,
|
|
|
- user,
|
|
|
- vip
|
|
|
+ //触发更新
|
|
|
+ this.refreshSubScription = DeviceEventEmitter.addListener('infoback', () => {
|
|
|
+ user.userMember().then(res => {
|
|
|
+ console.log("个人列表", res);
|
|
|
+ // 收藏
|
|
|
+ const favoritesList = res.data.favoritesList;
|
|
|
+ //观看记录
|
|
|
+ const playLogList = res.data.playLogList;
|
|
|
+ // 用户消息
|
|
|
+ const user = res.data.user;
|
|
|
+ // VIP
|
|
|
+ const vip = res.data.vip;
|
|
|
+ this.setState({
|
|
|
+ favoritesList,
|
|
|
+ playLogList,
|
|
|
+ user,
|
|
|
+ vip
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
+ })
|
|
|
+ DeviceEventEmitter.emit('infoback')
|
|
|
+ }
|
|
|
+ componentWillUnmount(){
|
|
|
+ this.refreshSubScription.remove();
|
|
|
}
|
|
|
state = {
|
|
|
nickName: "初始昵称",
|
|
@@ -144,7 +150,7 @@ export default class userCenter extends BasePage {
|
|
|
/>
|
|
|
</View>
|
|
|
<View style={styles.userInfo}>
|
|
|
- <TouchableOpacity onPress={this.setInfo.bind(this)}>
|
|
|
+ <TouchableOpacity onPress={() => this.goTo(`PersonalInfo`)}>
|
|
|
<Image
|
|
|
style={styles.userAvatar}
|
|
|
source={{ uri: this.state.user.avatar }}
|
|
@@ -208,32 +214,6 @@ export default class userCenter extends BasePage {
|
|
|
goTo(index) {
|
|
|
this.toNextPage(index);
|
|
|
}
|
|
|
-
|
|
|
- setInfo() {
|
|
|
- this.props.navigation.navigate("PersonalInfo", {
|
|
|
- infoback: this.infoback.bind(this)
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- infoback() {
|
|
|
- user.userMember().then(res => {
|
|
|
- console.log("个人列表", res);
|
|
|
- // 收藏
|
|
|
- const favoritesList = res.data.favoritesList;
|
|
|
- //观看记录
|
|
|
- const playLogList = res.data.playLogList;
|
|
|
- // 用户消息
|
|
|
- const user = res.data.user;
|
|
|
- // VIP
|
|
|
- const vip = res.data.vip;
|
|
|
- this.setState({
|
|
|
- favoritesList,
|
|
|
- playLogList,
|
|
|
- user,
|
|
|
- vip
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
const styles = StyleSheet.create({
|