对接:上传现场拍摄照片

对接:上传自拍人脸
hmxc
张萌 4 years ago
parent c5c115d6fc
commit 885f255bb2

@ -191,6 +191,12 @@ class _Upload {
///
String get uploadArtical => '/user/upload/uploadArticle';
///
String get uploadInspectionSpace => '/user/upload/uploadInspectionSpace';
///
String get uploadInspectionFace => '/user/upload/uploadInspectionFace';
}
class _Message {

@ -5,12 +5,18 @@ class InspectionPointSubmitModel {
List<ExecuteCheckList> executeCheckList;
File inspectionFaceImg;
File inspectionSpaceImg;
InspectionPointSubmitModel();
String inspectionFaceImgPath;
String inspectionSpaceImgPath;
InspectionPointSubmitModel(this.executePointId, this.executeCheckList,
{this.inspectionFaceImg,
this.inspectionSpaceImg,
this.inspectionFaceImgPath,
this.inspectionSpaceImgPath});
}
class ExecuteCheckList {
int id;
int status;
String remarks;
ExecuteCheckList();
ExecuteCheckList(this.id, this.status, this.remarks);
}

@ -151,7 +151,7 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
Text('规定巡检时间', style: _textstyle),
Spacer(),
Text(
'${widget.cardModel.beginDate.akuDate()}${widget.cardModel?.endDate == null ? '' : ''}${widget.cardModel?.endDate == null ? '' : widget.cardModel.endDate.akuDate()}',
'${widget.cardModel.beginDate.akuDate()}${widget.cardModel?.endDate == null ? '' : ''}${widget.cardModel?.endDate == null ? '' : DateUtil.formatDateStr(widget.cardModel.endDate, format: "HH:mm")}',
style: AppStyle().primaryStyle,
),
],

@ -138,7 +138,8 @@ class _InspectionManageDetailsPageState
API.manage.inspectionStart,
params: {"executeId": widget.executeId});
if (_baseModel.status) {
setState(() {});
BotToast.showText(text: _baseModel.message);
_refreshController.callRefresh();
} else {
BotToast.showText(text: _baseModel.message);
}
@ -192,6 +193,9 @@ class _InspectionManageDetailsPageState
.make(),
actions: [
CupertinoDialogAction(
onPressed: () {
Get.back();
},
child: '确定'
.text
.isIntrinsic
@ -359,11 +363,11 @@ class _InspectionManageDetailsPageState
return Row(
children: [
CircleAvatar(
child: '$index'
child: '${index + 1}'
.text
.color(model.completeDate == null
? Color(0xFFA6CBFF)
: Color(0xFF3F8FFE))
? Color(0xFF3F8FFE)
: Color(0xFFA6CBFF))
.size(28.sp)
.bold
.make(),
@ -372,6 +376,7 @@ class _InspectionManageDetailsPageState
),
24.w.widthBox,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
model.name.text
.color(model.completeDate == null

@ -36,6 +36,16 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
_easyRefreshController = EasyRefreshController();
}
String inspectionPattern(int type) {
switch (type) {
case 1:
return '巡检模式1';
break;
default:
return '';
}
}
@override
void dispose() {
_easyRefreshController?.dispose();
@ -92,6 +102,8 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
child: Placeholder(),
)
: DottedBorder(
borderType: BorderType.RRect,
dashPattern: [6, 3],
color: Color(0xFF999999),
strokeWidth: 2.w,
radius: Radius.circular(8.w),
@ -106,6 +118,7 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
R.ASSETS_MANAGE_IC_IMAGE_PNG,
width: 60.w,
height: 60.w,
color: Color(0xFF999999),
),
4.w.heightBox,
'上传图片'.text.color(kTextSubColor).size(22.sp).bold.make(),
@ -138,6 +151,8 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
child: Placeholder(),
)
: DottedBorder(
borderType: BorderType.RRect,
dashPattern: [6, 3],
color: Color(0xFF999999),
strokeWidth: 2.w,
radius: Radius.circular(8.w),
@ -152,6 +167,7 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
R.ASSETS_MANAGE_IC_IMAGE_PNG,
width: 60.w,
height: 60.w,
color: Color(0xFF999999),
),
4.w.heightBox,
'上传图片'.text.color(kTextSubColor).size(22.sp).bold.make(),
@ -222,6 +238,7 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
.size(32.sp)
.bold
.make()),
80.w.widthBox,
Container(
width: 180.w,
height: 72.w,
@ -323,7 +340,7 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
),
36.w.widthBox,
Text(
model.name,
widget.executeName,
maxLines: 2,
textAlign: TextAlign.right,
style: AppStyle().primaryStyle,
@ -385,11 +402,15 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
),
Spacer(),
Text(
'${model.type}',
'${inspectionPattern(model.type)}',
style: AppStyle().primaryStyle,
),
],
),
...model.completeDate == null
? []
: [
12.w.heightBox,
Row(
children: [
Image.asset(
@ -408,7 +429,8 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
style: AppStyle().primaryStyle,
),
],
)
),
]
]),
),
],

