Skip to content

Commit

Permalink
匿名投票不再显示已投票成员。没有人投票时不弹出已投票成员页面
Browse files Browse the repository at this point in the history
  • Loading branch information
kilotron committed May 16, 2019
1 parent 907550d commit a0c68d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 15 additions & 4 deletions CnBlogAndroid/Source/screens/VoteDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,23 @@ const extractVoteContentData = require('../DataHandler/VoteContent');

const screenWidth = MyAdapter.screenWidth;
const screenHeight = MyAdapter.screenHeight;
// 投票隐私
const Public = 1;
const Anonymous = 2;

// 传入voteID作为参数
export default class VoteDetail extends Component {
/**navigationOptions放在此处,可以在标题栏放一个按钮跳转到另一个页面。 */
static navigationOptions = ({ navigation }) => ({
headerTitle: '投票详情',
headerRight: (
headerRight: navigation.state.params.privacy === Public ? (
<TouchableOpacity onPress={() => {
if (navigation.state.params.voteCount == 0) {
Alert.alert('提示', '目前还没有人投票~', [
{text: '确定',},
]);
return;
}
if (typeof(navigation.state.params.voteContent) == 'undefined') {
ToastAndroid.show('请等待1秒', ToastAndroid.SHORT);
return; // voteContent还没有获取到
Expand All @@ -56,7 +65,7 @@ export default class VoteDetail extends Component {
tintColor={global.theme.headerTintColor}
/>
</TouchableOpacity>
),
) : (<View></View>),
})

constructor(props) {
Expand Down Expand Up @@ -97,7 +106,6 @@ export default class VoteDetail extends Component {
_isMounted;

componentWillMount = () => {
//this.props.navigation.setParams({theme: this.context});
this._isMounted = true;
let contenturl = Config.VoteDetail + this.state.voteId;
let voteContentURL = Config.VoteContent + this.state.voteId;
Expand All @@ -121,7 +129,10 @@ export default class VoteDetail extends Component {
})
}
// 为显示投票成员设置
this.props.navigation.setParams({ schoolClassId: jsonData.schoolClassId });
this.props.navigation.setParams({
schoolClassId: jsonData.schoolClassId,
privacy: jsonData.privacy,
});
}
})
.then(() => {
Expand Down
2 changes: 2 additions & 0 deletions CnBlogAndroid/Source/screens/VoteList.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ export default class VoteList extends Component {
this.props.navigation.navigate('VoteDetail', //获取详细信息
{
voteId: item.voteId,
// 在没有人投票的情况下不弹出已投票成员页面
voteCount: item.voteCount,
});
}}
>
Expand Down

0 comments on commit a0c68d1

Please sign in to comment.