消息:通知公告接新接口

pull/1/head
戴余标 2 years ago
parent c5152e379f
commit 59f3ccc21c

@ -144,6 +144,9 @@ class _Message {
///
String get allComment => '/app/user/message/commentMessage';
///app
String get list => '/app/user/message/list';
}
class _Community {

@ -0,0 +1,71 @@
import 'package:common_utils/common_utils.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';
part 'message_list_model.g.dart';
@JsonSerializable()
class MessageListModel extends Equatable {
final int id;
final int type;
final int status;
final String title;
final String content;
final String sendDate;
final int jumpId;
final int onlyId;
DateTime? get sendDt => DateUtil.getDateTime(sendDate);
int? get month => sendDt?.month;
int? get year => sendDt?.year;
factory MessageListModel.fromJson(Map<String, dynamic> json) =>
_$MessageListModelFromJson(json);
@override
List<Object?> get props => [
id,
type,
status,
title,
content,
sendDate,
jumpId,
onlyId,
];
const MessageListModel({
required this.id,
required this.type,
required this.status,
required this.title,
required this.content,
required this.sendDate,
required this.jumpId,
required this.onlyId,
});
MessageListModel copyWith({
int? id,
int? type,
int? status,
String? title,
String? content,
String? sendDate,
int? jumpId,
int? onlyId,
}) {
return MessageListModel(
id: id ?? this.id,
type: type ?? this.type,
status: status ?? this.status,
title: title ?? this.title,
content: content ?? this.content,
sendDate: sendDate ?? this.sendDate,
jumpId: jumpId ?? this.jumpId,
onlyId: onlyId ?? this.onlyId,
);
}
}

@ -0,0 +1,19 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'message_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
MessageListModel _$MessageListModelFromJson(Map<String, dynamic> json) =>
MessageListModel(
id: json['id'] as int,
type: json['type'] as int,
status: json['status'] as int,
title: json['title'] as String,
content: json['content'] as String,
sendDate: json['sendDate'] as String,
jumpId: json['jumpId'] as int,
onlyId: json['onlyId'] as int,
);

@ -12,6 +12,8 @@ import 'package:aku_new_community/pages/message_center_page/announce/announce_vi
import 'package:aku_new_community/ui/community/notice/notice_detail_page.dart';
import 'package:aku_new_community/widget/bee_image_network.dart';
import '../../../models/message/message_list_model.dart';
class AnnounceCard extends StatelessWidget {
final ListDateModel modelList;
final int index;
@ -50,7 +52,7 @@ class AnnounceCard extends StatelessWidget {
);
}
Widget _card(HomeAnnounceModel model) {
Widget _card(MessageListModel model) {
return InkWell(
onTap: () {
Get.to(() => NoticeDetailPage(id: model.id));
@ -68,21 +70,21 @@ class AnnounceCard extends StatelessWidget {
children: [
'${DateUtil.formatDateStr(model.createDate, format: 'dd日 HH:mm')}'
'${DateUtil.formatDateStr(model.sendDate, format: 'dd日 HH:mm')}'
.text
.size(28.sp)
.color(ktextSubColor)
.make(),
32.w.heightBox,
Container(
width: double.infinity,
height: 258.w,
clipBehavior: Clip.antiAliasWithSaveLayer,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.w)),
child: BeeImageNetwork(
imgs: model.imgList,
),
),
// Container(
// width: double.infinity,
// height: 258.w,
// clipBehavior: Clip.antiAliasWithSaveLayer,
// decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.w)),
// child: BeeImageNetwork(
// imgs: model.imgList,
// ),
// ),
32.w.heightBox,
'${model.title}'.text.size(36.sp).black.bold.make(),

@ -1,3 +1,5 @@
import 'package:aku_new_community/models/message/message_list_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -6,7 +8,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:scroll_to_index/scroll_to_index.dart';
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/models/home/home_announce_model.dart';
import 'package:aku_new_community/pages/message_center_page/announce/announce_card.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
@ -14,7 +15,7 @@ class ListDateModel {
final String month;
final int index;
final String year;
final List<HomeAnnounceModel> models;
final List<MessageListModel> models;
ListDateModel(this.month, this.models, this.index, this.year);
}
@ -33,10 +34,10 @@ class _AnnounceViewState extends State<AnnounceView> {
late AutoScrollController _autoScrollController;
List<ListDateModel> _modelLists = [];
List<HomeAnnounceModel> _innerModelList = [];
List<MessageListModel> _innerModelList = [];
String _headMonth = '';
void monthListDepart(List<HomeAnnounceModel> models) {
void monthListDepart(List<MessageListModel> models) {
for (var item in models) {
var index =
_modelLists.indexWhere((element) => element.month == item.month);
@ -114,13 +115,13 @@ class _AnnounceViewState extends State<AnnounceView> {
_page = 1;
_modelLists.clear();
_innerModelList.clear();
var base =
await NetUtil().getList(SAASAPI.announce.list, params: {
var base = await NetUtil().getList(SAASAPI.message.list, params: {
'pageNum': _page,
'size': _size,
'type': null,
});
_innerModelList =
base.rows.map((e) => HomeAnnounceModel.fromJson(e)).toList();
base.rows.map((e) => MessageListModel.fromJson(e)).toList();
monthListDepart(_innerModelList);
if (_modelLists.isNotEmpty) {
_headMonth = _modelLists[0].month;
@ -130,15 +131,14 @@ class _AnnounceViewState extends State<AnnounceView> {
},
onLoad: () async {
_page++;
var base =
await NetUtil().getList(SAASAPI.announce.list, params: {
var base = await NetUtil().getList(SAASAPI.message.list, params: {
'pageNum': _page,
'size': _size,
'type': null,
});
if (base.total > _modelLists.length) {
_innerModelList = base.rows
.map((e) => HomeAnnounceModel.fromJson(e))
.toList();
_innerModelList =
base.rows.map((e) => MessageListModel.fromJson(e)).toList();
monthListDepart(_innerModelList);
setState(() {});
} else {

Loading…
Cancel
Save