diff --git a/lib/constants/api.dart b/lib/constants/api.dart index b544b4fd..73b74515 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -234,11 +234,12 @@ class _Message { ///消息中心:查询所有的系统通知 String get sysMessageList => '/user/message/sysMessageList'; - ///消息中心:全部已读 String get allRead => '/user/message/allRead'; ///消息中心:阅读消息(未读 -> 已读) String get readMessage => '/user/message/readMessage'; + ///消息中心:根据消息列表主键id和用户主键id查询系统通知消息详情 + String get getSystemMessageDetial => '/user/message/sysMessageDetail'; } diff --git a/lib/model/message/system_message_detail_model.dart b/lib/model/message/system_message_detail_model.dart new file mode 100644 index 00000000..58bc8b24 --- /dev/null +++ b/lib/model/message/system_message_detail_model.dart @@ -0,0 +1,21 @@ +class SystemMessageDetailModel { + int id; + String title; + String content; + + SystemMessageDetailModel({this.id, this.title, this.content}); + + SystemMessageDetailModel.fromJson(Map json) { + id = json['id']; + title = json['title']; + content = json['content']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['title'] = this.title; + data['content'] = this.content; + return data; + } +} diff --git a/lib/pages/message_center_page/message_func.dart b/lib/pages/message_center_page/message_func.dart index 3c2f3805..9f3ae565 100644 --- a/lib/pages/message_center_page/message_func.dart +++ b/lib/pages/message_center_page/message_func.dart @@ -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 messageCenter() async { - // Response response = await Net().dio.get(API.message.center); - // return MessageCenterModel.fromJson(response.data); - // } + static Future getSystemMessageDetial(int id) async { + BaseModel baseModel = + await NetUtil().get(API.message.getSystemMessageDetial, params: { + 'sysMessageId': id, + }); + return SystemMessageDetailModel.fromJson(baseModel.data); + } } diff --git a/lib/pages/message_center_page/system_message/system_message_detail_page.dart b/lib/pages/message_center_page/system_message/system_message_detail_page.dart new file mode 100644 index 00000000..28c669a5 --- /dev/null +++ b/lib/pages/message_center_page/system_message/system_message_detail_page.dart @@ -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 { + 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(), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/message_center_page/system_message/system_message_page.dart b/lib/pages/message_center_page/system_message/system_message_page.dart index 8608f2e4..8b21d313 100644 --- a/lib/pages/message_center_page/system_message/system_message_page.dart +++ b/lib/pages/message_center_page/system_message/system_message_page.dart @@ -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 { 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,