fix: history cid
This commit is contained in:
@ -85,15 +85,14 @@ class VideoIntroController extends GetxController {
|
||||
}
|
||||
|
||||
// 获取视频简介&分p
|
||||
Future queryVideoIntro({cover}) async {
|
||||
Future queryVideoIntro({String? cover, String? type, int? cid}) async {
|
||||
var result = await VideoHttp.videoIntro(bvid: bvid);
|
||||
if (result['status']) {
|
||||
videoDetail.value = result['data']!;
|
||||
ugcSeason = result['data']!.ugcSeason;
|
||||
pages.value = result['data']!.pages!;
|
||||
lastPlayCid.value = videoDetail.value.cid!;
|
||||
if (pages.isNotEmpty) {
|
||||
lastPlayCid.value = pages.first.cid!;
|
||||
if (type == null) {
|
||||
lastPlayCid.value = cid ?? videoDetail.value.cid!;
|
||||
}
|
||||
final VideoDetailController videoDetailCtr =
|
||||
Get.find<VideoDetailController>(tag: heroTag);
|
||||
@ -473,7 +472,8 @@ class VideoIntroController extends GetxController {
|
||||
videoReplyCtr.queryReplyList(type: 'init');
|
||||
} catch (_) {}
|
||||
this.bvid = bvid;
|
||||
await queryVideoIntro(cover: cover);
|
||||
// 点击切换时,优先取当前cid
|
||||
await queryVideoIntro(cover: cover, cid: cid);
|
||||
}
|
||||
|
||||
void startTimer() {
|
||||
|
@ -57,7 +57,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
heroTag = Get.arguments['heroTag'];
|
||||
videoIntroController =
|
||||
Get.put(VideoIntroController(bvid: widget.bvid), tag: heroTag);
|
||||
_futureBuilderFuture = videoIntroController.queryVideoIntro();
|
||||
_futureBuilderFuture = videoIntroController.queryVideoIntro(type: 'init');
|
||||
videoIntroController.videoDetail.listen((value) {
|
||||
videoDetail = value;
|
||||
});
|
||||
|
@ -27,7 +27,7 @@ class SeasonPanel extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SeasonPanelState extends State<SeasonPanel> {
|
||||
late List<EpisodeItem> episodes;
|
||||
List<EpisodeItem>? episodes;
|
||||
late int cid;
|
||||
late RxInt currentIndex = (-1).obs;
|
||||
final String heroTag = Get.arguments['heroTag'];
|
||||
@ -75,7 +75,10 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
|
||||
// 获取currentIndex
|
||||
void getCurrentIndex() {
|
||||
currentIndex.value = episodes.indexWhere((EpisodeItem e) => e.cid == cid);
|
||||
if (episodes != null) {
|
||||
currentIndex.value =
|
||||
episodes!.indexWhere((EpisodeItem e) => e.cid == cid);
|
||||
}
|
||||
final List<SectionItem> sections = widget.ugcSeason.sections!;
|
||||
if (sections.length == 1 && sections.first.type == 1) {
|
||||
final List<EpisodeItem> episodesList = sections.first.episodes!;
|
||||
@ -83,6 +86,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
for (int j = 0; j < episodesList[i].pages!.length; j++) {
|
||||
if (episodesList[i].pages![j].cid == cid) {
|
||||
currentIndex.value = i;
|
||||
episodes = episodesList;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -137,7 +141,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
widget.videoIntroCtr.bottomSheetController =
|
||||
_bottomSheetController = EpisodeBottomSheet(
|
||||
currentCid: cid,
|
||||
episodes: episodes,
|
||||
episodes: episodes!,
|
||||
changeFucCall: changeFucCall,
|
||||
sheetHeight: widget.sheetHeight,
|
||||
dataType: VideoEpidoesType.videoEpisode,
|
||||
@ -165,7 +169,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Obx(() => Text(
|
||||
'${currentIndex.value + 1}/${episodes.length}',
|
||||
'${currentIndex.value + 1}/${episodes!.length}',
|
||||
style: Theme.of(context).textTheme.labelMedium,
|
||||
)),
|
||||
const SizedBox(width: 6),
|
||||
|
Reference in New Issue
Block a user