|
|
@@ -17,7 +17,8 @@ export default class ListAlerts extends Component {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
dataList: [],
|
|
|
- refreshing: false
|
|
|
+ refreshing: false,
|
|
|
+ showReadAll: false
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@@ -75,7 +76,8 @@ export default class ListAlerts extends Component {
|
|
|
apiNotification.getNotificationList("").then(res => {
|
|
|
if (res.data) {
|
|
|
this.setState({
|
|
|
- dataList: res.data
|
|
|
+ dataList: res.data,
|
|
|
+ showReadAll: res.data?.length > 0 && AlertUtil.getUnreadAlert() > 0
|
|
|
})
|
|
|
}
|
|
|
}).catch(err => {
|
|
|
@@ -118,7 +120,12 @@ export default class ListAlerts extends Component {
|
|
|
|
|
|
readAllMessage() {
|
|
|
Dialog.dismissLoading();
|
|
|
- this.onRefresh();
|
|
|
+ apiNotification.readAll().then(res => {
|
|
|
+ AlertUtil.requestRefresh();
|
|
|
+ this.onRefresh();
|
|
|
+ }).catch(err => {
|
|
|
+ toastShort(err)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
listItem = (props) => {
|
|
|
@@ -132,7 +139,7 @@ export default class ListAlerts extends Component {
|
|
|
}
|
|
|
|
|
|
topView = (props) => {
|
|
|
- if (this.state.dataList.length > 0) {
|
|
|
+ if (this.state.showReadAll) {
|
|
|
return (
|
|
|
<View style={styles.topView}>
|
|
|
<Button
|