对接:根据消息列表主键id和用户主键id查询系统通知消息详情

重写系统消息详情页
对接:消息中心:阅读消息(未读 -> 已读)
hmxc
张萌 4 years ago
parent bf6fcbc4c1
commit 6aaf03a993

@ -234,11 +234,12 @@ class _Message {
///
String get sysMessageList => '/user/message/sysMessageList';
///
String get allRead => '/user/message/allRead';
/// ->
String get readMessage => '/user/message/readMessage';
///idid
String get getSystemMessageDetial => '/user/message/sysMessageDetail';
}

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

@ -1,11 +1,14 @@
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/message/message_center_model.dart';
import 'package:akuCommunity/service/net.dart';
import 'package:dio/dio.dart';
import 'package:akuCommunity/model/message/system_message_detail_model.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
class MessageFunc {
// static Future<MessageCenterModel> messageCenter() async {
// Response response = await Net().dio.get(API.message.center);
// return MessageCenterModel.fromJson(response.data);
// }
static Future<SystemMessageDetailModel> getSystemMessageDetial(int id) async {
BaseModel baseModel =
await NetUtil().get(API.message.getSystemMessageDetial, params: {
'sysMessageId': id,
});
return SystemMessageDetailModel.fromJson(baseModel.data);
}
}

@ -0,0 +1,58 @@
import 'package:akuCommunity/model/message/system_message_detail_model.dart';
import 'package:akuCommunity/model/message/system_message_model.dart';
import 'package:akuCommunity/pages/message_center_page/message_func.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
class SystemMessageDetailPage extends StatefulWidget {
final int id;
SystemMessageDetailPage({Key key, this.id}) : super(key: key);
@override
_SystemMessageDetailPageState createState() =>
_SystemMessageDetailPageState();
}
class _SystemMessageDetailPageState extends State<SystemMessageDetailPage> {
SystemMessageDetailModel _model;
bool _onload = true;
Widget _empty() {
return Container();
}
@override
Widget build(BuildContext context) {
return BeeScaffold.white(
title: '查看详情',
body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
_model = await MessageFunc.getSystemMessageDetial(widget.id);
_onload = false;
},
child: _onload
? _empty()
: Center(
child: Padding(
padding: EdgeInsets.all(32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
20.w.heightBox,
'系统通知'.text.black.bold.size(32.sp).make(),
5.w.heightBox,
_model.title.text.black.size(28.sp).isIntrinsic.make(),
110.w.heightBox,
_model.content.text.black.size(28.sp).isIntrinsic.make(),
],
),
),
),
),
);
}
}

@ -1,8 +1,10 @@
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/message/system_message_model.dart';
import 'package:akuCommunity/pages/message_center_page/system_message/system_message_detail_page.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/utils/bee_map.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:akuCommunity/widget/bee_divider.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/cupertino.dart';
@ -33,7 +35,14 @@ class _SystemMessagePageState extends State<SystemMessagePage> {
Widget _buildCard(SystemMessageModel model) {
return InkWell(
onTap: () {},
onTap: () async {
await NetUtil().dio.get(API.message.readMessage, queryParameters: {
'sysMessageId': model.id,
});
SystemMessageDetailPage(
id: model.id,
).to();
},
child: Container(
decoration: BoxDecoration(
color: kForeGroundColor,

Loading…
Cancel
Save