访客记录接口更新

hmxc
章文轩 3 years ago
parent f041aa56f5
commit bdd007266c

@ -126,7 +126,10 @@ class _Manager {
String get shareInvite => '/user/visitorInvite/share';
///访访
String get visitorAccessList => '/user/visitorAccess/list';
String get visitorAccessList => '/user/visitorInvite/list';
///访访
String get getInviteCode => '/user/doorQRCode/getVisitorsQrCode';
///
String get articleOut => '/user/articleOut/list';

@ -0,0 +1,21 @@
class visitorQRCodeModel {
String? data;
String? message;
bool? status;
visitorQRCodeModel({this.data, this.message, this.status});
visitorQRCodeModel.fromJson(Map<String, dynamic> json) {
data = json['data'];
message = json['message'];
status = json['status'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['data'] = this.data;
data['message'] = this.message;
data['status'] = this.status;
return data;
}
}

@ -2,44 +2,65 @@ import 'package:flustars/flustars.dart';
class VisitorListItemModel {
int? id;
int? accessCode;
int? visitorStatus;
int? estateId;
String? roomName;
String? name;
int? isDrive;
String? carNum;
String? effectiveTime;
String? tel;
int? sex;
String? carNumber;
String? visitDateStart;
String? visitDateEnd;
int? status;
int? createId;
String? createDate;
DateTime? get date => DateUtil.getDateTime(effectiveTime!);
bool get drive => isDrive == 1;
DateTime? get date => DateUtil.getDateTime(createDate ?? '');
bool get drive => carNumber != null;
VisitorListItemModel(
{this.id,
this.accessCode,
this.visitorStatus,
this.estateId,
this.roomName,
this.name,
this.isDrive,
this.carNum,
this.effectiveTime});
this.tel,
this.sex,
this.carNumber,
this.visitDateStart,
this.visitDateEnd,
this.status,
this.createId,
this.createDate});
VisitorListItemModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
accessCode = json['accessCode'];
visitorStatus = json['visitorStatus'];
estateId = json['estateId'];
roomName = json['roomName'];
name = json['name'];
isDrive = json['isDrive'];
carNum = json['carNum'];
effectiveTime = json['effectiveTime'];
tel = json['tel'];
sex = json['sex'];
carNumber = json['carNumber'];
visitDateStart = json['visitDateStart'];
visitDateEnd = json['visitDateEnd'];
status = json['status'];
createId = json['createId'];
createDate = json['createDate'];
}
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['estateId'] = this.estateId;
data['roomName'] = this.roomName;
data['name'] = this.name;
data['isDrive'] = this.isDrive;
data['carNum'] = this.carNum;
data['effectiveTime'] = this.effectiveTime;
data['tel'] = this.tel;
data['sex'] = this.sex;
data['carNumber'] = this.carNumber;
data['visitDateStart'] = this.visitDateStart;
data['visitDateEnd'] = this.visitDateEnd;
data['status'] = this.status;
data['createId'] = this.createId;
data['createDate'] = this.createDate;
return data;
}
}

