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

@ -1,10 +1,5 @@
// Flutter imports: // 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/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
// Package imports: // Package imports:
import 'package:flutter_screenutil/flutter_screenutil.dart'; 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/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/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.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 { enum VisitorStatus {
NOT_VISIT, NOT_VISIT,
VISIT_DONE, VISIT_DONE,
OUTDATE, 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 { class VisitorManagerPage extends StatefulWidget {
@ -35,26 +37,32 @@ class VisitorManagerPage extends StatefulWidget {
class _VisitorManagerPageState extends State<VisitorManagerPage> class _VisitorManagerPageState extends State<VisitorManagerPage>
with TickerProviderStateMixin { with TickerProviderStateMixin {
List<String> _tabs = ['全部', '未到访', '已到访', '已过期']; List<String> _tabs = ['全部', '未到访', '已到访', '已过期'];
int _page = 1;
int _size = 10; List<VisitorCardsModel> _cards = [
EasyRefreshController _easyRefreshController; 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; TabController _tabController;
List<VisitorCardsModel> _models = [];
bool _onload = true;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_tabController = _tabController =
TabController(length: 4, vsync: this, initialIndex: widget.initIndex); TabController(length: 4, vsync: this, initialIndex: widget.initIndex);
_easyRefreshController = EasyRefreshController();
} }
@override @override
void dispose() { void dispose() {
_tabController?.dispose(); _tabController?.dispose();
_easyRefreshController?.dispose();
super.dispose(); super.dispose();
} }
@ -74,77 +82,39 @@ class _VisitorManagerPageState extends State<VisitorManagerPage>
)); ));
} }
Widget _empty() {
return Container();
}
Widget _buildListView(int index) { Widget _buildListView(int index) {
// switch (index) { List<VisitorCardsModel> _selectCards;
// case 0: switch (index) {
// _selectCards = _cards; case 0:
// break; _selectCards = _cards;
// case 1: break;
// _selectCards = _cards case 1:
// .where((element) => element.status == VisitorStatus.NOT_VISIT) _selectCards = _cards
// .toList(); .where((element) => element.status == VisitorStatus.NOT_VISIT)
// 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))
.toList(); .toList();
_onload = false; break;
setState(() {}); case 2:
}, _selectCards = _cards
onLoad: () async { .where((element) => element.status == VisitorStatus.VISIT_DONE)
_page++; .toList();
BaseListModel baseListModel = break;
await ManageFunc.visitorList(_page, _size, statuts: index); case 3:
_models.addAll(baseListModel.tableList _selectCards = _cards
.map((e) => VisitorCardsModel.fromJson(e)) .where((element) => element.status == VisitorStatus.OUTDATE)
.toList()); .toList();
if (_page >= baseListModel.pageCount) { break;
_easyRefreshController.finishLoad(noMore: true); }
} return ListView(
setState(() {}); padding: EdgeInsets.only(left: 32.w, right: 32.w),
}, children: _selectCards
child: _onload .map((e) => VisitorManagerCard(
? _empty() adress: e.adress,
: ListView( name: e.name,
padding: EdgeInsets.only( plate: e.plate,
left: 32.w, right: 32.w, top: 16.w, bottom: 16.w), time: e.time,
children: _models status: e.status,
.map( ))
(e) => VisitorManagerCard( .toList(),
adress: e.roomName,
name: e.name,
plate: e.carNum,
time: e.visitDate,
status: AkuMap.vistorStatus[e.visitorStatus],
),
)
.toList()
.sepWidget(separate: 16.w.heightBox),
),
); );
} }
} }

@ -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