From 38dcecbc30ab47b93d4cc3d44d3ce4e53b4a1de1 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 22 Jun 2021 16:29:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E5=8F=AF=E9=80=89?= =?UTF-8?q?=E6=88=BF=E5=B1=8B=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E8=A1=A5=E5=85=85=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/model/user/house_model.dart | 4 +- lib/models/user/passed_house_list_model.dart | 2 +- .../event_activity/voting_detail_page.dart | 2 +- lib/pages/splash/splash_page.dart | 18 ++- lib/provider/user_provider.dart | 30 ++-- lib/ui/profile/house/add_house_page.dart | 2 +- lib/ui/profile/house/house_owners_page.dart | 6 +- .../house/supplement_information_page.dart | 54 +++++++ .../profile/house/tenant_house_list_page.dart | 132 ++++++++++++++++++ lib/ui/profile/house/user_identify_page.dart | 3 +- lib/utils/network/base_model.dart | 2 +- lib/widget/bee_scaffold.dart | 2 +- lib/widget/buttons/card_bottom_button.dart | 2 +- lib/widget/buttons/column_action_button.dart | 2 +- lib/widget/picker/bee_image_preview.dart | 3 +- lib/widget/picker/identify_card_picker.dart | 19 +++ 16 files changed, 251 insertions(+), 32 deletions(-) create mode 100644 lib/ui/profile/house/supplement_information_page.dart create mode 100644 lib/ui/profile/house/tenant_house_list_page.dart create mode 100644 lib/widget/picker/identify_card_picker.dart diff --git a/lib/model/user/house_model.dart b/lib/model/user/house_model.dart index 7a83f213..92fedd1b 100644 --- a/lib/model/user/house_model.dart +++ b/lib/model/user/house_model.dart @@ -19,7 +19,7 @@ class HouseModel { DateTime? get effectiveStartDate => DateUtil.getDateTime(effectiveTimeStart!); DateTime? get effectiveEndDate => DateUtil.getDateTime(effectiveTimeEnd!); - //TODO 未通过状态 + // bool get reviewed => status == 4; String get typeValue { switch (type) { @@ -51,7 +51,7 @@ class HouseModel { ///我的房屋页面背景颜色 /// List get backgroundColor { - //TODO 未通过状态 + if (status != 4) return [ Color(0xFFF5F5F5), diff --git a/lib/models/user/passed_house_list_model.dart b/lib/models/user/passed_house_list_model.dart index 0190c056..e2086ee7 100644 --- a/lib/models/user/passed_house_list_model.dart +++ b/lib/models/user/passed_house_list_model.dart @@ -50,7 +50,7 @@ class PassedHouseListModel extends Equatable { ///我的房屋页面背景颜色 /// List get backgroundColor { - //TODO 未通过状态 + // if (status != 4) // return [ // Color(0xFFF5F5F5), diff --git a/lib/pages/event_activity/voting_detail_page.dart b/lib/pages/event_activity/voting_detail_page.dart index f4973e01..f2d25d8d 100644 --- a/lib/pages/event_activity/voting_detail_page.dart +++ b/lib/pages/event_activity/voting_detail_page.dart @@ -255,7 +255,7 @@ class _VotingDetailPageState extends State { // .text // .color(Color(0xFF999999)) // .size(32.sp) - // .make(), //TODO:缺少字段; + // .make(), // 26.w.heightBox, ..._model.appVoteCandidateVos! .map((e) => _buildVoteCard(e)) diff --git a/lib/pages/splash/splash_page.dart b/lib/pages/splash/splash_page.dart index 11a222f7..9cbc9178 100644 --- a/lib/pages/splash/splash_page.dart +++ b/lib/pages/splash/splash_page.dart @@ -41,13 +41,17 @@ class _SplashPageState extends State { Future _initOp() async { //ensure call _originOp first. - await _originOp(); - final userProvider = Provider.of(context, listen: false); - final appProvider = Provider.of(context, listen: false); - appProvider.initApplications(); - appProvider.startLocation(); - if (HiveStore.appBox!.get('login') ?? false) { - await userProvider.setLogin(HiveStore.appBox!.get('token')); + try { + await _originOp(); + final userProvider = Provider.of(context, listen: false); + final appProvider = Provider.of(context, listen: false); + appProvider.initApplications(); + appProvider.startLocation(); + if (HiveStore.appBox!.get('login') ?? false) { + await userProvider.setLogin(HiveStore.appBox!.get('token')); + } + } catch (e) { + LoggerData.addData(e); } } diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index f492f237..a58751ba 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -25,17 +25,25 @@ class UserProvider extends ChangeNotifier { bool get isLogin => _isLogin; bool get isNotLogin => !_isLogin; Future setLogin(int token) async { - final appProvider = Provider.of(Get.context!, listen: false); - _isLogin = true; - NetUtil().dio!.options.headers.putIfAbsent('App-Admin-Token', () => token); - HiveStore.appBox!.put('token', token); - HiveStore.appBox!.put('login', true); - await updateProfile(); - await updateUserDetail(); - await appProvider.updateHouses(await HouseFunc.passedHouses); - WebSocketUtil().setUser(userInfoModel!.id.toString()); - WebSocketUtil().startWebSocket(); - notifyListeners(); + try { + final appProvider = Provider.of(Get.context!, listen: false); + _isLogin = true; + NetUtil() + .dio! + .options + .headers + .putIfAbsent('App-Admin-Token', () => token); + HiveStore.appBox!.put('token', token); + HiveStore.appBox!.put('login', true); + await updateProfile(); + await updateUserDetail(); + await appProvider.updateHouses(await HouseFunc.passedHouses); + WebSocketUtil().setUser(userInfoModel!.id.toString()); + WebSocketUtil().startWebSocket(); + notifyListeners(); + } catch (e) { + LoggerData.addData(e); + } } logout() { diff --git a/lib/ui/profile/house/add_house_page.dart b/lib/ui/profile/house/add_house_page.dart index a595a908..74077681 100644 --- a/lib/ui/profile/house/add_house_page.dart +++ b/lib/ui/profile/house/add_house_page.dart @@ -173,7 +173,7 @@ class _AddHousePageState extends State { text: S.of(context)!.tempPlotName, hintText: '请选择小区', // 跳转到选择小区页面 - // TODO 小区页面 + // // onTap: () { // Get.to(() => PickPlotPage()); // }, diff --git a/lib/ui/profile/house/house_owners_page.dart b/lib/ui/profile/house/house_owners_page.dart index 7c7a29f2..b0dccd47 100644 --- a/lib/ui/profile/house/house_owners_page.dart +++ b/lib/ui/profile/house/house_owners_page.dart @@ -1,6 +1,7 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/ui/profile/house/identify_selection_page.dart'; import 'package:aku_community/ui/profile/house/my_house_list.dart'; +import 'package:aku_community/ui/profile/house/tenant_house_list_page.dart'; import 'package:aku_community/widget/buttons/bottom_button.dart'; import 'package:flutter/material.dart'; @@ -92,8 +93,9 @@ class _HouseOwnersPageState extends State { actions: [ TextButton( onPressed: () { - Get.to(() => MyHouseList()); - //TODO:租客跳转选房 + isOwner + ? Get.to(() => MyHouseList()) + : Get.to(TenantHouseListPage()); }, child: Text(isOwner ? '审核记录' : '我的选房'), ), diff --git a/lib/ui/profile/house/supplement_information_page.dart b/lib/ui/profile/house/supplement_information_page.dart new file mode 100644 index 00000000..7497d4f9 --- /dev/null +++ b/lib/ui/profile/house/supplement_information_page.dart @@ -0,0 +1,54 @@ +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/others/bee_input_row.dart'; +import 'package:flutter/material.dart'; + +class SupplementInformationPage extends StatefulWidget { + SupplementInformationPage({Key? key}) : super(key: key); + + @override + _SupplementInformationPageState createState() => + _SupplementInformationPageState(); +} + +class _SupplementInformationPageState extends State { + TextEditingController _nameController = TextEditingController(); + String _sex = '请选择性别'; + TextEditingController _phoneController = TextEditingController(); + TextEditingController _codeController = TextEditingController(); + TextEditingController _emergencyContactController = TextEditingController(); + TextEditingController _emergencyPhoneController = TextEditingController(); + TextEditingController _addressController = TextEditingController(); + TextEditingController _workUnitController = TextEditingController(); + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '补充个人信息', + bodyColor: Colors.white, + body: ListView( + children: [ + BeeInputRow( + title: '承租人', + controller: _nameController, + hintText: '杨赟', + isRequire: true, + ), + BeeInputRow.button(title: '性别', onPressed:(){} , hintText: _sex,isRequire: true,), + BeeInputRow(title: '手机号码', controller: _phoneController, hintText: '13742494159',isRequire: true,), + BeeInputRow(title: '身份证号', controller: _codeController, hintText: 'hintText',isRequire: true,), + BeeInputRow(title: '紧急联系人', controller: _emergencyContactController, hintText: 'hintText'), + BeeInputRow(title: '紧急联系人电话', controller: _emergencyPhoneController, hintText: 'hintText'), + BeeInputRow(title: '通讯地址(含诉讼送达地址)', controller: _addressController, hintText: 'hintText'), + BeeInputRow(title: '工作单位', controller: _workUnitController, hintText: 'hintText'), + + + + ], + ), + ); + } +} diff --git a/lib/ui/profile/house/tenant_house_list_page.dart b/lib/ui/profile/house/tenant_house_list_page.dart new file mode 100644 index 00000000..cc89d000 --- /dev/null +++ b/lib/ui/profile/house/tenant_house_list_page.dart @@ -0,0 +1,132 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/const/resource.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/buttons/card_bottom_button.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class TenantHouseListPage extends StatefulWidget { + TenantHouseListPage({Key? key}) : super(key: key); + + @override + _TenantHouseListPageState createState() => _TenantHouseListPageState(); +} + +class _TenantHouseListPageState extends State { + bool _onload = true; + late EasyRefreshController _refreshController; + @override + void initState() { + _refreshController = EasyRefreshController(); + super.initState(); + } + + @override + void dispose() { + _refreshController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '可选房屋', + body: EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + controller: _refreshController, + onRefresh: () async { + _onload = false; + setState(() {}); + }, + child: _onload + ? Container() + : ListView( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + children: [houseCard()], + ), + ), + ); + } + + List _getColors(int type) { + switch (type) { + case 1: + return [ + Color(0xFFFFE5D2), + Color(0xFFFFFFFF), + ]; + case 2: + return [ + Color(0xFFFFEEBB), + Color(0xFFFFF4D2), + ]; + default: + return [Colors.white, Colors.white]; + } + } + + Widget houseCard() { + var buttons = Row( + children: [CardBottomButton.yellow(text: '填写信息', onPressed: () {})], + ); + var bottom = Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + '二类人才'.text.size(28.sp).color(ktextSubColor).make(), + 8.w.heightBox, + 'B座C1户型'.text.size(28.sp).color(ktextSubColor).make(), + ], + ).expand(), + buttons + ], + ); + return Container( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16.w), + gradient: LinearGradient( + colors: _getColors(1), + begin: Alignment.topLeft, + end: Alignment.bottomRight), + ), + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.asset( + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + width: 40.w, + height: 40.w, + ), + 16.w.widthBox, + '南宁金融人才公寓'.text.size(32.sp).color(ktextPrimary).make().expand(), + '待签署'.text.size(32.sp).color(ktextPrimary).bold.make(), + ], + ), + 12.w.heightBox, + Row( + children: [ + '1幢-1单元-702室' + .text + .size(40.sp) + .color(ktextPrimary) + .bold + .make() + .expand(), + ], + ), + 56.w.heightBox, + bottom, + ], + ), + ); + } +} diff --git a/lib/ui/profile/house/user_identify_page.dart b/lib/ui/profile/house/user_identify_page.dart index 941e1f88..f4880e58 100644 --- a/lib/ui/profile/house/user_identify_page.dart +++ b/lib/ui/profile/house/user_identify_page.dart @@ -1,4 +1,5 @@ import 'package:aku_community/base/base_style.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'; @@ -157,7 +158,7 @@ class _UserIdentifyPageState extends State { '返回'.text.size(34.sp).isIntrinsic.color(ktextPrimary).make()), CupertinoDialogAction( onPressed: () { - Get.back(); + Get.off(()=>TenantHouseListPage()); }, child: '修改信息' .text diff --git a/lib/utils/network/base_model.dart b/lib/utils/network/base_model.dart index 319ce908..1b22c35d 100644 --- a/lib/utils/network/base_model.dart +++ b/lib/utils/network/base_model.dart @@ -2,7 +2,7 @@ class BaseModel { int? code; String? message; bool? status; - dynamic? data; + dynamic data; BaseModel({ this.code, this.message, diff --git a/lib/widget/bee_scaffold.dart b/lib/widget/bee_scaffold.dart index b4ce21be..cc438eeb 100644 --- a/lib/widget/bee_scaffold.dart +++ b/lib/widget/bee_scaffold.dart @@ -5,7 +5,7 @@ import 'package:aku_community/constants/app_theme.dart'; import 'package:aku_community/widget/bee_back_button.dart'; class BeeScaffold extends StatelessWidget { - final dynamic? title; + final dynamic title; final Widget? body; /// appbar background color diff --git a/lib/widget/buttons/card_bottom_button.dart b/lib/widget/buttons/card_bottom_button.dart index fbb1ade8..b4832a8c 100644 --- a/lib/widget/buttons/card_bottom_button.dart +++ b/lib/widget/buttons/card_bottom_button.dart @@ -4,7 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community/base/base_style.dart'; - +//各种卡片下方的button组 class CardBottomButton extends StatelessWidget { final String text; final Color textColor; diff --git a/lib/widget/buttons/column_action_button.dart b/lib/widget/buttons/column_action_button.dart index 7c8e42f6..c786840b 100644 --- a/lib/widget/buttons/column_action_button.dart +++ b/lib/widget/buttons/column_action_button.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community/utils/headers.dart'; - +///上图片 下文字 的button class ColumnActionButton extends StatelessWidget { final VoidCallback? onPressed; final String? title; diff --git a/lib/widget/picker/bee_image_preview.dart b/lib/widget/picker/bee_image_preview.dart index 4b4d6f0a..0bbaca65 100644 --- a/lib/widget/picker/bee_image_preview.dart +++ b/lib/widget/picker/bee_image_preview.dart @@ -1,5 +1,4 @@ import 'dart:io'; -import 'dart:ui'; import 'package:flutter/material.dart'; @@ -7,7 +6,7 @@ import 'package:get/get.dart'; import 'package:aku_community/const/resource.dart'; import 'package:aku_community/constants/api.dart'; - +///图片点击放大预览 class BeeImagePreview extends StatefulWidget { static Future toFile({required File file, String? tag}) async { return await navigator!.push( diff --git a/lib/widget/picker/identify_card_picker.dart b/lib/widget/picker/identify_card_picker.dart new file mode 100644 index 00000000..d692eb04 --- /dev/null +++ b/lib/widget/picker/identify_card_picker.dart @@ -0,0 +1,19 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class IdentifyCardPicker { + static front() { + return Column( + children: [ + '上传身份证正面'.text.size(28.sp).color(ktextPrimary).make(), + 24.w.heightBox, + Container( + width: 350.w, + height: 220.w, + ) + ], + ); + } +}