|
@@ -18,7 +18,8 @@ import {
|
|
|
ImageBackground,
|
|
|
TextInput,
|
|
|
Animated,
|
|
|
- StatusBar
|
|
|
+ StatusBar,
|
|
|
+ DeviceEventEmitter
|
|
|
} from 'react-native';
|
|
|
import BasePage from '../BasePage';
|
|
|
import Header from './Header';
|
|
@@ -46,6 +47,7 @@ export default class MainPage extends BasePage {
|
|
|
// }).fail(() => {
|
|
|
// alert(1111)
|
|
|
// })
|
|
|
+ // 触发更新
|
|
|
LibraryUrl.getIndex(index).then((res) => {
|
|
|
console.log(res);
|
|
|
const monthTopicTitle = res.data.monthTopic.zone.title;
|
|
@@ -78,7 +80,9 @@ export default class MainPage extends BasePage {
|
|
|
console.log(this.state.banner);
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+ componentWillUnmount() {
|
|
|
+ this.refreshSubScription.remove();
|
|
|
+ }
|
|
|
state = {
|
|
|
grade: '大学',
|
|
|
ifGradeMenuShow: false,
|
|
@@ -121,7 +125,10 @@ export default class MainPage extends BasePage {
|
|
|
};
|
|
|
|
|
|
componentWillMount() {
|
|
|
- this.getUserInfo();
|
|
|
+ this.refreshSubScription = DeviceEventEmitter.addListener('indexInfo', () => {
|
|
|
+ this.getUserInfo();
|
|
|
+ });
|
|
|
+ DeviceEventEmitter.emit('indexInfo');
|
|
|
}
|
|
|
componentDidMount() {
|
|
|
// this.updateRender('PRIMARY_SCHOOL');
|