Revert "对接访客管理"

This reverts commit 32bf9d8b36.
hmxc
张萌 4 years ago
parent 32bf9d8b36
commit a94c246a0c

@ -13,7 +13,6 @@ class API {
static const int networkTimeOut = 10000;
static _Auth auth = _Auth();
static _User user = _User();
static _Manage manage = _Manage();
}
class _Auth {
@ -41,10 +40,6 @@ class _User {
String get sendTelUpdateCode => '/user/personalData/sendTelUpdateCode';
///
String get updateTel => '/user/personalData/updateTel';
}
String get updateTel =>'/user/personalData/updateTel';
class _Manage {
///访app访 )
String get visitorList => '/user/visitor/list';
}

@ -1,44 +0,0 @@
class VisitorCardsModel {
int id;
String roomName;
String name;
int isDrive;
String carNum;
String effectiveTime;
String visitDate;
int visitorStatus;
VisitorCardsModel(
{this.id,
this.roomName,
this.name,
this.isDrive,
this.carNum,
this.effectiveTime,
this.visitDate,
this.visitorStatus});
VisitorCardsModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
roomName = json['roomName'];
name = json['name'];
isDrive = json['isDrive'];
carNum = json['carNum'];
effectiveTime = json['effectiveTime'];
visitDate = json['visitDate'];
visitorStatus = json['visitorStatus'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['roomName'] = this.roomName;
data['name'] = this.name;
data['isDrive'] = this.isDrive;
data['carNum'] = this.carNum;
data['effectiveTime'] = this.effectiveTime;
data['visitDate'] = this.visitDate;
data['visitorStatus'] = this.visitorStatus;
return data;
}
}

@ -2,6 +2,7 @@
import 'dart:io';
// Flutter imports:
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
// Project imports:

@ -1,10 +0,0 @@
import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart';
class AkuMap {
static Map<int, VisitorStatus> vistorStatus = {
1: VisitorStatus.NOT_VISIT,
2: VisitorStatus.VISIT_DONE,
3: VisitorStatus.OUTDATE,
4: VisitorStatus.CANCEL
};
}

@ -2,7 +2,6 @@
import 'dart:math';
// Flutter imports:
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
// Package imports:
@ -49,13 +48,15 @@ class _VisitorManagerCardState extends State<VisitorManagerCard> {
_adress = widget.adress;
_name = widget.name;
_plate = widget.plate ?? '无信息';
_time = widget.time;
_time = widget.time ?? '无信息';
_status = widget.status;
}
@override
Widget build(BuildContext context) {
return
return Column(
children: [
AkuBox.h(16),
Container(
color: Color(0xFFFFFFFF),
width: double.infinity,
@ -109,12 +110,7 @@ class _VisitorManagerCardState extends State<VisitorManagerCard> {
height: 40.w,
),
AkuBox.w(8),
Text(
_time==null
? '无信息'
: DateUtil.formatDateStr(_time,
format: DateFormats.y_mo_d_h_m),
style: _textStyle),
Text(_time, style: _textStyle),
Spacer(),
],
),
@ -134,7 +130,9 @@ class _VisitorManagerCardState extends State<VisitorManagerCard> {
),
],
),
);
),
],
);
}
String _statusImage(VisitorStatus status) {
@ -145,8 +143,6 @@ class _VisitorManagerCardState extends State<VisitorManagerCard> {
return R.ASSETS_MANAGE_IC_DAOFANG_PNG;
case VisitorStatus.OUTDATE:
return R.ASSETS_MANAGE_IC_GUOQI_PNG;
case VisitorStatus.CANCEL:
return R.ASSETS_MANAGE_IC_GUOQI_PNG;
default:
return '';
}

@ -1,10 +1,5 @@
// Flutter imports:
import 'package:aku_community_manager/models/visitor/visitor_cards_model.dart';
import 'package:aku_community_manager/tools/aku_map.dart';
import 'package:aku_community_manager/utils/manage_func.dart';
import 'package:aku_community_manager/utils/network/base_list_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
// Package imports:
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -14,14 +9,21 @@ import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_card.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart';
import 'package:velocity_x/velocity_x.dart';
enum VisitorStatus {
NOT_VISIT,
VISIT_DONE,
OUTDATE,
CANCEL,
}
class VisitorCardsModel {
String adress;
String name;
String plate;
String time;
VisitorStatus status;
VisitorCardsModel(
{this.adress, this.name, this.status, this.plate, this.time});
}
class VisitorManagerPage extends StatefulWidget {
@ -35,26 +37,32 @@ class VisitorManagerPage extends StatefulWidget {
class _VisitorManagerPageState extends State<VisitorManagerPage>
with TickerProviderStateMixin {
List<String> _tabs = ['全部', '未到访', '已到访', '已过期'];
int _page = 1;
int _size = 10;
EasyRefreshController _easyRefreshController;
List<VisitorCardsModel> _cards = [
VisitorCardsModel(
adress: '深圳华悦茂峰1幢1单元702',
name: '马泽城',
status: VisitorStatus.VISIT_DONE,
plate: '浙BA9899',
time: '2020-10-24 12:00',
),
VisitorCardsModel(
adress: '深圳华悦茂峰2幢2单元702', name: '刘揪心', status: VisitorStatus.NOT_VISIT),
VisitorCardsModel(
adress: '深圳华悦茂峰3幢3单元602', name: '张空间', status: VisitorStatus.OUTDATE),
];
TabController _tabController;
List<VisitorCardsModel> _models = [];
bool _onload = true;
@override
void initState() {
super.initState();
_tabController =
TabController(length: 4, vsync: this, initialIndex: widget.initIndex);
_easyRefreshController = EasyRefreshController();
}
@override
void dispose() {
_tabController?.dispose();
_easyRefreshController?.dispose();
super.dispose();
}
@ -74,77 +82,39 @@ class _VisitorManagerPageState extends State<VisitorManagerPage>
));
}
Widget _empty() {
return Container();
}
Widget _buildListView(int index) {
// switch (index) {
// case 0:
// _selectCards = _cards;
// break;
// case 1:
// _selectCards = _cards
// .where((element) => element.status == VisitorStatus.NOT_VISIT)
// .toList();
// break;
// case 2:
// _selectCards = _cards
// .where((element) => element.status == VisitorStatus.VISIT_DONE)
// .toList();
// break;
// case 3:
// _selectCards = _cards
// .where((element) => element.status == VisitorStatus.OUTDATE)
// .toList();
// break;
// }
return EasyRefresh(
firstRefresh: true,
controller: _easyRefreshController,
header: MaterialHeader(),
// emptyWidget: Container(),
onRefresh: () async {
_page = 1;
_size = 10;
BaseListModel baseListModel =
await ManageFunc.visitorList(_page, _size, statuts: index);
_models = baseListModel.tableList
.map((e) => VisitorCardsModel.fromJson(e))
List<VisitorCardsModel> _selectCards;
switch (index) {
case 0:
_selectCards = _cards;
break;
case 1:
_selectCards = _cards
.where((element) => element.status == VisitorStatus.NOT_VISIT)
.toList();
_onload = false;
setState(() {});
},
onLoad: () async {
_page++;
BaseListModel baseListModel =
await ManageFunc.visitorList(_page, _size, statuts: index);
_models.addAll(baseListModel.tableList
.map((e) => VisitorCardsModel.fromJson(e))
.toList());
if (_page >= baseListModel.pageCount) {
_easyRefreshController.finishLoad(noMore: true);
}
setState(() {});
},
child: _onload
? _empty()
: ListView(
padding: EdgeInsets.only(
left: 32.w, right: 32.w, top: 16.w, bottom: 16.w),
children: _models
.map(
(e) => VisitorManagerCard(
adress: e.roomName,
name: e.name,
plate: e.carNum,
time: e.visitDate,
status: AkuMap.vistorStatus[e.visitorStatus],
),
)
.toList()
.sepWidget(separate: 16.w.heightBox),
),
break;
case 2:
_selectCards = _cards
.where((element) => element.status == VisitorStatus.VISIT_DONE)
.toList();
break;
case 3:
_selectCards = _cards
.where((element) => element.status == VisitorStatus.OUTDATE)
.toList();
break;
}
return ListView(
padding: EdgeInsets.only(left: 32.w, right: 32.w),
children: _selectCards
.map((e) => VisitorManagerCard(
adress: e.adress,
name: e.name,
plate: e.plate,
time: e.time,
status: e.status,
))
.toList(),
);
}
}

@ -1,23 +0,0 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/utils/network/base_list_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
class ManageFunc {
static Future visitorList(int page, int size, {int statuts}) async {
BaseListModel baseListModel;
if (statuts == 0) {
baseListModel = await NetUtil().getList(API.manage.visitorList, params: {
'pageNum': page,
'size': size,
});
} else {
baseListModel = await NetUtil().getList(API.manage.visitorList, params: {
'pageNum': page,
'size': size,
'visitorStatus': statuts,
});
}
return baseListModel;
}
}
Loading…
Cancel
Save