From 31f8b116f689173656b5c2eb3c6ed1fdd2542e74 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Thu, 21 Jan 2021 17:20:49 +0800 Subject: [PATCH] update fixed submit add page's API --- lib/constants/api.dart | 5 ++- lib/pages/manager_func.dart | 17 ++++++++- .../widget/add_fixed_submit_page.dart | 36 +++++++++++++++---- 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index f9868770..5a42c98f 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -60,9 +60,12 @@ class _Manager { ///查询当前用户的报事报修信息 String get fixedSubmit => '/user/reportRepair/list'; - ///添加填写的访客信息 + ///访客通行:添加填写的访客信息 String get insertVisitorInfo => '/user/visitorAccess/insertVisitorInfo'; ///物品出户:查询当前用户所有的物品出户信息 String get articleOut => '/user/articleOut/list'; + + ///报事报修:app提交报事报修信息 + String get reportRepairInsert => '/user/reportRepair/insert'; } diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index 482a9bd3..5a6ebc73 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -14,9 +14,24 @@ class ManagerFunc { 'sex': sex, 'tel': tel, 'carNum': carNum, - 'expectedVisitDate': DateUtil.formatDate(expectedVisitDate,format: "yyyy-MM-dd HH:mm:ss") + 'expectedVisitDate': DateUtil.formatDate(expectedVisitDate, + format: "yyyy-MM-dd HH:mm:ss") }, showMessage: true); return baseModel; } + + static reportRepairInsert( + int type, String reportDetail, List fileUrls) async { + BaseModel baseModel = await NetUtil().post( + API.manager.reportRepairInsert, + params: { + 'type': type, + 'reportDetail': reportDetail, + 'fileUrls': fileUrls, + }, + showMessage: true, + ); + return baseModel; + } } diff --git a/lib/pages/things_page/widget/add_fixed_submit_page.dart b/lib/pages/things_page/widget/add_fixed_submit_page.dart index a7cd313e..f62af570 100644 --- a/lib/pages/things_page/widget/add_fixed_submit_page.dart +++ b/lib/pages/things_page/widget/add_fixed_submit_page.dart @@ -1,9 +1,11 @@ import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; @@ -18,8 +20,22 @@ class AddFixedSubmitPage extends StatefulWidget { } class _AddFixedSubmitPageState extends State { + TextEditingController _textEditingController; + String reportText; List _buttons = ['公区保修', '家庭维修']; - int _groupValue; + int _selectType; + @override + void initState() { + super.initState(); + _textEditingController = TextEditingController(); + } + + @override + void dispose() { + _textEditingController?.dispose(); + super.dispose(); + } + Widget _buildHouseCard( String title, String detail, @@ -74,23 +90,23 @@ class _AddFixedSubmitPageState extends State { height: 72.w, onPressed: () { setState(() { - _groupValue = value; + _selectType = value; }); }, child: title.text - .color(_groupValue == value ? ktextPrimary : ktextSubColor) + .color(_selectType == value ? ktextPrimary : ktextSubColor) .size(32.sp) .make(), padding: EdgeInsets.symmetric(horizontal: 34.w, vertical: 14.w), shape: RoundedRectangleBorder( side: BorderSide( - color: _groupValue == value ? kPrimaryColor : ktextSubColor, + color: _selectType == value ? kPrimaryColor : ktextSubColor, width: 3.w), borderRadius: BorderRadius.circular(36.w)), ); } - Widget _selectType() { + Widget _getType() { return Padding( padding: EdgeInsets.all(32.w), child: Column( @@ -128,6 +144,8 @@ class _AddFixedSubmitPageState extends State { ), width: 686.w, child: TextField( + controller: _textEditingController, + onEditingComplete: () {}, maxLines: 10, minLines: 5, decoration: InputDecoration( @@ -187,7 +205,7 @@ class _AddFixedSubmitPageState extends State { userProvider.userDetailModel.estateNames.isEmpty ? '' : userProvider.userDetailModel.estateNames[0]), - _selectType(), + _getType(), _buildReportCard(), _addImages(), ], @@ -195,7 +213,11 @@ class _AddFixedSubmitPageState extends State { MaterialButton( minWidth: double.infinity, height: 98.w, - onPressed: () {}, + onPressed: () { + ManagerFunc.reportRepairInsert( + _selectType + 1, _textEditingController.text, []); + Get.back(); + }, child: '确认提交'.text.black.bold.size(32.sp).make(), color: kPrimaryColor, elevation: 0,