添加访客分享页面

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

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

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

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

@ -443,6 +443,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
nested:
dependency: transitive
description:
@ -592,6 +599,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:

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

Loading…
Cancel
Save