alertError.js
3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import React, { Component } from 'react';
import {
StyleSheet,
View,
Image,
Text,
StatusBar,
ActivityIndicator
} from 'react-native';
import {zoomW,zoomH} from '../../utils/getSize';
import {xnToast} from '../../utils/utils';
import AppService from '../../service/AppService'
import moment from 'moment'
const back = require('../../img/returnB.png');
export default class alertError extends Component {
constructor(props) {
super(props);
this.state={
type:this.props.navigation.state.params.type,
}
}
componentDidMount(){
this.props.navigation.setParams({
title:'公告通知',
backgroundColor:'white',
titleColor:'black',
isBack:true,
back:()=>{
this.props.navigation.goBack();
},
});
if (this.state.type === 'noPermissions'){
this.setState({detail:{}})
}else{
this.setState({
loading:true
});
this.getAnnouncementDetail();
}
};
//获取详情
getAnnouncementDetail=()=>{
this.setState({
loading:false
});
AppService.getAnnouncementDetail({id:this.props.navigation.state.params.id}).then((data)=>{
if(data.message){
xnToast(data.message);
return;
}
if(data.errors.length > 0){
xnToast(data.errors[0].message);
}else{
this.setState({
detail:data.announcement,
})
}
});
}
render(){
if (this.state.detail){
return(
<View style={styles.background}>
<StatusBar
backgroundColor={'#FFFFFF'}
barStyle={"dark-content"}
networkActivityIndicatorVisible
/>
<Image style={{width:70/zoomW,height:70/zoomW,marginTop:140/zoomH,marginBottom:30}} source={require('../../img/alertError.png')}/>
{this.state.type === 'noPermissions'&&<Text style={{color:'#999',fontSize:14}}>您还不是通知成员,无法查看本通知内容</Text>}
{this.state.type === 'isRevoke' &&<Text style={{color:'#999',fontSize:14}}>此公告已被发起人于{moment(Number(this.state.detail.revokeTime)).format('MM-DD HH:mm')}撤销</Text>}
{this.state.loading && <View style={styles.loadingBg}>
<ActivityIndicator size="large" />
</View>}
</View>
)
}else {
return (
<View style={styles.background}>
{this.state.loading && <View style={styles.loadingBg}>
<ActivityIndicator size="large" />
</View>}
</View>
)
}
}
}
const styles = StyleSheet.create({
topIcon:{
paddingLeft:(10/zoomW),
paddingRight:(10/zoomW),
height:'100%',
display:'flex',
alignItems:'center'
},
background:{
width:'100%',
height:'100%',
backgroundColor:'#fff',
alignItems:'center',
// justifyContent:'center'
},
loadingBg:{
width:'100%',
height:'100%',
position:'absolute',
display:'flex',
alignItems:'center',
justifyContent:'center'
},
})