对接 根据工单主键id同步查询报事报修评论(同步

添加 主页及消息页加载
hmxc
张萌 4 years ago
parent 246e1b6931
commit 6cc39c5099

@ -220,4 +220,9 @@ class _Message {
///appid ///appid
String get announcementFindByld => '/user/announcement/findById'; String get announcementFindByld => '/user/announcement/findById';
///id
String get getCommentByDispatchId => '/user/message/findCommentByDispatchId';
} }

@ -0,0 +1,21 @@
class CommentMessageDetailModel {
int id;
String name;
int level;
CommentMessageDetailModel({this.id, this.name, this.level});
CommentMessageDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
level = json['level'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['level'] = this.level;
return data;
}
}

@ -7,6 +7,8 @@ import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:shimmer/shimmer.dart';
import 'package:velocity_x/velocity_x.dart';
// Package imports: // Package imports:
import 'package:aku_ui/aku_ui.dart'; import 'package:aku_ui/aku_ui.dart';
@ -38,7 +40,6 @@ import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart';
import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_manager_card.dart'; import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_manager_card.dart';
import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart';
import 'package:aku_community_manager/ui/tool_pages/scan_page.dart';
import 'package:aku_community_manager/ui/tool_pages/warning/warning_page.dart'; import 'package:aku_community_manager/ui/tool_pages/warning/warning_page.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_avatar.dart'; import 'package:aku_community_manager/ui/widgets/app_widgets/aku_avatar.dart';
@ -53,6 +54,7 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> { class _HomePageState extends State<HomePage> {
ItemNumModel _itemNumModel; ItemNumModel _itemNumModel;
bool _onload = true;
///bar ///bar
Widget _menuButton(String assetPath, String text, Widget page) { Widget _menuButton(String assetPath, String text, Widget page) {
@ -139,12 +141,16 @@ class _HomePageState extends State<HomePage> {
} }
@override @override
void initState() async { void initState() {
super.initState(); super.initState();
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent, statusBarColor: Colors.transparent,
)); ));
Future.delayed(Duration(milliseconds: 300), () async {
_itemNumModel = await _getItemNum(); _itemNumModel = await _getItemNum();
_onload = false;
setState(() {});
});
} }
int _currentIndicator = 0; int _currentIndicator = 0;
@ -365,7 +371,14 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
), ),
body: ListView( body: _onload
? Center(
child: Shimmer.fromColors(
child: 'LOADING······'.text.black.size(50.sp).make(),
baseColor: Colors.white,
highlightColor: kPrimaryColor),
)
: ListView(
padding: EdgeInsets.all(32.w), padding: EdgeInsets.all(32.w),
children: [ children: [
Container( Container(
@ -441,10 +454,11 @@ class _HomePageState extends State<HomePage> {
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: children: _anouncementProvider.anouncementCardModels
_anouncementProvider.anouncementCardModels.map((e) { .map((e) {
int index = int index = _anouncementProvider
_anouncementProvider.anouncementCardModels.indexOf(e); .anouncementCardModels
.indexOf(e);
return Container( return Container(
width: 12.w, width: 12.w,
height: 12.w, height: 12.w,
@ -516,7 +530,8 @@ class _HomePageState extends State<HomePage> {
width: 526.w, width: 526.w,
child: Builder( child: Builder(
builder: (context) { builder: (context) {
final item = AllModel(context).waitThings[index]; final item =
AllModel(context).waitThings[index];
if (item is DecorationListModel) { if (item is DecorationListModel) {
return DecorationManagerCard(model: item); return DecorationManagerCard(model: item);
} else if (item is BussinessAndFixModel) { } else if (item is BussinessAndFixModel) {
@ -545,11 +560,11 @@ class _HomePageState extends State<HomePage> {
children: [ children: [
Row( Row(
children: [ children: [
_card(_itemNumModel.unProcessedNum ?? 0, '未处理事项', _card(_itemNumModel.unProcessedNum ?? 0,
Color(0xFFFF4E0D), 0), '未处理事项', Color(0xFFFF4E0D), 0),
GridientDiveder().verticalDivider(166.5.w), GridientDiveder().verticalDivider(166.5.w),
_card(_itemNumModel.processingNum ?? 0, '处理中事项', _card(_itemNumModel.processingNum ?? 0,
Color(0xFFFFC40C), 1), '处理中事项', Color(0xFFFFC40C), 1),
], ],
), ),
Row(children: [ Row(children: [
@ -559,9 +574,10 @@ class _HomePageState extends State<HomePage> {
]), ]),
Row( Row(
children: [ children: [
_card(_itemNumModel.processedNum ?? 0, '已处理事项', _card(_itemNumModel.processedNum ?? 0,
Color(0xFF3F8FFE), 2), '已处理事项', Color(0xFF3F8FFE), 2),
GridientDiveder(isReverse: true).verticalDivider( GridientDiveder(isReverse: true)
.verticalDivider(
166.5.w, 166.5.w,
), ),
_card(_itemNumModel.allNum ?? 0, '全部事项', _card(_itemNumModel.allNum ?? 0, '全部事项',

@ -1,8 +1,10 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/message/comment_message_item_model.dart'; import 'package:aku_community_manager/models/message/comment_message_item_model.dart';
import 'package:aku_community_manager/ui/home/messages/comment_message_card.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:velocity_x/velocity_x.dart';
// Package imports: // Package imports:
import 'package:aku_ui/common_widgets/aku_common_widgets.dart'; import 'package:aku_ui/common_widgets/aku_common_widgets.dart';
@ -23,126 +25,6 @@ class CommentMessage extends StatefulWidget {
class _CommentMessageState extends State<CommentMessage> { class _CommentMessageState extends State<CommentMessage> {
EasyRefreshController _refreshController = EasyRefreshController(); EasyRefreshController _refreshController = EasyRefreshController();
Widget _messageList(
String date,
String name,
String comment,
) {
return Column(
children: [
Container(
margin: EdgeInsets.only(top: 24.w, bottom: 24.w),
alignment: Alignment.center,
width: double.infinity,
child: Text(
date,
style: TextStyle(color: AppStyle.minorTextColor, fontSize: 24.sp),
),
),
Container(
padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 24.w),
color: Color(0xFFFFFFFF),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(children: [
Container(
width: 16.w,
height: 16.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Color(0xFFFF4501)),
),
SizedBox(
width: 16.w,
),
Text(
'评论消息',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 32.sp,
fontWeight: FontWeight.w600),
),
SizedBox(height: 8.w),
]),
Text(
'你有一条新的评论消息,请立即查看',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold),
),
SizedBox(height: 24.w),
Row(
children: [
Image.asset(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
width: 40.w,
height: 40.w,
),
SizedBox(
width: 4.w,
),
Text(
'评论人',
style: TextStyle(
color: AppStyle.minorTextColor, fontSize: 28.sp),
),
Spacer(),
Text(
name,
style: TextStyle(
color: AppStyle.primaryTextColor, fontSize: 28.sp),
),
],
),
SizedBox(height: 16.w),
Row(
children: [
Image.asset(
R.ASSETS_MESSAGE_IC_STAR_PNG,
width: 40.w,
height: 40.w,
),
SizedBox(
width: 4.w,
),
Text('综合评分',
style: TextStyle(
color: AppStyle.minorTextColor, fontSize: 28.sp)),
Spacer(),
Text(comment,
style: TextStyle(
color: AppStyle.primaryTextColor, fontSize: 28.sp)),
],
),
SizedBox(height: 16.w),
Divider(height: 1.w),
AkuButton(
onPressed: () {},
child: Container(
height: 88.w,
alignment: Alignment.center,
padding: EdgeInsets.only(left: 24.w),
child: Row(
children: [
Text(
'查看详情',
style: TextStyle(
color: AppStyle.primaryTextColor, fontSize: 28.sp),
),
Spacer(),
Icon(Icons.arrow_forward_ios, size: 22.w),
],
),
),
),
],
),
),
],
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -155,10 +37,14 @@ class _CommentMessageState extends State<CommentMessage> {
.map((e) => CommentMessageItemModel.fromJson(e)) .map((e) => CommentMessageItemModel.fromJson(e))
.toList(), .toList(),
builder: (items) { builder: (items) {
return ListView( return ListView.separated(
padding: EdgeInsets.only(left: 32.w, right: 32.w, bottom: 40.w), itemBuilder: (context, index) {
children: [], return CommentMessageCard(itemModel: items[index]);
); },
separatorBuilder: (context, index) {
return 10.w.heightBox;
},
itemCount: items.length);
}, },
), ),
); );

@ -0,0 +1,321 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/message/comment_message_detail_model.dart';
import 'package:aku_community_manager/models/message/comment_message_item_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:aku_ui/aku_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shimmer/shimmer.dart';
import 'package:velocity_x/velocity_x.dart';
class CommentMessageCard extends StatefulWidget {
final CommentMessageItemModel itemModel;
CommentMessageCard({Key key, @required this.itemModel}) : super(key: key);
@override
_CommentMessageCardState createState() => _CommentMessageCardState();
}
class _CommentMessageCardState extends State<CommentMessageCard> {
CommentMessageDetailModel _model;
bool _onload = true;
@override
void initState() {
super.initState();
Future.delayed(Duration(milliseconds: 300), () async {
BaseModel baseModel =
await NetUtil().get(API.message.getCommentByDispatchId, params: {
"dispatchId": widget.itemModel.relationId,
});
_model = CommentMessageDetailModel.fromJson(baseModel.data);
_onload = false;
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return _messageList(_model);
}
String getComment(int level) {
switch (level) {
case 1:
return '半星';
break;
case 2:
return '一星';
case 3:
return '一星半';
case 4:
return '二星';
case 5:
return '二星半';
case 6:
return '三星';
case 7:
return '三星半';
case 8:
return '四星';
case 9:
return '四星半';
case 10:
return '五星';
default:
return '零星';
}
}
Widget _loadingWidget() {
return Column(
children: [
Container(
margin: EdgeInsets.only(top: 24.w, bottom: 24.w),
alignment: Alignment.center,
width: double.infinity,
child: Shimmer.fromColors(
baseColor: kPrimaryColor.withOpacity(0.3),
highlightColor: kPrimaryColor.withOpacity(0.1),
child: Text(
'',
style: TextStyle(color: AppStyle.minorTextColor, fontSize: 24.sp),
),
),
),
Container(
padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 24.w),
color: Color(0xFFFFFFFF),
child: Shimmer.fromColors(
baseColor: kPrimaryColor.withOpacity(0.3),
highlightColor: kPrimaryColor.withOpacity(0.1),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(children: [
Container(
width: 16.w,
height: 16.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Color(0xFFFF4501)),
),
SizedBox(
width: 16.w,
),
Text(
'',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 32.sp,
fontWeight: FontWeight.w600),
),
SizedBox(height: 8.w),
]),
Text(
'',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold),
),
SizedBox(height: 24.w),
Row(
children: [
Image.asset(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
width: 40.w,
height: 40.w,
),
SizedBox(
width: 4.w,
),
Text(
'',
style: TextStyle(
color: AppStyle.minorTextColor, fontSize: 28.sp),
),
Spacer(),
Text(
'',
style: TextStyle(
color: AppStyle.primaryTextColor, fontSize: 28.sp),
),
],
),
SizedBox(height: 16.w),
Row(
children: [
Image.asset(
R.ASSETS_MESSAGE_IC_STAR_PNG,
width: 40.w,
height: 40.w,
),
SizedBox(
width: 4.w,
),
Text('',
style: TextStyle(
color: AppStyle.minorTextColor, fontSize: 28.sp)),
Spacer(),
Text('',
style: TextStyle(
color: AppStyle.primaryTextColor, fontSize: 28.sp)),
],
),
SizedBox(height: 16.w),
Divider(height: 1.w),
AkuButton(
onPressed: () {},
child: Container(
height: 88.w,
alignment: Alignment.center,
padding: EdgeInsets.only(left: 24.w),
child: Row(
children: [
Text(
'',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp),
),
Spacer(),
Icon(Icons.arrow_forward_ios, size: 22.w),
],
),
),
),
],
),
),
),
],
);
}
Widget _messageList(CommentMessageDetailModel model) {
return _onload
? _loadingWidget()
: Column(
children: [
Container(
margin: EdgeInsets.only(top: 24.w, bottom: 24.w),
alignment: Alignment.center,
width: double.infinity,
child: Text(
'',
style: TextStyle(
color: AppStyle.minorTextColor, fontSize: 24.sp),
),
),
Container(
padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 24.w),
color: Color(0xFFFFFFFF),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(children: [
Container(
width: 16.w,
height: 16.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Color(0xFFFF4501)),
),
SizedBox(
width: 16.w,
),
Text(
'评论消息',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 32.sp,
fontWeight: FontWeight.w600),
),
SizedBox(height: 8.w),
]),
Text(
'你有一条新的评论消息,请立即查看',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold),
),
SizedBox(height: 24.w),
Row(
children: [
Image.asset(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
width: 40.w,
height: 40.w,
),
SizedBox(
width: 4.w,
),
Text(
'评论人',
style: TextStyle(
color: AppStyle.minorTextColor, fontSize: 28.sp),
),
Spacer(),
Text(
'${model.name}',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp),
),
],
),
SizedBox(height: 16.w),
Row(
children: [
Image.asset(
R.ASSETS_MESSAGE_IC_STAR_PNG,
width: 40.w,
height: 40.w,
),
SizedBox(
width: 4.w,
),
Text('综合评分',
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.sp)),
Spacer(),
Text(getComment(model.level),
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp)),
],
),
SizedBox(height: 16.w),
Divider(height: 1.w),
AkuButton(
onPressed: () {},
child: Container(
height: 88.w,
alignment: Alignment.center,
padding: EdgeInsets.only(left: 24.w),
child: Row(
children: [
Text(
'查看详情',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp),
),
Spacer(),
Icon(Icons.arrow_forward_ios, size: 22.w),
],
),
),
),
],
),
),
],
);
}
}

@ -620,6 +620,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
shimmer:
dependency: "direct dev"
description:
name: shimmer
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0-nullsafety.0"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter

@ -69,6 +69,7 @@ dev_dependencies:
import_sorter: import_sorter:
grinder: grinder:
flutter_asset_generator: ^0.6.1 flutter_asset_generator: ^0.6.1
shimmer: ^2.0.0-nullsafety.0
flutter: flutter:
uses-material-design: true uses-material-design: true

Loading…
Cancel
Save