diff --git a/lib/http/api.dart b/lib/http/api.dart index 31e5a38b..d9286e47 100644 --- a/lib/http/api.dart +++ b/lib/http/api.dart @@ -554,4 +554,8 @@ class Api { /// 系统通知 static const String messageSystemAPi = '${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify'; + + /// 系统通知标记已读 + static const String systemMarkRead = + '${HttpString.messageBaseUrl}/x/sys-msg/update_cursor'; } diff --git a/lib/http/msg.dart b/lib/http/msg.dart index 86789fd1..2de9cd49 100644 --- a/lib/http/msg.dart +++ b/lib/http/msg.dart @@ -298,7 +298,6 @@ class MsgHttp { }); if (res.data['code'] == 0) { try { - print(res.data['data']['system_notify_list']); return { 'status': true, 'data': res.data['data']['system_notify_list'] @@ -312,4 +311,23 @@ class MsgHttp { return {'status': false, 'date': [], 'msg': res.data['message']}; } } + + // 系统消息标记已读 + static Future systemMarkRead(int cursor) async { + String csrf = await Request.getCsrf(); + var res = await Request().get(Api.systemMarkRead, data: { + 'csrf': csrf, + 'cursor': cursor, + }); + if (res.data['code'] == 0) { + return { + 'status': true, + }; + } else { + return { + 'status': false, + 'msg': res.data['message'], + }; + } + } } diff --git a/lib/pages/member/widgets/seasons.dart b/lib/pages/member/widgets/seasons.dart index 1749ff45..615fc44c 100644 --- a/lib/pages/member/widgets/seasons.dart +++ b/lib/pages/member/widgets/seasons.dart @@ -35,7 +35,8 @@ class MemberSeasonsPanel extends StatelessWidget { 'seasonName': item.meta!.name!, }; } - if (category == 1) { + // 2为直播回放 + if (category == 1 || category == 2) { parameters = { 'category': '1', 'mid': item.meta!.mid.toString(), diff --git a/lib/pages/message/system/controller.dart b/lib/pages/message/system/controller.dart index bf31f6bc..f63a659a 100644 --- a/lib/pages/message/system/controller.dart +++ b/lib/pages/message/system/controller.dart @@ -8,8 +8,20 @@ class MessageSystemController extends GetxController { Future queryMessageSystem({String type = 'init'}) async { var res = await MsgHttp.messageSystem(); if (res['status']) { - systemItems.addAll(res['data']); + if (type == 'init') { + systemItems.value = res['data']; + } else { + systemItems.addAll(res['data']); + } + if (systemItems.isNotEmpty) { + systemMarkRead(systemItems.first.cursor!); + } } return res; } + + // 标记已读 + void systemMarkRead(int cursor) async { + await MsgHttp.systemMarkRead(cursor); + } } diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 0388e962..91c5ae00 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -63,7 +63,7 @@ class _VideoDetailPageState extends State late bool autoPlayEnable; late bool autoPiP; late Floating floating; - bool isShowing = true; + RxBool isShowing = true.obs; // 生命周期监听 late final AppLifecycleListener _lifecycleListener; late double statusHeight; @@ -183,6 +183,7 @@ class _VideoDetailPageState extends State plPlayerController!.addStatusLister(playerListener); vdCtr.autoPlay.value = true; vdCtr.isShowCover.value = false; + isShowing.value = true; autoEnterPip(status: PlayerStatus.playing); } @@ -258,7 +259,7 @@ class _VideoDetailPageState extends State plPlayerController!.pause(); vdCtr.clearSubtitleContent(); } - setState(() => isShowing = false); + isShowing.value = false; super.didPushNext(); } @@ -272,10 +273,8 @@ class _VideoDetailPageState extends State if (plPlayerController != null && plPlayerController!.videoPlayerController != null) { - setState(() { - vdCtr.setSubtitleContent(); - isShowing = true; - }); + vdCtr.setSubtitleContent(); + isShowing.value = true; } vdCtr.isFirstTime = false; final bool autoplay = autoPlayEnable; @@ -652,7 +651,11 @@ class _VideoDetailPageState extends State tag: heroTag, child: Stack( children: [ - if (isShowing) buildVideoPlayerPanel(), + Obx( + () => isShowing.value + ? buildVideoPlayerPanel() + : const SizedBox(), + ), /// 关闭自动播放时 手动播放 Obx(