From 876eb16fdd766c5cd362ab3eb5d163a2da3b35d0 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 25 Jun 2021 10:36:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=20=E7=A7=9F=E8=B5=81?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 25 ++++++++++- lib/ui/profile/house/house_func.dart | 35 +++++++++++++-- lib/ui/profile/house/user_identify_page.dart | 47 ++++++++++++++++++-- 3 files changed, 99 insertions(+), 8 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 36b3c484..742fe57d 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -22,6 +22,7 @@ class API { static _News news = _News(); static _Search search = _Search(); static _Pay pay = _Pay(); + static _House house = _House(); } class _Login { @@ -275,7 +276,6 @@ class _Manager { ///门禁二维码:app获取设备二维码 String get getDoorQrCode => '/user/doorQRCode/getQrCode'; - } class _Community { @@ -377,6 +377,12 @@ class _Upload { String get uploadRepair => '/user/upload/uploadRepair'; String get uploadEvent => '/user/upload/uploadGambit'; + + ///上传身份证照片正面 + String get uploadCardFront => '/user/upload/uploadAppIdCardFront'; + + ///上传身份证背面照片 + String get uploadCardBack => '/user/upload/uploadAppIdCardBack'; } class _Message { @@ -444,3 +450,20 @@ class _Pay { ///支付宝支付:报事报修 向支付宝发起订单查询请求 String get reportReapirCheck => '/user/alipay/reportRepairCheckAlipay'; } + +class _House { + ///我的房屋:租赁认证 + String get leaseCertification => '/user/myHouse/leaseCertification'; + + ///我的房屋:租赁认证信息回显 + String get leaseEcho => '/user/myHouse/leaseEcho'; + + ///我的房屋:查询所有的租赁信息 + String get leaseList => '/user/myHouse/leaseList'; + + ///我的房屋:根据租赁主键id查询租赁信息 + String get leaseFindByld => '/user/myHouse/leaseFindById'; + + ///我的房屋:提交个人租赁信息 + String get submitLeaseInfo => '/user/myHouse/submitPersonalLeaseInfo'; +} diff --git a/lib/ui/profile/house/house_func.dart b/lib/ui/profile/house/house_func.dart index 29dd2127..01c035e7 100644 --- a/lib/ui/profile/house/house_func.dart +++ b/lib/ui/profile/house/house_func.dart @@ -3,6 +3,7 @@ import 'package:aku_community/model/user/house_model.dart'; import 'package:aku_community/models/user/passed_house_list_model.dart'; import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/net_util.dart'; +import 'package:bot_toast/bot_toast.dart'; class HouseFunc { ///查询所有的房屋审核信息 @@ -13,9 +14,37 @@ class HouseFunc { } ///查询用户所拥有的房屋信息 - static Future> get passedHouses async{ - BaseModel model = await NetUtil().get(API.user.passedHouseList); + static Future> get passedHouses async { + BaseModel model = await NetUtil().get(API.user.passedHouseList); if (!model.status!) return []; - return (model.data as List).map((e) => PassedHouseListModel.fromJson(e)).toList(); + return (model.data as List) + .map((e) => PassedHouseListModel.fromJson(e)) + .toList(); } + + ///我的房屋 租赁认证 + Future leaseCertification( + String name, + String sex, + String tel, + String idNumber, + ) async { + BaseModel baseModel = + await NetUtil().post(API.house.leaseCertification, params: { + "name": name, + "sex": getSex[sex], + "tel": tel, + "idNumber": idNumber, + }); + if (baseModel.status ?? false) { + BotToast.showText(text: '提交成功'); + return true; + } + return false; } + + Map getSex = { + '男': 1, + '女': 2, + }; +} diff --git a/lib/ui/profile/house/user_identify_page.dart b/lib/ui/profile/house/user_identify_page.dart index d536b7ae..8a03fd51 100644 --- a/lib/ui/profile/house/user_identify_page.dart +++ b/lib/ui/profile/house/user_identify_page.dart @@ -1,8 +1,10 @@ import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/ui/profile/house/house_func.dart'; import 'package:aku_community/ui/profile/house/tenant_house_list_page.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/bottom_button.dart'; import 'package:aku_community/widget/others/bee_input_row.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -83,12 +85,47 @@ class _UserIdentifyPageState extends State { ), bottomNavi: BottomButton( onPressed: () async { - await Get.dialog(_errorDialog()); + if (canSubmit) { + bool result = await HouseFunc().leaseCertification( + _nameController.text, + _sex, + _phoneController.text, + _indentifyCodeController.text); + if (result) { + Get.off(() => TenantHouseListPage()); + } else { + await Get.dialog(_errorDialog()); + } + } }, child: '提交'.text.size(32.sp).bold.color(ktextPrimary).make()), ); } + bool get canSubmit { + if (_nameController.text.isEmpty) { + BotToast.showText(text: '姓名不能为空!'); + return false; + } + if (_phoneController.text.isEmpty) { + BotToast.showText(text: '手机号码不能为空!'); + return false; + } + if (_indentifyCodeController.text.isEmpty) { + BotToast.showText(text: '身份证号码不能为空!'); + return false; + } + if (_sex == '请选择性别') { + BotToast.showText(text: '请先选择性别'); + return false; + } + if (_identify == '请选择身份') { + BotToast.showText(text: '请先选择身份'); + return false; + } + return true; + } + Widget _sexBottomSheet() { return CupertinoActionSheet( title: @@ -142,7 +179,9 @@ class _UserIdentifyPageState extends State { return CupertinoAlertDialog( title: '账户不存在'.text.size(34.sp).color(ktextPrimary).bold.isIntrinsic.make(), - content: '原因:用户未具备相关资格' + content: '''原因: + 1.用户未具备相关资格 + 2.用户填写的姓名及身份证号与登记在册的姓名及身份证号并不一致''' .text .size(26.sp) .color(ktextPrimary) @@ -159,9 +198,9 @@ class _UserIdentifyPageState extends State { CupertinoDialogAction( onPressed: () { Get.back(); - Get.off(() => TenantHouseListPage()); + Get.back(); }, - child: '修改信息' + child: '回到首页' .text .size(34.sp) .isIntrinsic