对接访客记录列表接口

remove sh*t code again.
hmxc
小赖 4 years ago
parent 7b9426b0af
commit 843f1b99c3

@ -76,6 +76,9 @@ class _Manager {
///访访
String get insertVisitorInfo => '/user/visitorAccess/insertVisitorInfo';
///访访
String get visitorAccessList => '/user/visitorAccess/list';
///
String get articleOut => '/user/articleOut/list';

@ -0,0 +1,44 @@
import 'package:common_utils/common_utils.dart';
class VisitorListItemModel {
int id;
int accessCode;
int visitorStatus;
String name;
int isDrive;
String carNum;
String effectiveTime;
DateTime get date => DateUtil.getDateTime(effectiveTime);
VisitorListItemModel(
{this.id,
this.accessCode,
this.visitorStatus,
this.name,
this.isDrive,
this.carNum,
this.effectiveTime});
VisitorListItemModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
accessCode = json['accessCode'];
visitorStatus = json['visitorStatus'];
name = json['name'];
isDrive = json['isDrive'];
carNum = json['carNum'];
effectiveTime = json['effectiveTime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['accessCode'] = this.accessCode;
data['visitorStatus'] = this.visitorStatus;
data['name'] = this.name;
data['isDrive'] = this.isDrive;
data['carNum'] = this.carNum;
data['effectiveTime'] = this.effectiveTime;
return data;
}
}

@ -2,6 +2,7 @@ import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/ui/manager/visitor/visitor_record_page.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/picker/bee_date_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
@ -210,17 +211,10 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
Widget _selectTime() {
return InkWell(
onTap: () {
DatePicker.showDatePicker(context,
showTitleActions: true,
minTime: DateTime(2020, 1, 1),
maxTime: DateTime(2020, 12, 31), onChanged: (date) {
print('change $date in time zone ' +
date.timeZoneOffset.inHours.toString());
}, onConfirm: (date) {
dateTime = date;
onTap: () async {
DateTime date = await BeeDatePicker.pick(DateTime.now());
if (date != null) dateTime = date;
setState(() {});
}, currentTime: DateTime.now(), locale: LocaleType.zh);
},
child: Container(
padding: EdgeInsets.only(

@ -1,207 +0,0 @@
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/dotted_line.dart';
class VisitorPassPage extends StatefulWidget {
VisitorPassPage({Key key}) : super(key: key);
@override
_VisitorPassPageState createState() => _VisitorPassPageState();
}
class _VisitorPassPageState extends State<VisitorPassPage> {
Widget _header() {
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'宁波华茂悦峰',
style: TextStyle(fontSize: 40.sp, color: Color(0xffffffff)),
),
SizedBox(height: 10.w),
Text(
'1幢-1单元-702室',
style: TextStyle(fontSize: 26.sp, color: Color(0xffffffff)),
),
],
),
);
}
Widget _card() {
return Container(
decoration: BoxDecoration(
color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(16.w)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.2),
offset: Offset(1.1, 1.1),
blurRadius: 10.0),
],
),
margin: EdgeInsets.symmetric(
horizontal: 75.w,
vertical: 32.w,
),
padding: EdgeInsets.only(
bottom: 16.w,
left: 32.w,
right: 21.w,
top: 25.w,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(
AntDesign.contacts,
size: 40.sp,
color: Color(0xff999999),
),
SizedBox(width: 10.w),
Text(
'马成泽先生',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 36.sp,
color: Color(0xff333333)),
),
],
),
Row(
children: [
Icon(
AntDesign.car,
size: 40.sp,
color: Color(0xff999999),
),
SizedBox(width: 10.w),
Text(
'无车辆信息',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 36.sp,
color: Color(0xff333333),
),
),
],
),
],
),
SizedBox(height: 13.w),
Text(
'有限时间2020年6月30日',
style: TextStyle(
fontSize: 26.sp,
color: Color(0xff999999),
),
),
SizedBox(height: 23.w),
DottedLine(color: Color(0xfff5f5f5)),
Container(
padding: EdgeInsets.only(
top: 30.w,
bottom: 38.w,
),
height: 389.w,
alignment: Alignment.center,
child: Column(
children: [
Text(
'020-598-230',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 36.sp,
color: Color(0xff333333),
),
),
SizedBox(height: 11.w),
Image.asset(
'assets/example/QR_code.png',
height: 260.w,
width: 260.w,
color: Color(0xff333333),
fit: BoxFit.fill,
),
],
),
),
DottedLine(color: Color(0xfff5f5f5)),
SizedBox(height: 16.w),
Container(
alignment: Alignment.center,
child: Text(
'进入小区时,请出示此通行证给门岗',
style: TextStyle(
fontSize: 24.sp,
color: Color(0xff999999),
),
),
),
],
),
);
}
Widget _bottomButton() {
return InkWell(
onTap: () {},
child: Container(
alignment: Alignment.center,
height: 98.w,
width: 750.w,
padding: EdgeInsets.symmetric(vertical: 26.5.w),
color: Color(0xffffc40c),
child: Text(
'发送给访客',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 32.sp,
color: Color(0xff333333),
),
),
),
);
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '访客通行证',
body: Container(
color: Color(0xff333333),
child: Stack(
children: [
Column(
children: [
SizedBox(height: 192.w - kToolbarHeight),
_header(),
SizedBox(height: 32.w),
_card(),
],
),
Positioned(
bottom: 0,
child: _bottomButton(),
),
],
),
),
);
}
}