@ -2,12 +2,17 @@ import 'package:aku_community_manager/models/manager/inspection/inspection_point
import 'package:aku_community_manager/models/manager/inspection/inspection_qrcode_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_utils.dart';
import 'package:aku_community_manager/ui/sub_pages/manage_func.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_pick_image_widget.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:aku_ui/aku_ui.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class InspectionPointInputPage extends StatefulWidget {
@ -24,10 +29,31 @@ class InspectionPointInputPage extends StatefulWidget {
class _InspectionPointInputPageState extends State<InspectionPointInputPage> {
InspectionPointSubmitModel _submitModel;
InspectionQRCodeModel _model;
bool get canSubmit {
if (_submitModel.inspectionFaceImg == null &&
_submitModel.inspectionSpaceImg == null) {
return false;
} else {
if (_submitModel.executeCheckList.isNotEmpty) {
return true;
} else {
return false;
}
}
}
@override
void initState() {
super.initState();
_model = widget.qrModel;
_submitModel = InspectionPointSubmitModel(
widget.qrModel.id,
[],
);
_submitModel.executeCheckList = List.generate(
widget.qrModel.checkVoList.length,
(index) => ExecuteCheckList(widget.qrModel.checkVoList[index].id, -1, ''),
);
}
@override
@ -52,10 +78,31 @@ class _InspectionPointInputPageState extends State<InspectionPointInputPage> {
],
),
bottom: AkuButton(
onPressed: canSubmit
? () async {
_submitModel.inspectionFaceImgPath =
await ManageFunc.uploadFace(_submitModel.inspectionFaceImg);
_submitModel.inspectionSpaceImg = await ManageFunc.uploadSpace(
_submitModel.inspectionSpaceImg);
BaseModel baseModel =
await ManageFunc.getSubmitPoint(_submitModel);
if (baseModel.status) {
BotToast.showText(text: baseModel.message);
Get.back();
} else {
BotToast.showText(text: baseModel.message);
}
}
: () {},
width: double.infinity,
height: 100.w,
child: '立即提交'.text.color(kTextPrimaryColor).bold.size(32.sp).make(),
color: kPrimaryColor,
child: '立即提交'
.text
.color(canSubmit ? kTextPrimaryColor : kTextSubColor)
.bold
.size(32.sp)
.make(),
color: canSubmit ? Color(0xFFFFC40C) : Color(0xFFFFE67D),
padding: EdgeInsets.symmetric(vertical: 26.w),
).pOnly(bottom: MediaQuery.of(context).padding.bottom),
);
@ -63,6 +110,7 @@ class _InspectionPointInputPageState extends State<InspectionPointInputPage> {
Widget _scenePhotoCard() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
@ -73,14 +121,20 @@ class _InspectionPointInputPageState extends State<InspectionPointInputPage> {
AkuPickImageWidget(
onChanged: (file) {
_submitModel.inspectionFaceImg = file;
setState(() {});
},
),
],
).box.color(Colors.white).make();
)
.box
.color(Colors.white)
.padding(EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w))
.make();
}
Widget _selfPhotoCard() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
@ -91,10 +145,15 @@ class _InspectionPointInputPageState extends State<InspectionPointInputPage> {
AkuPickImageWidget(
onChanged: (file) {
_submitModel.inspectionSpaceImg = file;
setState(() {});
},
),
)
],
).box.color(Colors.white).make();
)
.box
.color(Colors.white)
.padding(EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w))
.make();
}
Widget _meterCard(
@ -117,15 +176,17 @@ class _InspectionPointInputPageState extends State<InspectionPointInputPage> {
gropValue: _submitModel.executeCheckList[index].status,
onPressed: () {
_submitModel.executeCheckList[index].status = 0;
setState(() {});
},
),
80.w.widthBox,
AkuSingleCheckButton(
text: '异常',
value: 0,
value: 1,
gropValue: _submitModel.executeCheckList[index].status,
onPressed: () {
_submitModel.executeCheckList[index].status = 1;
setState(() {});
},
),
],
@ -168,6 +229,8 @@ class _InspectionPointInputPageState extends State<InspectionPointInputPage> {
),
child: TextField(
minLines: 5,
maxLines: 10,
autofocus: false,
onChanged: (value) {
_submitModel.executeCheckList[index].remarks = value;
},
@ -177,7 +240,8 @@ class _InspectionPointInputPageState extends State<InspectionPointInputPage> {
fontSize: 28.sp,
color: kTextSubColor,
),
contentPadding: EdgeInsets.zero,
contentPadding:
EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w),
border: InputBorder.none,
isDense: true,
),

