dock interface:questionnaire/list,

add questionnaire page
hmxc
张萌 4 years ago
parent 26526831fd
commit a1ffe97793

@ -154,6 +154,9 @@ class _Manager {
///
String get vote => '/user/eventVoting/vote';
///applist
String get questionnaireList => '/user/questionnaire/list';
}
class _Community {

@ -1,4 +1,5 @@
// Flutter imports:
import 'package:akuCommunity/pages/questionnaire_page/questionnaire_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@ -66,7 +67,7 @@ List<AO> appObjects = [
AO('物品出门', R.ASSETS_APPLICATIONS_GOODS_OUT_PNG, GoodsDetoPage()),
AO('投诉表扬', R.ASSETS_APPLICATIONS_COMPLAINT_PNG,
AdvicePage(type: AdviceType.COMPLAIN)),
AO('问卷调查', R.ASSETS_APPLICATIONS_QUESTION_PNG, QuestionnaireDetailsPage()),
AO('问卷调查', R.ASSETS_APPLICATIONS_QUESTION_PNG, QuestionnairePage()),
AO('装修管理', R.ASSETS_APPLICATIONS_DECORATION_PNG, FitupManagePage()),
AO('借还管理', R.ASSETS_APPLICATIONS_BORROW_PNG, GoodsManagePage()),
AO('一键报警', R.ASSETS_APPLICATIONS_POLICE_PNG, AlarmPage()),

@ -0,0 +1,92 @@
import 'package:akuCommunity/model/common/img_model.dart';
class QuestionnaireModel {
int id;
String title;
String description;
String beginDate;
String endDate;
int status;
int answerNum;
List<ImgModel> imgUrls;
List<ImgModel> headImgURls;
QuestionnaireModel(
{this.id,
this.title,
this.description,
this.beginDate,
this.endDate,
this.status,
this.answerNum,
this.imgUrls,
this.headImgURls});
QuestionnaireModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
description = json['description'];
beginDate = json['beginDate'];
endDate = json['endDate'];
status = json['status'];
answerNum = json['answerNum'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgModel>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgModel.fromJson(v));
});
}else imgUrls=[];
if (json['headImgURls'] != null) {
headImgURls = new List<ImgModel>();
json['headImgURls'].forEach((v) {
headImgURls.add(new ImgModel.fromJson(v));
});
}else headImgURls=[];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['title'] = this.title;
data['description'] = this.description;
data['beginDate'] = this.beginDate;
data['endDate'] = this.endDate;
data['status'] = this.status;
data['answerNum'] = this.answerNum;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
if (this.headImgURls != null) {
data['headImgURls'] = this.headImgURls.map((v) => v.toJson()).toList();
}
return data;
}
}
class ImgUrls {
String url;
String size;
int longs;
int paragraph;
int sort;
ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort});
ImgUrls.fromJson(Map<String, dynamic> json) {
url = json['url'];
size = json['size'];
longs = json['longs'];
paragraph = json['paragraph'];
sort = json['sort'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
data['size'] = this.size;
data['longs'] = this.longs;
data['paragraph'] = this.paragraph;
data['sort'] = this.sort;
return data;
}
}

@ -39,12 +39,13 @@ class _EventVotingPageState extends State<EventVotingPage> {
switch (status) {
case 1:
case 2:
return '投票';
return '参与';
case 3:
return '已结束';
case 4:
return '投票';
return '填写';
default:
return '';
}
}