@ -1,116 +0,0 @@
import 'package:akuCommunity/pages/visitor_access_page/visitor_pass_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:akuCommunity/utils/headers.dart';
class RecordItem extends StatefulWidget {
final bool isQRCode;
RecordItem({Key key, this.isQRCode}) : super(key: key);
@override
_RecordItemState createState() => _RecordItemState();
}
class _RecordItemState extends State<RecordItem>
with AutomaticKeepAliveClientMixin {
@override
bool get wantKeepAlive => true;
void recordPass() {
VisitorPassPage().to;
}
Positioned _positionedAgain() {
return Positioned(
right: 0,
top: 16.w,
child: InkWell(
onTap: () {},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(36.w)),
border: Border.all(color: Color(0xffffc500), width: 3.w)),
padding: EdgeInsets.symmetric(
vertical: 11.w,
horizontal: 32.w,
),
child: Text(
'再次邀请',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 24.sp,
color: Color(0xff333333),
),
),
),
),
);
}
Positioned _positionedQRcode() {
return Positioned(
right: 0,
top: 16.w,
child: Row(
children: [
Icon(
AntDesign.qrcode,
size: 40.sp,
color: Color(0xff999999),
),
SizedBox(height: 18.w),
Icon(
AntDesign.right,
size: 40.sp,
color: Color(0xff999999),
),
],
),
);
}
@override
Widget build(BuildContext context) {
super.build(context);
return InkWell(
onTap: recordPass,
child: Container(
padding: EdgeInsets.only(
top: 32.w,
left: 32.w,
right: 32.w,
),
color: Colors.white,
child: Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'马成泽(浙A88888)',
style: TextStyle(
fontSize: 32.sp,
color: Color(0xff333333),
),
),
SizedBox(height: 8.w),
Text(
'2020年6月30日',
style: TextStyle(
fontSize: 24.sp,
color: Color(0xff999999),
),
),
SizedBox(height: 33.w),
Divider()
],
),
widget.isQRCode ? _positionedQRcode() : _positionedAgain(),
],
),
),
);
}
}

@ -1,51 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'record_item.dart';
class RecordList extends StatefulWidget {
RecordList({Key key}) : super(key: key);
@override
_RecordListState createState() => _RecordListState();
}
class _RecordListState extends State<RecordList>
with AutomaticKeepAliveClientMixin {
@override
bool get wantKeepAlive => true;
RefreshController _refreshController =
RefreshController(initialRefresh: false);
void _onRefresh() async {
await Future.delayed(Duration(milliseconds: 1500));
_refreshController.refreshCompleted();
}
void _onLoading() async {
if (mounted) setState(() {});
_refreshController.loadComplete();
}
@override
Widget build(BuildContext context) {
super.build(context);
return Container(
color: Colors.white,
child: SmartRefresher(
controller: _refreshController,
header: WaterDropHeader(),
footer: ClassicFooter(),
onRefresh: _onRefresh,
onLoading: _onLoading,
enablePullUp: true,
child: ListView.builder(
itemBuilder: (context, index) => RecordItem(
isQRCode: (index % 2 == 0) ? false : true,
),
itemCount: 6,
),
),
);
}
}

