添加访客分享页面

hmxc
小赖 4 years ago
parent 06ec3f9233
commit 1b4c523f95

@ -97,6 +97,8 @@ class _Manager {
///访访 ///访访
String get insertVisitorInfo => '/user/visitorAccess/insertVisitorInfo'; String get insertVisitorInfo => '/user/visitorAccess/insertVisitorInfo';
String get shareInvite => '/user/visitorInvite/share';
///访访 ///访访
String get visitorAccessList => '/user/visitorAccess/list'; String get visitorAccessList => '/user/visitorAccess/list';

@ -1,5 +1,6 @@
// Package imports: // Package imports:
import 'package:bot_toast/bot_toast.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
@ -12,8 +13,10 @@ import 'package:akuCommunity/model/manager/quetionnaire_submit_model.dart';
import 'package:akuCommunity/model/manager/voting_detail_model.dart'; import 'package:akuCommunity/model/manager/voting_detail_model.dart';
import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart'; import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:flutter/foundation.dart';
class ManagerFunc { class ManagerFunc {
@Deprecated('')
static insertVisitorInfo(int id, int type, String name, int sex, String tel, static insertVisitorInfo(int id, int type, String name, int sex, String tel,
String carNum, DateTime expectedVisitDate) async { String carNum, DateTime expectedVisitDate) async {
BaseModel baseModel = await NetUtil().post( BaseModel baseModel = await NetUtil().post(
@ -32,6 +35,35 @@ class ManagerFunc {
return baseModel; return baseModel;
} }
static Future<String> shareVisitor({
@required int estateId,
String name,
String tel,
int sex,
String carNumber,
DateTime date,
}) async {
final cancel = BotToast.showLoading();
Map<String, dynamic> params = {
'estateId': estateId,
};
if (name != null) params.putIfAbsent('name', () => name);
if (tel != null) params.putIfAbsent('tel', () => tel);
if (sex != null) params.putIfAbsent('sex', () => sex);
if (carNumber != null) params.putIfAbsent('carNumber', () => carNumber);
if (date != null)
params.putIfAbsent('visitDateStart', () => NetUtil.getDate(date));
Response response = await NetUtil().dio.post(
API.manager.shareInvite,
data: params,
);
cancel();
if (response.data['status'] && response.data['code'] != null) {
return response.data['code'];
}
return null;
}
static reportRepairInsert( static reportRepairInsert(
int id, int type, String reportDetail, List<String> fileUrls) async { int id, int type, String reportDetail, List<String> fileUrls) async {
BaseModel baseModel = await NetUtil().post( BaseModel baseModel = await NetUtil().post(

@ -1,3 +1,4 @@
import 'package:akuCommunity/widget/picker/bee_date_picker.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -6,6 +7,7 @@ import 'package:flustars/flustars.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:share/share.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/pages/manager_func.dart';
@ -17,7 +19,6 @@ import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_divider.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/common_input.dart'; import 'package:akuCommunity/widget/common_input.dart';
import 'package:akuCommunity/widget/picker/bee_date_picker.dart';
class VisitorAccessPage extends StatefulWidget { class VisitorAccessPage extends StatefulWidget {
VisitorAccessPage({Key key}) : super(key: key); VisitorAccessPage({Key key}) : super(key: key);
@ -117,33 +118,33 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
IconData sexIcon, IconData sexIcon,
int value, int value,
) { ) {
return InkWell( return MaterialButton(
onTap: () { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
elevation: 0,
onPressed: () {
setState(() { setState(() {
_selectSex = value; _selectSex = value;
}); });
}, },
child: Container(
height: 72.w, height: 72.w,
width: 176.w, minWidth: 176.w,
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 13.w, vertical: 13.w,
), ),
decoration: BoxDecoration(
color: Color(0xffffffff), color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(36)), shape: StadiumBorder(
border: Border.all( side: BorderSide(
color: width: 1.w,
value == _selectSex ? Color(0xffffc40c) : Color(0xff979797), color: value == _selectSex ? Color(0xffffc40c) : Color(0xff979797),
width: 1)), ),
),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Icon( Icon(
sexIcon, sexIcon,
size: 32.sp, size: 32.sp,
color: color: value == _selectSex ? Color(0xff333333) : Color(0xff979797),
value == _selectSex ? Color(0xff333333) : Color(0xff979797),
), ),
SizedBox(width: 9.w), SizedBox(width: 9.w),
Text( Text(
@ -157,7 +158,6 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
), ),
], ],
), ),
),
); );
} }
@ -217,7 +217,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
Text( Text(
dateTime == null dateTime == null
? '请选择到访时间' ? '请选择到访时间'
: '${dateTime.toString().substring(0, 11)}', : '${DateUtil.formatDate(dateTime, format: 'yyyy-MM-dd')}',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 34.sp, fontSize: 34.sp,
@ -244,26 +244,20 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
int type, int type,
String tel, String tel,
) { ) {
final appProvider = Provider.of<AppProvider>(context);
return MaterialButton( return MaterialButton(
onPressed: () async { onPressed: () async {
if (formKey.currentState.validate()) { String result = await ManagerFunc.shareVisitor(
if (dateTime == null) { estateId: appProvider.selectedHouse.estateId,
BotToast.showText(text: '请选择到访时间'); name: _userName.text,
return; sex: _selectSex,
} carNumber: _userCarNum.text,
VoidCallback cancel = BotToast.showLoading(); date: dateTime,
await ManagerFunc.insertVisitorInfo( tel: tel,
id,
type,
_userName.text,
_selectSex,
tel,
_userCarNum.text,
dateTime,
); );
cancel(); if (result != null)
Get.off(VisitorRecordPage()); Share.share(
} 'http://test.akuhotel.com:8804/static/dist/index.html#/visitor?$result');
}, },
minWidth: double.infinity, minWidth: double.infinity,
height: 96.w, height: 96.w,

@ -7,8 +7,15 @@ import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/widget/picker/bee_custom_picker.dart'; import 'package:akuCommunity/widget/picker/bee_custom_picker.dart';
class BeeDatePicker { class BeeDatePicker {
static Future<DateTime> pick(DateTime initDate) async { static Future<DateTime> pick(
return await Get.bottomSheet(_BeeDatePicker(date: initDate)); DateTime initDate, {
CupertinoDatePickerMode mode = CupertinoDatePickerMode.date,
}) async {
return await Get.bottomSheet(_BeeDatePicker(
date: initDate,
mode: mode,
min: DateTime.now().subtract(Duration(days: 1)),
));
} }
static Future<DateTime> timePicker(DateTime initDate) async { static Future<DateTime> timePicker(DateTime initDate) async {
@ -27,14 +34,14 @@ class _BeeDatePicker extends StatefulWidget {
final DateTime max; final DateTime max;
final DateTime min; final DateTime min;
final CupertinoDatePickerMode mode; final CupertinoDatePickerMode mode;
_BeeDatePicker( _BeeDatePicker({
{Key key, Key key,
@required this.date, @required this.date,
this.use24H = false, this.use24H = false,
this.max, this.max,
this.min, this.min,
this.mode}) this.mode,
: super(key: key); }) : super(key: key);
@override @override
__BeeDatePickerState createState() => __BeeDatePickerState(); __BeeDatePickerState createState() => __BeeDatePickerState();

@ -443,6 +443,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
nested: nested:
dependency: transitive dependency: transitive
description: description:
@ -592,6 +599,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
share:
dependency: "direct main"
description:
name: share
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.1"
shared_preferences: shared_preferences:
dependency: transitive dependency: transitive
description: description:

@ -64,6 +64,7 @@ dependencies:
animated_text_kit: ^4.1.1 animated_text_kit: ^4.1.1
firebase_core: ^1.0.3 firebase_core: ^1.0.3
firebase_crashlytics: ^2.0.0 firebase_crashlytics: ^2.0.0
share: ^2.0.1
dev_dependencies: dev_dependencies:

Loading…
Cancel
Save