Skip to content

Commit

Permalink
学生不能添加成员
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoling1997 committed Nov 5, 2017
1 parent db02311 commit 1c5bede
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
23 changes: 20 additions & 3 deletions CnBlogAndroid/Source/screens/ClassMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,24 @@ export default class ClassMember extends Component{
constructor(props){
super(props);
this.state = {
members: []
members: [],
addDisplay:0
}
let url = Config.apiDomain + api.user.info;
Service.Get(url).then((jsonData)=>{
let url2= Config.apiDomain+"api/edu/member/"+jsonData.BlogId+"/"+this.props.navigation.state.params.classId;
Service.Get(url2).then((jsonData)=>{
if (jsonData.membership==2||jsonData.membership==3)
this.setState({
addDisplay: 1
});
else {
this.setState({
addDisplay: 0
});
}
})
})
}
componentDidMount = ()=>{
let url = 'https://api.cnblogs.com/api/edu/schoolclass/members/'+this.props.navigation.state.params.classId;
Expand Down Expand Up @@ -94,7 +110,7 @@ export default class ClassMember extends Component{
marginHorizontal:0.01*screenWidth
}}
>
<TouchableHighlight
{this.state.addDisplay?(<TouchableHighlight
underlayColor="#0588fe"
activeOpacity={0.5}
style= {{
Expand All @@ -116,7 +132,8 @@ export default class ClassMember extends Component{
>
添加成员
</Text>
</TouchableHighlight>
</TouchableHighlight>):(null)
}
</View>
<FlatList
ItemSeparatorComponent={this._separator}
Expand Down
10 changes: 5 additions & 5 deletions CnBlogAndroid/Source/screens/HomeworkLists.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ const btnFontSize= MyAdapter.btnFontSize;
export default class HomeworkLists extends Component {
constructor(props){
super(props);
this.state = {
homeworks: [],
counts: 0,
newDisplay: 0
}
let url = Config.apiDomain + api.user.info;
Service.Get(url).then((jsonData)=>{
let url2= Config.apiDomain+"api/edu/member/"+jsonData.BlogId+"/"+this.props.navigation.state.params.classId;
Expand All @@ -46,11 +51,6 @@ export default class HomeworkLists extends Component {
}
})
})
this.state = {
homeworks: [],
counts: 0,
newDisplay: 0
}
}
//暂定班级ID为111,应该传进来班级ID作为属性
componentDidMount = ()=>{
Expand Down

0 comments on commit 1c5bede

Please sign in to comment.