From 85ff7c7a92c7bf7d82fdc2a6db0ed185f0806d19 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Fri, 18 Aug 2023 11:12:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A8=E6=80=81=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E7=95=AA=E5=89=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/dynamics/result.dart | 6 ++++ lib/pages/dynamics/controller.dart | 29 ++++++++++++++++++++ lib/pages/dynamics/widgets/author_panel.dart | 3 +- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/lib/models/dynamics/result.dart b/lib/models/dynamics/result.dart index 53cee9d5..78991418 100644 --- a/lib/models/dynamics/result.dart +++ b/lib/models/dynamics/result.dart @@ -478,6 +478,8 @@ class DynamicArchiveModel { this.stat, this.title, this.type, + this.epid, + this.seasonId, }); int? aid; @@ -491,6 +493,8 @@ class DynamicArchiveModel { Stat? stat; String? title; int? type; + int? epid; + int? seasonId; DynamicArchiveModel.fromJson(Map json) { aid = json['aid'] is String ? int.parse(json['aid']) : json['aid']; @@ -503,6 +507,8 @@ class DynamicArchiveModel { stat = json['stat'] != null ? Stat.fromJson(json['stat']) : null; title = json['title']; type = json['type']; + epid = json['epid']; + seasonId = json['season_id']; } } diff --git a/lib/pages/dynamics/controller.dart b/lib/pages/dynamics/controller.dart index 146c57a6..c479ff0a 100644 --- a/lib/pages/dynamics/controller.dart +++ b/lib/pages/dynamics/controller.dart @@ -5,11 +5,14 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; import 'package:pilipala/http/dynamics.dart'; import 'package:pilipala/http/search.dart'; +import 'package:pilipala/models/bangumi/info.dart'; import 'package:pilipala/models/common/dynamics_type.dart'; +import 'package:pilipala/models/common/search_type.dart'; import 'package:pilipala/models/dynamics/result.dart'; import 'package:pilipala/models/dynamics/up.dart'; import 'package:pilipala/models/live/item.dart'; import 'package:pilipala/utils/feed_back.dart'; +import 'package:pilipala/utils/utils.dart'; class DynamicsController extends GetxController { int page = 1; @@ -142,6 +145,32 @@ class DynamicsController extends GetxController { /// TODO case 'DYNAMIC_TYPE_UGC_SEASON': print('合集'); + break; + case 'DYNAMIC_TYPE_PGC_UNION': + print('DYNAMIC_TYPE_PGC_UNION 番剧'); + DynamicArchiveModel pgc = item.modules.moduleDynamic.major.pgc; + if (pgc.epid != null) { + SmartDialog.showLoading(msg: '获取中...'); + var res = await SearchHttp.bangumiInfo(epId: pgc.epid); + SmartDialog.dismiss(); + if (res['status']) { + EpisodeItem episode = res['data'].episodes.first; + String bvid = episode.bvid!; + int cid = episode.cid!; + String pic = episode.cover!; + String heroTag = Utils.makeHeroTag(cid); + Get.toNamed( + '/video?bvid=$bvid&cid=$cid&seasonId=${res['data'].seasonId}', + arguments: { + 'pic': pic, + 'heroTag': heroTag, + 'videoType': SearchType.media_bangumi, + 'bangumiItem': res['data'], + }, + ); + } + } + break; } } diff --git a/lib/pages/dynamics/widgets/author_panel.dart b/lib/pages/dynamics/widgets/author_panel.dart index d95766e6..67a21371 100644 --- a/lib/pages/dynamics/widgets/author_panel.dart +++ b/lib/pages/dynamics/widgets/author_panel.dart @@ -36,7 +36,8 @@ Widget author(item, context) { Text( item.modules.moduleAuthor.name, style: TextStyle( - color: item.modules.moduleAuthor!.vip!['status'] > 0 + color: item.modules.moduleAuthor!.vip != null && + item.modules.moduleAuthor!.vip['status'] > 0 ? const Color.fromARGB(255, 251, 100, 163) : Theme.of(context).colorScheme.onBackground, fontSize: Theme.of(context).textTheme.titleSmall!.fontSize,