@ -40,6 +40,7 @@ class _QrScannerPageState extends State<QrScannerPage> {
viewController.scannedDataStream.listen((event) {
setState(() {
result = event;
viewController.stopCamera();
Get.back(result: result);
});
});

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/decoration/decoration_detail_model.dart';
import 'package:aku_community_manager/models/manager/inspection/inspection_check_detail_model.dart';
@ -53,7 +55,7 @@ class ManageFunc {
{@required int excuteId}) async {
BaseModel baseModel = await NetUtil()
.get(API.manage.inspecntionFindPointByExecuteId, params: {
"planId": excuteId,
"executeId": excuteId,
});
return (baseModel.data as List)
.map((e) => InspectionPointModel.fromJson(e))
@ -69,16 +71,15 @@ class ManageFunc {
}
static Future getSubmitPoint(InspectionPointSubmitModel model) async {
Response response = await NetUtil()
.dio
.post(API.manage.submitPointDetail, queryParameters: {
BaseModel baseModel =
await NetUtil().post(API.manage.submitPointDetail, params: {
"executePointId": model.executePointId,
"executeCheckList": model.executeCheckList,
"inspectionFaceImg": [],
"inspectionSpaceImg": []
});
return response.data;
return baseModel;
}
static Future<InspectionCheckDetialModel> getInspectionPointCheckDetail(
@ -89,4 +90,16 @@ class ManageFunc {
});
return InspectionCheckDetialModel.fromJson(baseModel.data);
}
static Future uploadFace(File file) async {
BaseModel baseModel = await NetUtil()
.post(API.upload.uploadInspectionFace, params: {"file": file});
return baseModel.data as String;
}
static Future uploadSpace(File file) async {
BaseModel baseModel = await NetUtil()
.post(API.upload.uploadInspectionSpace, params: {"file": file});
return baseModel.data as String;
}
}

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:aku_community_manager/const/resource.dart';
@ -21,14 +22,48 @@ class _AkuPickImageWidgetState extends State<AkuPickImageWidget> {
File _file;
@override
Widget build(BuildContext context) {
return GestureDetector(
return _file != null
? Stack(children: [
Container(
width: widget.size ?? 160.w,
height: widget.size ?? 160.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: kBackgroundColor),
child: Image.file(_file),
),
Positioned(
top: 8.w,
right: 8.w,
child: Container(
width: 40.w,
height: 40.w,
child: Icon(
CupertinoIcons.xmark,
size: 20.w,
color: Colors.white,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.w),
color: Color(0xFF000000),
),
).onTap(() {
_file = null;
setState(() {});
}),
)
])
: GestureDetector(
onTap: () async {
await akuPickImage().then((value) => _file = File(value.path));
widget.onChanged(_file);
setState(() {});
},
child: DottedBorder(
color: Color(0xFF999999),
borderType: BorderType.RRect,
strokeWidth: 2.w,
dashPattern: [6, 3],
radius: Radius.circular(8.w),
child: Container(
width: widget.size ?? 160.w,
@ -41,6 +76,7 @@ class _AkuPickImageWidgetState extends State<AkuPickImageWidget> {
R.ASSETS_MANAGE_IC_IMAGE_PNG,
width: 60.w,
height: 60.w,
color: Color(0xFF999999),
),
4.w.heightBox,
'上传图片'.text.color(kTextSubColor).size(22.sp).bold.make(),

@ -20,6 +20,7 @@ class _AkuSingleCheckButtonState extends State<AkuSingleCheckButton> {
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: isSelect ? Color(0xFFFFF8E0) : Colors.white,
border: Border.all(
@ -29,13 +30,12 @@ class _AkuSingleCheckButtonState extends State<AkuSingleCheckButton> {
width: 180.w,
height: 72.w,
child: widget.text.text
.color(isSelect ? Color(0xFF999999) : Color(0xFF333333))
.color(isSelect ? Color(0xFF333333) : Color(0xFF999999))
.bold
.size(32.sp)
.make(),
).onInkTap(() {
widget.onPressed();
setState(() {});
});
}
}

Loading…
Cancel
Save