diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 5a270d4f..ded7fe7e 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -37,6 +37,8 @@ import 'package:power_logger/power_logger.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../../ui/manager/advice/advice_page.dart'; + class HomePage extends StatefulWidget { HomePage({Key? key}) : super(key: key); @@ -356,11 +358,7 @@ class _HomePageState extends State ), ), onTap: () async { - BotToast.showText( - text: '此功能升级中,稍后上线', - align: Alignment(0, 0.5)); - // Get.to(AdvicePage( - // type: AdviceType.SUGGESTION)); + Get.to(AdvicePage(type: AdviceType.SUGGESTION)); }, ), ) diff --git a/lib/ui/manager/advice/advice_add_comment_page.dart b/lib/ui/manager/advice/advice_add_comment_page.dart index 032fe304..3ae83c06 100644 --- a/lib/ui/manager/advice/advice_add_comment_page.dart +++ b/lib/ui/manager/advice/advice_add_comment_page.dart @@ -70,9 +70,9 @@ class _AdviceAddCommentPageState extends State { onPressed: () async { if (_formKey.currentState!.validate()) { BaseModel baseModel = await NetUtil().post( - API.manager.adviceQuestion, + SAASAPI.advice.reQuestion, params: { - 'adviceId': widget.id, + 'appAdviceId': widget.id, 'content': _textEditingController.text, 'parentId': 0, }, diff --git a/lib/ui/manager/advice/advice_evaluate_page.dart b/lib/ui/manager/advice/advice_evaluate_page.dart index 955ba12d..2612ec12 100644 --- a/lib/ui/manager/advice/advice_evaluate_page.dart +++ b/lib/ui/manager/advice/advice_evaluate_page.dart @@ -1,5 +1,5 @@ import 'package:aku_new_community/base/base_style.dart'; -import 'package:aku_new_community/constants/api.dart'; +import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/network/base_model.dart'; import 'package:aku_new_community/utils/network/net_util.dart'; @@ -67,9 +67,10 @@ class _AdviceEvaluatePageState extends State { color: kPrimaryColor, elevation: 0, onPressed: () async { - BaseModel baseModel = await NetUtil().post( - API.manager.adviceEvaluate, - params: {'id': widget.id, 'score': _rating}, + print(_rating); + BaseModel baseModel = await NetUtil().get( + SAASAPI.advice.evaluate, + params: {'adviceId': widget.id, 'score': _rating}, showMessage: true, ); if (baseModel.success) { diff --git a/lib/ui/manager/advice/advice_house_page.dart b/lib/ui/manager/advice/advice_house_page.dart new file mode 100644 index 00000000..1918089b --- /dev/null +++ b/lib/ui/manager/advice/advice_house_page.dart @@ -0,0 +1,167 @@ +import 'package:aku_new_community/utils/headers.dart'; +import 'package:aku_new_community/widget/bee_scaffold.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; +import 'package:get/get_core/src/get_main.dart'; + +import '../../../base/base_style.dart'; +import '../../../constants/saas_api.dart'; +import '../../../gen/assets.gen.dart'; +import '../../../models/user/my_house_model.dart'; +import '../../../utils/network/net_util.dart'; +import '../../../widget/bee_divider.dart'; +import '../../../widget/others/user_tool.dart'; +import '../../../widget/tag/bee_tag.dart'; +import '../../profile/house/add_house_page.dart'; +import '../../profile/new_house/apply_record_page.dart'; +import '../../profile/new_house/my_house_page.dart'; +import '../../profile/new_house/widgets/add_house_button.dart'; + +class AdviceHousePage extends StatefulWidget { + const AdviceHousePage({Key? key}) : super(key: key); + + @override + State createState() => _AdviceHousePageState(); +} + +class _AdviceHousePageState extends State { + EasyRefreshController _refreshController = EasyRefreshController(); + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + _refreshController.dispose(); + super.dispose(); + } + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '我的房屋', + body: SafeArea( + child: UserTool.userProvider.myHouses.isEmpty + ? HouseEmptyWidget() + : EasyRefresh( + controller: _refreshController, + firstRefresh: true, + header: MaterialHeader(), + onRefresh: () async { + await UserTool.userProvider.updateMyHouseInfo(); + setState(() {}); + }, + child: ListView( + padding: + EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), + children: [ + ...UserTool.userProvider.myHouses + .map((e) => _houseCard(e)) + .toList() + ].sepWidget(separate: 24.w.heightBox), + ), + )), + ); + } + Widget _houseCard(MyHouseModel model) { + return Stack( + children: [ + GestureDetector( + onTap: () async { + var base = await NetUtil().get( + SAASAPI.profile.house.switchDefaultEstate, + params: {'estateId': model.id}); + if (base.success) { + _refreshController.callRefresh(); + UserTool.userProvider.updateDefaultHouse(); + Get.back(); + } else { + BotToast.showText(text: '切换默认房屋失败'); + } + }, + child: Material( + child: Container( + width: 686.w, + padding: EdgeInsets.all(24.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w)), + child: Column( + children: [ + Row( + children: [ + '${model.addressName} ${model.communityName}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ), + 8.w.heightBox, + Row( + children: [ + '${model.buildingName}栋${model.unitName}单元${model.estateName}' + .text + .size(36.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + 24.w.widthBox, + model.isDefault == 1 + ? BeeTag.yellowSolid( + text: '${model.manageEstateTypeName}') + : BeeTag.blackSolid( + text: '${model.manageEstateTypeName}'), + ], + ), + 24.w.heightBox, + BeeDivider.horizontal(), + 24.w.heightBox, + Row( + children: [ + model.isDefault == 1 + ? BeeTag.yellowHollow( + text: '${model.manageEstateTypeName}') + : BeeTag.blackHollow( + text: '${model.manageEstateTypeName}'), + 10.w.widthBox, + '${model.name} ${model.tel}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ) + ], + ), + ), + ), + ), + if (model.isDefault == 1) + Positioned( + top: 0, + right: 0, + child: ClipPath( + clipper: TriangleClipper(), + child: Container( + width: 120.w, + height: 80.w, + color: kPrimaryColor, + alignment: Alignment.topRight, + child: Padding( + padding: EdgeInsets.only(right: 10.w, top: 10.w), + child: Icon( + Icons.check, + size: 40.w, + color: Colors.white, + ), + ), + )), + ), + ], + ); + } +} diff --git a/lib/ui/manager/advice/advice_page.dart b/lib/ui/manager/advice/advice_page.dart index a2cd326c..ed695f46 100644 --- a/lib/ui/manager/advice/advice_page.dart +++ b/lib/ui/manager/advice/advice_page.dart @@ -5,7 +5,6 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; -import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/app_theme.dart'; import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/model/manager/suggestion_or_complain_model.dart'; @@ -15,7 +14,6 @@ import 'package:aku_new_community/ui/manager/advice/new_advice_page.dart'; import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/hive_store.dart'; import 'package:aku_new_community/utils/network/net_util.dart'; -import 'package:aku_new_community/utils/websocket/tips_dialog.dart'; import 'package:aku_new_community/widget/animated/animated_transition.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/buttons/bottom_button.dart'; @@ -76,7 +74,7 @@ class _AdvicePageState extends State with TickerProviderStateMixin { Future.delayed(Duration(milliseconds: 0), () async { var agreement = await HiveStore.appBox?.get('AdvicePage') ?? false; if (!agreement) { - await TipsDialog.tipsDialog(); + //await TipsDialog.tipsDialog(); HiveStore.appBox!.put('AdvicePage', true); } }); @@ -112,7 +110,7 @@ class _AdvicePageState extends State with TickerProviderStateMixin { children: List.generate(2, (index) { return BeeListView( path: SAASAPI.advice.list, - extraParams: {'adviceType': adviceValue(index)}, + extraParams: {'type': adviceValue(index)}, controller: _refreshController, convert: (model) => model.rows .map((e) => SuggestionOrComplainModel.fromJson(e)) @@ -169,7 +167,7 @@ class _AdvicePageState extends State with TickerProviderStateMixin { onPressed: () async { await NetUtil().post( SAASAPI.advice.delete, - params: {'ids': _selectedItems}, + params: {'adviceIds': _selectedItems}, showMessage: true, ); _refreshController.callRefresh(); diff --git a/lib/ui/manager/advice/new_advice_page.dart b/lib/ui/manager/advice/new_advice_page.dart index fc88b739..951efbfb 100644 --- a/lib/ui/manager/advice/new_advice_page.dart +++ b/lib/ui/manager/advice/new_advice_page.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:aku_new_community/ui/manager/advice/advice_house_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -99,13 +100,13 @@ class _NewAdvicePageState extends State { Future addAdvice(int type, List files, String content) async { VoidCallback cancel = BotToast.showLoading(); List urls = - await NetUtil().uploadFiles(files,SAASAPI.uploadFile.uploadImg); + await NetUtil().uploadFiles(files, SAASAPI.uploadFile.uploadImg); BaseModel baseModel = await NetUtil().post( SAASAPI.advice.insert, params: { 'type': type, 'content': content, - 'fileUrls': urls, + 'imgUrls': urls, }, showMessage: true, ); @@ -138,21 +139,34 @@ class _NewAdvicePageState extends State { children: [ '业主/租客房屋'.text.size(28.sp).black.make(), 32.hb, - [ - Image.asset( - R.ASSETS_IMAGES_HOUSE_ATTESTATION_PNG, - height: 60.w, - width: 60.w, - ), - 40.wb, - '${userProvider.defaultHouse!.addressName}${userProvider.defaultHouse!.communityName}\n' - '${userProvider.defaultHouse!.buildingName}幢-${UserTool.userProvider.defaultHouse!.unitName}单元-${userProvider.defaultHouse!.estateName}室' - .text - .size(32.sp) - .black - .bold - .make(), - ].row(), + GestureDetector( + onTap: () { + setState(() { + Get.to(() => AdviceHousePage()); + }); + }, + child: [ + Image.asset( + R.ASSETS_IMAGES_HOUSE_ATTESTATION_PNG, + height: 60.w, + width: 60.w, + ), + 40.wb, + '${userProvider.defaultHouse!.addressName}${userProvider.defaultHouse!.communityName}\n' + '${userProvider.defaultHouse!.buildingName}幢-${UserTool.userProvider.defaultHouse!.unitName}单元-${userProvider.defaultHouse!.estateName}室' + .text + .size(32.sp) + .black + .bold + .make(), + 300.wb, + Icon( + Icons.arrow_forward_ios, + size: 35.w, + color: Colors.black.withOpacity(0.25), + ), + ].row(), + ), Divider(height: 64.w), '您要选择的类型是?'.text.size(28.sp).make(), 32.hb,