@ -1,3 +1,7 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -11,7 +15,9 @@ import 'package:aku_community/utils/headers.dart';
class VisitorListItem extends StatefulWidget {
final VisitorListItemModel model;
VisitorListItem({Key? key, required this.model}) : super(key: key);
final int type;
VisitorListItem({Key? key, required this.model, required this.type})
: super(key: key);
@override
_VisitorListItemState createState() => _VisitorListItemState();
@ -22,17 +28,20 @@ class _VisitorListItemState extends State<VisitorListItem> {
StringBuffer buffer = StringBuffer();
var name = widget.model.name;
buffer.write(name);
var car = widget.model.carNum;
var car = widget.model.carNumber;
if (TextUtil.isEmpty(car)) return buffer.toString();
buffer.write('($car)');
return buffer.toString();
}
bool get outDate => DateTime.now().isAfter(widget.model.date!);
// bool get outDate =>
// DateTime.now().isAfter(widget.model.date ?? DateTime.now());
_buildSuffix() {
if (outDate)
if (widget.type == 1 || widget.type == 3)
return MaterialButton(
onPressed: () {},
onPressed: () {
Get.back();
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 12.w),
height: 56.w,
@ -44,24 +53,51 @@ class _VisitorListItemState extends State<VisitorListItem> {
),
),
);
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.qr_code_rounded),
16.wb,
Icon(CupertinoIcons.chevron_forward),
],
);
else
//
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) {
Get.to(() => VisitorPassportPage(model: widget.model));
onPressed: () async {
if (widget.type == 2) {
BaseModel baseModel = await NetUtil().get(API.manager.getInviteCode,
params: {
"startTime": DateUtil.formatDateStr(
widget.model.visitDateStart ?? '',
format: 'yyyy/MM/dd HH:mm:ss'),
"endTime": DateUtil.formatDateStr(
widget.model.visitDateEnd ?? '',
format: 'yyyy/MM/dd HH:mm:ss'),
"visitorsTel": widget.model.tel
},
showMessage: false);
if (baseModel.data != null) {
Get.to(VisitorPassportPage(
model: widget.model,
code: baseModel.data,
));
} else {
BotToast.showText(text: '访客码获取出错!');
}
}
},
// onPressed: () {
// if (widget.model.status != 1) {
// Get.to(() => VisitorPassportPage(model: widget.model));
// }
// },
color: Colors.white,
elevation: 0,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,

@ -9,6 +9,7 @@ import 'package:bot_toast/bot_toast.dart';
import 'package:flustars/flustars.dart';
import 'package:fluwx/fluwx.dart';
import 'package:qr_flutter/qr_flutter.dart';
// import 'package:qr_flutter/qr_flutter.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/base/base_style.dart';
@ -21,7 +22,9 @@ import 'package:aku_community/widget/buttons/bottom_button.dart';
class VisitorPassportPage extends StatefulWidget {
final VisitorListItemModel model;
VisitorPassportPage({Key? key, required this.model}) : super(key: key);
final String? code;
VisitorPassportPage({Key? key, required this.model, this.code})
: super(key: key);
@override
_VisitorPassportPageState createState() => _VisitorPassportPageState();
@ -29,6 +32,7 @@ class VisitorPassportPage extends StatefulWidget {
class _VisitorPassportPageState extends State<VisitorPassportPage> {
GlobalKey _repaintKey = GlobalKey();
@override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
@ -85,7 +89,9 @@ class _VisitorPassportPageState extends State<VisitorPassportPage> {
width: 40.w,
),
16.wb,
(widget.model.drive ? '无车辆信息' : widget.model.carNum)!
(!widget.model.drive
? '无车辆信息'
: widget.model.carNumber!)
.text
.size(36.sp)
.bold
@ -112,7 +118,7 @@ class _VisitorPassportPageState extends State<VisitorPassportPage> {
height: 260.w,
width: 260.w,
child: QrImage(
data: widget.model.accessCode.toString(),
data: widget.code!,
),
).centered(),
32.hb,

@ -17,7 +17,7 @@ class _VisitorRecordPageState extends State<VisitorRecordPage>
TabController? _controller;
//
List<String> _tabs = ['未到访客', '已到访客'];
List<String> _tabs = ['已分享', '已提交', '已过期'];
@override
void initState() {
_controller = TabController(length: _tabs.length, vsync: this);
@ -42,6 +42,7 @@ class _VisitorRecordPageState extends State<VisitorRecordPage>
children: [
VisitorRecordView(type: 1),
VisitorRecordView(type: 2),
VisitorRecordView(type: 3),
],
),
);

@ -9,7 +9,7 @@ import 'package:aku_community/ui/manager/visitor/visitor_list_item.dart';
import 'package:aku_community/utils/headers.dart';
class VisitorRecordView extends StatefulWidget {
///访1.2.
///访1.2.3.
final int type;
VisitorRecordView({Key? key, required this.type}) : super(key: key);
@ -45,7 +45,7 @@ class _VisitorRecordViewState extends State<VisitorRecordView> {
height: 1.w,
),
itemBuilder: (context, index) {
return VisitorListItem(model: items[index]);
return VisitorListItem(model: items[index], type: widget.type);
},
itemCount: items.length,
);

@ -77,7 +77,7 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.0"
version: "2.6.1"
auto_size_text:
dependency: transitive
description:
@ -1046,7 +1046,7 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0"
version: "1.8.1"
sp_util:
dependency: transitive
description:
@ -1123,7 +1123,7 @@ packages:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.19"
version: "0.3.0"
timing:
dependency: transitive
description:

Loading…
Cancel
Save