对接:二维码扫描

添加:扫描异常弹窗
hmxc
张萌 4 years ago
parent 7fabd5db14
commit d06397726a

@ -153,6 +153,10 @@ class _Manage {
///id ///id
String get inspecntionFindPointByExecuteId => String get inspecntionFindPointByExecuteId =>
'/user/inspection/findPointByExecuteId'; '/user/inspection/findPointByExecuteId';
///
String get inspectionFindCheckDetailByQR =>
'/user/inspection/findCheckDetailByQR';
} }
class _Upload { class _Upload {

@ -2,6 +2,8 @@
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/inspection/inspection_detail_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_detail_model.dart';
import 'package:aku_community_manager/models/manager/inspection/inspection_point_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_point_model.dart';
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_point_input_page.dart';
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/qr_code_parase.dart';
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/qr_scanner_page.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/qr_scanner_page.dart';
import 'package:aku_community_manager/ui/sub_pages/manage_func.dart'; import 'package:aku_community_manager/ui/sub_pages/manage_func.dart';
import 'package:aku_community_manager/utils/network/base_model.dart'; import 'package:aku_community_manager/utils/network/base_model.dart';
@ -13,6 +15,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community_manager/utils/extension/list_extension.dart'; import 'package:aku_community_manager/utils/extension/list_extension.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
@ -139,8 +142,21 @@ class _InspectionManageDetailsPageState
BotToast.showText(text: _baseModel.message); BotToast.showText(text: _baseModel.message);
} }
} }
: () { : () async {
Get.to(() => QrScannerPage()); Barcode result = await Get.to(() => QrScannerPage());
BaseModel baseModel =
await ManageFunc.getInspectionFindCheckDetailByQr(
_detailModel.id,
QRCodeParase.getExecutePointId(result.code));
if (baseModel.status) {
Get.to(() => InspectionPointInputPage());
} else {
showCupertinoDialog(
context: context,
builder: (context) {
return _errorDialog();
});
}
}, },
padding: EdgeInsets.symmetric(vertical: 26.w), padding: EdgeInsets.symmetric(vertical: 26.w),
color: kPrimaryColor, color: kPrimaryColor,
@ -154,6 +170,34 @@ class _InspectionManageDetailsPageState
: SizedBox()); : SizedBox());
} }
Widget _errorDialog() {
return CupertinoAlertDialog(
title: '扫码异常'
.text
.isIntrinsic
.color(kTextPrimaryColor)
.bold
.size(36.sp)
.make(),
content: '请扫描此次巡检点二维码'
.text
.isIntrinsic
.color(kTextPrimaryColor)
.size(30.sp)
.make(),
actions: [
CupertinoDialogAction(
child: '确定'
.text
.isIntrinsic
.color(Color(0xFFFF4501))
.bold
.size(36.sp)
.make())
],
);
}
Widget _inspectionHeadCard() { Widget _inspectionHeadCard() {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

@ -1,7 +1,6 @@
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/inspection/inspection_list_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_list_model.dart';
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_card.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_card.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';

@ -0,0 +1,5 @@
class QRCodeParase {
static int getExecutePointId(String qrCode) {
return int.parse(qrCode);
}
}

@ -1,6 +1,8 @@
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.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:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart'; import 'package:qr_code_scanner/qr_code_scanner.dart';
class QrScannerPage extends StatefulWidget { class QrScannerPage extends StatefulWidget {
@ -38,6 +40,7 @@ class _QrScannerPageState extends State<QrScannerPage> {
viewController.scannedDataStream.listen((event) { viewController.scannedDataStream.listen((event) {
setState(() { setState(() {
result = event; result = event;
Get.back(result: result);
}); });
}); });
}), }),

@ -57,4 +57,12 @@ class ManageFunc {
.map((e) => InspectionPointModel.fromJson(e)) .map((e) => InspectionPointModel.fromJson(e))
.toList(); .toList();
} }
static Future<BaseModel> getInspectionFindCheckDetailByQr(
int executeId, int excutePointId) async {
BaseModel baseModel = await NetUtil().get(
API.manage.inspectionFindCheckDetailByQR,
params: {"executeId": executeId, "executePointId": excutePointId});
return baseModel;
}
} }

Loading…
Cancel
Save