@ -1,16 +1,12 @@
// Flutter imports:
import 'package:flutter/cupertino.dart';
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/manager/questinnaire_model.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/others/stack_avatar.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:pull_to_refresh/pull_to_refresh.dart';
// Project imports:
import 'package:akuCommunity/pages/questionnaire_page/questionnaire_details_page/questionnaire_details_page.dart';
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/community_card.dart';
class QuestionnairePage extends StatefulWidget {
QuestionnairePage({Key key}) : super(key: key);
@ -20,100 +16,139 @@ class QuestionnairePage extends StatefulWidget {
}
class _QuestionnairePageState extends State<QuestionnairePage> {
List<String> images = [
"https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1151143562,4115642159&fm=26&gp=0.jpg",
"https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2551412680,857245643&fm=26&gp=0.jpg",
"https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3604827221,1047385274&fm=26&gp=0.jpg",
];
List<Map<String, dynamic>> _listView = [
{
'imagePath':
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600076026158&di=da8cffada3104f26e80cea2c7f54ce70&imgtype=0&src=http%3A%2F%2F0429.zxdyw.com%2FU_Image%2F2017%2F0925%2Fe%2F20170925104340_9160.jpg',
'title': '狮子王画室课程满意程度',
'subtitle': '亲爱的家长朋友,您好很高心为您的孩子选…',
'timeZone': '06月17日 15:20至06月17日 18:00',
'peopleNum': 37,
'isOver': false,
'isVote': true
},
{
'imagePath':
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600076048900&di=ac816ae35f05e5f1d959449d36efa6d3&imgtype=0&src=http%3A%2F%2Fimage.ludedc.com%2Fimage%2F20151125%2F251632264b19f55f136042.jpg',
'title': '小区色绿环保,绿色种植比例调查问卷',
'subtitle': '各位业主,您好,本着小区结合现代化发展…',
'timeZone': '06月01日 13:20至06月01日 18:00',
'peopleNum': 989,
'isOver': false,
'isVote': true
},
{
'imagePath':
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600076094434&di=8f88dc7dab7e716a0db1bde7dc55309b&imgtype=0&src=http%3A%2F%2Fqcloud.dpfile.com%2Fpc%2FceOXxAYp_7zhCWKRpYBCahIE_4Q5VlY5lWZsONVu0ahouI64PLnDNyiI08ZHM8ZfTYGVDmosZWTLal1WbWRW3A.jpg',
'title': '美嘉舞蹈工作室问卷调查',
'subtitle': '各位家长,应照舞蹈室的委托,开展一次问…',
'timeZone': '06月01日 13:20至06月01日 18:00',
'peopleNum': 989,
'isOver': true,
'isVote': false
}
];
RefreshController _refreshController =
RefreshController(initialRefresh: false);
EasyRefreshController _easyRefreshController;
@override
void initState() {
super.initState();
}
void _onRefresh() async {
await Future.delayed(Duration(milliseconds: 1500));
_refreshController.refreshCompleted();
}
void _onLoading() async {
await Future.delayed(Duration(milliseconds: 1500));
if (mounted) setState(() {});
_refreshController.loadComplete();
String _getButtonText(int status) {
switch (status) {
case 1:
case 2:
return '去投票';
case 3:
return '已结束';
case 4:
return '已投票';
default:
return '';
}
}
void detailsRouter(String imagePath, title) {
QuestionnaireDetailsPage(bundle: Bundle()
..putMap('details', {
'title': title,
'imagePath': imagePath,
}),).to;
Widget _buildCard(QuestionnaireModel model) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: kForeGroundColor,
),
width: double.infinity,
// height: 236.w,
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 12.w),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
Container(
decoration:
BoxDecoration(borderRadius: BorderRadius.circular(8.w)),
width: 160.w,
height: 120.w,
child: ClipRRect(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_LOGO_PNG,
image: API.image(model.imgUrls.first.url)),
),
),
20.w.widthBox,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
model.title.text.black.size(28.sp).make(),
6.w.heightBox,
model.description.text
.color(ktextSubColor)
.size(28.sp)
.maxLines(1)
.overflow(TextOverflow.ellipsis)
.make(),
6.w.heightBox,
RichText(
text: TextSpan(
text: '参与时间:',
style: TextStyle(
color: ktextSubColor,
fontSize: 24.sp,
),
children: [
TextSpan(
style: TextStyle(
color: ktextPrimary,
fontSize: 24.sp,
),
text: model.beginDate + '' + model.endDate,
),
])),
],
).expand()
],
),
40.w.heightBox,
Row(
children: [
StackAvatar(
avatars: model.headImgURls.map((e) => e.url).toList()),
26.w.widthBox,
'${model.answerNum}人已参加'.text.black.size(20.sp).make(),
Spacer(),
MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(22.w)),
color: model.status == 3 ? kDarkSubColor : kPrimaryColor,
minWidth: 120.w,
height: 44.w,
// padding:
// EdgeInsets.symmetric(horizontal: 30.w, vertical: 8.w),
elevation: 0,
onPressed: () {},
child: (_getButtonText(model.status))
.text
.black
.size(20.sp)
.bold
.make(),
),
],
)
],
),
);
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '问卷调查',
body: RefreshConfiguration(
hideFooterWhenNotFull: true,
child: SmartRefresher(
controller: _refreshController,
header: WaterDropHeader(),
footer: ClassicFooter(),
onRefresh: _onRefresh,
onLoading: _onLoading,
enablePullUp: true,
child: ListView.builder(
itemBuilder: (BuildContext context, int index) => CommunityCard(
imagePath: _listView[index]['imagePath'],
title: _listView[index]['title'],
subtitle: _listView[index]['subtitle'],
timeZone: _listView[index]['timeZone'],
headList: images,
isOver: _listView[index]['isOver'],
peopleNum: _listView[index]['peopleNum'],
fun: detailsRouter,
),
itemCount: _listView.length,
),
),
),
body: BeeListView(
path: API.manager.questionnaireList,
controller: _easyRefreshController,
convert: (model) {
return model.tableList
.map((e) => QuestionnaireModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
itemBuilder: (context, index) {
return _buildCard(items[index]);
},
separatorBuilder: (_, __) {
return 24.w.heightBox;
},
itemCount: items.length);
}),
);
}
}

Loading…
Cancel
Save