diff --git a/lib/common/widgets/video_card_h.dart b/lib/common/widgets/video_card_h.dart index 693e7abd..cc3e571c 100644 --- a/lib/common/widgets/video_card_h.dart +++ b/lib/common/widgets/video_card_h.dart @@ -79,18 +79,8 @@ class VideoCardH extends StatelessWidget { return; } if (videoItem is HotVideoItemModel && - // videoItem.pgcLabel?.isNotEmpty == true && videoItem.redirectUrl?.isNotEmpty == true) { - String? id = RegExp(r'(ep|ss)\d+') - .firstMatch(videoItem.redirectUrl) - ?.group(0); - if (id != null) { - bool isSeason = id.startsWith('ss'); - id = id.substring(2); - Utils.viewBangumi( - seasonId: isSeason ? id : null, - epId: isSeason ? null : id, - ); + if (Utils.viewPgcFromUri(videoItem.redirectUrl!)) { return; } } diff --git a/lib/common/widgets/video_card_h_member_video.dart b/lib/common/widgets/video_card_h_member_video.dart index 34783fca..03db25eb 100644 --- a/lib/common/widgets/video_card_h_member_video.dart +++ b/lib/common/widgets/video_card_h_member_video.dart @@ -40,6 +40,11 @@ class VideoCardHMemberVideo extends StatelessWidget { onTap!(); return; } + if (videoItem.isPgc == true && videoItem.uri?.isNotEmpty == true) { + if (Utils.viewPgcFromUri(videoItem.uri!)) { + return; + } + } try { Get.toNamed( '/video?bvid=$bvid&cid=${videoItem.firstCid}', diff --git a/lib/common/widgets/video_card_v.dart b/lib/common/widgets/video_card_v.dart index 072ad4c1..f7eb2d21 100644 --- a/lib/common/widgets/video_card_v.dart +++ b/lib/common/widgets/video_card_v.dart @@ -35,10 +35,10 @@ class VideoCardV extends StatelessWidget { String goto = videoItem.goto; switch (goto) { case 'bangumi': - if (videoItem.bangumiBadge == '电影') { - SmartDialog.showToast('暂不支持电影观看'); - return; - } + // if (videoItem.bangumiBadge == '电影') { + // SmartDialog.showToast('暂不支持电影观看'); + // return; + // } Utils.viewBangumi(epId: videoItem.param); // SmartDialog.showLoading(msg: '资源获取中'); // var result = await SearchHttp.bangumiInfo(seasonId: null, epId: epId); diff --git a/lib/common/widgets/video_card_v_member_home.dart b/lib/common/widgets/video_card_v_member_home.dart index 5dab8f48..ca7b5f54 100644 --- a/lib/common/widgets/video_card_v_member_home.dart +++ b/lib/common/widgets/video_card_v_member_home.dart @@ -20,13 +20,13 @@ class VideoCardVMemberHome extends StatelessWidget { void onPushDetail(heroTag) async { String goto = videoItem.goto ?? ''; switch (goto) { - // case 'bangumi': - // if (videoItem.bangumiBadge == '电影') { - // SmartDialog.showToast('暂不支持电影观看'); - // return; - // } - // int epId = videoItem.param; - // Utils.viewBangumi(epId: epId); + case 'bangumi': + // if (videoItem.bangumiBadge == '电影') { + // SmartDialog.showToast('暂不支持电影观看'); + // return; + // } + // int epId = videoItem.param; + Utils.viewBangumi(epId: videoItem.param); // SmartDialog.showLoading(msg: '资源获取中'); // var result = await SearchHttp.bangumiInfo(seasonId: null, epId: epId); @@ -63,6 +63,11 @@ class VideoCardVMemberHome extends StatelessWidget { // } // break; case 'av': + if (videoItem.isPgc == true && videoItem.uri?.isNotEmpty == true) { + if (Utils.viewPgcFromUri(videoItem.uri!)) { + return; + } + } String bvid = videoItem.bvid ?? ''; Get.toNamed( '/video?bvid=$bvid&cid=${videoItem.firstCid}', diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index fa129be6..3e3ed761 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -39,6 +39,20 @@ class Utils { static const channel = MethodChannel("PiliPlus"); + static bool viewPgcFromUri(String uri) { + String? id = RegExp(r'(ep|ss)\d+').firstMatch(uri)?.group(0); + if (id != null) { + bool isSeason = id.startsWith('ss'); + id = id.substring(2); + Utils.viewBangumi( + seasonId: isSeason ? id : null, + epId: isSeason ? null : id, + ); + return true; + } + return false; + } + static void showCopyTextDialog(text) { Get.dialog( AlertDialog(