@ -0,0 +1,86 @@
import 'package:akuCommunity/model/manager/visitor_list_item_model.dart';
import 'package:akuCommunity/ui/manager/visitor/visitor_passport_page.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
class VisitorListItem extends StatefulWidget {
final VisitorListItemModel model;
VisitorListItem({Key key, @required this.model}) : super(key: key);
@override
_VisitorListItemState createState() => _VisitorListItemState();
}
class _VisitorListItemState extends State<VisitorListItem> {
String get _name {
StringBuffer buffer = StringBuffer();
var name = widget.model.name;
buffer.write(name);
var car = widget.model.carNum;
if (TextUtil.isEmpty(car)) return buffer.toString();
buffer.write('($car)');
return buffer.toString();
}
bool get outDate => DateTime.now().isAfter(widget.model.date);
_buildSuffix() {
if (outDate)
return MaterialButton(
onPressed: () {},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 12.w),
height: 56.w,
child: '再次邀约'.text.size(24.sp).bold.make(),
shape: StadiumBorder(
side: BorderSide(
color: Color(0xFFFFC500),
width: 3.w,
),
),
);
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.qr_code_rounded),
16.wb,
Icon(CupertinoIcons.chevron_forward),
],
);
}
@override
Widget build(BuildContext context) {
return MaterialButton(
onPressed: () {
if (!outDate) {
VisitorPassportPage().to();
}
},
color: Colors.white,
elevation: 0,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
height: 152.w,
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_name.text.size(32.sp).bold.make(),
8.hb,
DateUtil.formatDate(widget.model.date, format: 'yyyy-MM-dd')
.text
.size(24.sp)
.color(Color(0xFF999999))
.make(),
],
),
Spacer(),
_buildSuffix(),
],
),
);
}
}

@ -0,0 +1,45 @@
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_back_button.dart';
import 'package:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
class VisitorPassportPage extends StatefulWidget {
VisitorPassportPage({Key key}) : super(key: key);
@override
_VisitorPassportPageState createState() => _VisitorPassportPageState();
}
class _VisitorPassportPageState extends State<VisitorPassportPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF333333),
appBar: AppBar(
leading: BeeBackButton(color: Colors.white),
backgroundColor: Color(0xFF333333),
elevation: 0,
centerTitle: true,
title: '访客通行证'.text.white.make(),
),
body: ListView(
children: [
64.hb,
'宁波华茂悦峰'.text.size(40.sp).white.bold.make().centered(),
'1幢-1单元-702室'.text.size(30.sp).white.make().centered(),
32.hb,
Container(
height: 600.w,
width: 600.w,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.w),
),
// child: ,
//TODO
).centered(),
],
),
);
}
}

@ -1,8 +1,8 @@
import 'package:akuCommunity/ui/manager/visitor/visitor_record_view.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/tab_bar/bee_tab_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import '../../../pages/visitor_access_page/widget/record_list.dart';
class VisitorRecordPage extends StatefulWidget {
VisitorRecordPage({Key key}) : super(key: key);
@ -38,10 +38,10 @@ class _VisitorRecordPageState extends State<VisitorRecordPage>
),
body: TabBarView(
controller: _controller,
children: List.generate(
_tabs.length,
(index) => RecordList(),
),
children: [
VisitorRecordView(type: 1),
VisitorRecordView(type: 2),
],
),
);
}

@ -0,0 +1,54 @@
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/model/manager/visitor_list_item_model.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/ui/manager/visitor/visitor_list_item.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
class VisitorRecordView extends StatefulWidget {
///访1.2.
final int type;
VisitorRecordView({Key key, @required this.type}) : super(key: key);
@override
_VisitorRecordViewState createState() => _VisitorRecordViewState();
}
class _VisitorRecordViewState extends State<VisitorRecordView> {
EasyRefreshController _refreshController = EasyRefreshController();
@override
void dispose() {
_refreshController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeListView(
controller: _refreshController,
path: API.manager.visitorAccessList,
extraParams: {'visitorStatus': widget.type},
convert: (model) {
return model.tableList
.map((e) => VisitorListItemModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
separatorBuilder: (_, __) => Divider(
indent: 32.w,
endIndent: 32.w,
height: 1.w,
),
itemBuilder: (context, index) {
return VisitorListItem(model: items[index]);
},
itemCount: items.length,
);
},
);
}
}

@ -3,7 +3,8 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
class BeeBackButton extends StatelessWidget {
const BeeBackButton({Key key}) : super(key: key);
final Color color;
const BeeBackButton({Key key, this.color = Colors.black}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -12,6 +13,7 @@ class BeeBackButton extends StatelessWidget {
onPressed: () => Get.back(),
icon: Icon(
CupertinoIcons.chevron_back,
color: color,
),
)
: SizedBox();

Loading…
Cancel
Save