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