diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 42f6f6b5..9026c6e6 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -151,6 +151,9 @@ class _Manager { ///活动投票:投票详情 String get voteDetail => '/user/eventVoting/voteDetail'; + + ///活动投票:用户投票 + String get vote => '/user/eventVoting/vote'; } class _Community { diff --git a/lib/pages/event_activity/voting_detail_page.dart b/lib/pages/event_activity/voting_detail_page.dart index 1d9914fe..8bfd29c1 100644 --- a/lib/pages/event_activity/voting_detail_page.dart +++ b/lib/pages/event_activity/voting_detail_page.dart @@ -1,4 +1,7 @@ // Flutter imports: +import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/widget/buttons/bottom_button.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; // Package imports: @@ -12,6 +15,7 @@ import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/buttons/bee_single_check.dart'; import 'package:akuCommunity/utils/headers.dart'; +import 'package:get/get.dart'; class VotingDetailPage extends StatefulWidget { final int id; @@ -63,7 +67,7 @@ class _VotingDetailPageState extends State { // } // }, // ), -// + // // //暂时用单选 child: GestureDetector( @@ -102,6 +106,32 @@ class _VotingDetailPageState extends State { return Container(); } + Widget _shouwVoteDialog() { + return CupertinoAlertDialog( + title: '投票成功'.text.black.size(32.sp).bold.isIntrinsic.make(), + actions: [ + CupertinoDialogAction( + child: '取消'.text.black.size(34.sp).isIntrinsic.make(), + onPressed: () { + Get.back(); + }, + ), + CupertinoDialogAction( + child: '查看结果' + .text + .color(kPrimaryColor) + .size(34.sp) + .bold + .isIntrinsic + .make(), + onPressed: () { + Get.back(); + }, + ) + ], + ); + } + @override Widget build(BuildContext context) { return BeeScaffold( @@ -163,6 +193,11 @@ class _VotingDetailPageState extends State { ], ), ), + bottomNavi: BottomButton( + onPressed: () { + Get.dialog(_shouwVoteDialog()); + }, + child: '投票'.text.black.size(28.sp).bold.make()), ); } } diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index 78011ce3..1e79cee7 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -174,4 +174,12 @@ class ManagerFunc { showMessage: false); return VotingDetailModel.fromJson(baseModel.data); } + + static Future vote(int voteId, int candleId) async { + BaseModel baseModel = await NetUtil().post(API.manager.vote, params: { + 'voteId': voteId, + 'candidateId': candleId, + }); + return baseModel; + } }