Skip to content

Commit

Permalink
voteAdd多重发布问题已解决
Browse files Browse the repository at this point in the history
  • Loading branch information
Welkin1027 committed May 19, 2019
1 parent 3ce74fc commit 190b3a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CnBlogAndroid/Source/screens/VoteAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export default class VoteAdd extends Component {
}
}

hasVoted = false;

//判断函数
judgeAddEmpty(test) {
//如果test为空或者全空格,返回true
Expand Down Expand Up @@ -116,6 +118,9 @@ export default class VoteAdd extends Component {
//设定各个部分不为空
if (!this.judgeAddOk()) return;

//一个页面智能点击一次发布(发布成功后修改值)
if(this.hasVoted) return ;

let postBody = {
schoolClassId: this.state.schoolClassId,
name: this.state.name, //投票名称
Expand All @@ -139,6 +144,7 @@ export default class VoteAdd extends Component {
}
else if (jsonData.isSuccess) {
ToastAndroid.show('添加成功!', ToastAndroid.SHORT);
this.hasVoted = true;
this.props.navigation.state.params.callback();
this.props.navigation.goBack();
}
Expand Down Expand Up @@ -186,7 +192,7 @@ export default class VoteAdd extends Component {
<View style={styles.titleAndContent}>
<View>
<Text style={styles.text}>
投票详情
投票说明
</Text>
</View>

Expand Down

0 comments on commit 190b3a2

Please sign in to comment.