feat: 番剧选集评论加载、分集渲染优化
This commit is contained in:
@ -10,6 +10,7 @@ import 'package:pilipala/models/bangumi/info.dart';
|
||||
import 'package:pilipala/models/user/fav_folder.dart';
|
||||
import 'package:pilipala/models/video_detail_res.dart';
|
||||
import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/pages/video/detail/reply/index.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
@ -330,75 +331,18 @@ class BangumiIntroController extends GetxController {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 关注/取关up
|
||||
Future actionRelationMod() async {
|
||||
feedBack();
|
||||
if (user.get(UserBoxKey.userMid) == null) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
int currentStatus = followStatus['attribute'];
|
||||
int actionStatus = 0;
|
||||
switch (currentStatus) {
|
||||
case 0:
|
||||
actionStatus = 1;
|
||||
break;
|
||||
case 2:
|
||||
actionStatus = 2;
|
||||
break;
|
||||
default:
|
||||
actionStatus = 0;
|
||||
break;
|
||||
}
|
||||
SmartDialog.show(
|
||||
useSystem: true,
|
||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('提示'),
|
||||
content: Text(currentStatus == 0 ? '关注UP主?' : '取消关注UP主?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => SmartDialog.dismiss(),
|
||||
child: const Text('点错了')),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
var result = await VideoHttp.relationMod(
|
||||
mid: videoDetail.value.owner!.mid!,
|
||||
act: actionStatus,
|
||||
reSrc: 14,
|
||||
);
|
||||
if (result['status']) {
|
||||
switch (currentStatus) {
|
||||
case 0:
|
||||
actionStatus = 2;
|
||||
break;
|
||||
case 2:
|
||||
actionStatus = 0;
|
||||
break;
|
||||
default:
|
||||
actionStatus = 0;
|
||||
break;
|
||||
}
|
||||
followStatus['attribute'] = actionStatus;
|
||||
followStatus.refresh();
|
||||
}
|
||||
SmartDialog.dismiss();
|
||||
},
|
||||
child: const Text('确认'),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 修改分P或番剧分集
|
||||
Future changeSeasonOrbangu(bvid, cid) async {
|
||||
Future changeSeasonOrbangu(bvid, cid, aid) async {
|
||||
// 重新获取视频资源
|
||||
VideoDetailController videoDetailCtr =
|
||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
||||
videoDetailCtr.bvid = bvid;
|
||||
videoDetailCtr.cid = cid;
|
||||
videoDetailCtr.queryVideoUrl();
|
||||
// 重新请求评论
|
||||
VideoReplyController videoReplyCtr =
|
||||
Get.find<VideoReplyController>(tag: Get.arguments['heroTag']);
|
||||
videoReplyCtr.aid = aid;
|
||||
videoReplyCtr.queryReplyList(type: 'init');
|
||||
}
|
||||
}
|
||||
|
@ -304,14 +304,20 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
// 点赞收藏转发 布局样式2
|
||||
actionGrid(context, bangumiIntroController),
|
||||
// 番剧分p
|
||||
if (!widget.loadingStatus &&
|
||||
widget.bangumiDetail!.episodes!.isNotEmpty) ...[
|
||||
if ((!widget.loadingStatus &&
|
||||
widget.bangumiDetail!.episodes!.isNotEmpty) ||
|
||||
bangumiItem != null &&
|
||||
bangumiItem!.episodes!.isNotEmpty) ...[
|
||||
BangumiPanel(
|
||||
pages: widget.bangumiDetail!.episodes!,
|
||||
cid: widget.bangumiDetail!.episodes!.first.cid,
|
||||
pages: bangumiItem != null
|
||||
? bangumiItem!.episodes!
|
||||
: widget.bangumiDetail!.episodes!,
|
||||
cid: bangumiItem != null
|
||||
? bangumiItem!.episodes!.first.cid
|
||||
: widget.bangumiDetail!.episodes!.first.cid,
|
||||
sheetHeight: sheetHeight,
|
||||
changeFuc: (bvid, cid) =>
|
||||
bangumiIntroController.changeSeasonOrbangu(bvid, cid),
|
||||
changeFuc: (bvid, cid, aid) => bangumiIntroController
|
||||
.changeSeasonOrbangu(bvid, cid, aid),
|
||||
)
|
||||
],
|
||||
],
|
||||
|
@ -64,18 +64,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
itemCount: widget.pages.length,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
onTap: () async {
|
||||
if (widget.pages[index].badge != null) {
|
||||
SmartDialog.showToast('需要大会员');
|
||||
return;
|
||||
}
|
||||
await widget.changeFuc!(
|
||||
widget.pages[index].bvid,
|
||||
widget.pages[index].cid,
|
||||
);
|
||||
currentIndex = index;
|
||||
setState(() {});
|
||||
},
|
||||
onTap: () => changeFucCall(widget.pages[index], index),
|
||||
dense: false,
|
||||
title: Text(
|
||||
widget.pages[index].longTitle!,
|
||||
@ -103,6 +92,20 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
);
|
||||
}
|
||||
|
||||
void changeFucCall(item, i) async {
|
||||
if (item.badge != null) {
|
||||
SmartDialog.showToast('需要大会员');
|
||||
return;
|
||||
}
|
||||
await widget.changeFuc!(
|
||||
item.bvid,
|
||||
item.cid,
|
||||
item.aid,
|
||||
);
|
||||
currentIndex = i;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
@ -158,18 +161,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
if (widget.pages[i].badge != null) {
|
||||
SmartDialog.showToast('需要大会员');
|
||||
return;
|
||||
}
|
||||
await widget.changeFuc!(
|
||||
widget.pages[i].bvid,
|
||||
widget.pages[i].cid,
|
||||
);
|
||||
currentIndex = i;
|
||||
setState(() {});
|
||||
},
|
||||
onTap: () => changeFucCall(widget.pages[i], i),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 10),
|
||||
|
@ -62,14 +62,23 @@ class HistoryItem extends StatelessWidget {
|
||||
int cid = result['data'].cid!;
|
||||
String pic = result['data'].pic!;
|
||||
String heroTag = Utils.makeHeroTag(cid);
|
||||
Get.toNamed(
|
||||
'/video?bvid=$bvid&cid=$cid&epId=${result['data'].epId}',
|
||||
arguments: {
|
||||
'pic': pic,
|
||||
'heroTag': heroTag,
|
||||
'videoType': SearchType.media_bangumi,
|
||||
},
|
||||
);
|
||||
var epid = result['data'].epId;
|
||||
if (epid != null) {
|
||||
Get.toNamed(
|
||||
'/video?bvid=$bvid&cid=$cid&epId=${result['data'].epId}',
|
||||
arguments: {
|
||||
'pic': pic,
|
||||
'heroTag': heroTag,
|
||||
'videoType': SearchType.media_bangumi,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
int cid = videoItem.history.cid ??
|
||||
// videoItem.history.oid ??
|
||||
await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
||||
arguments: {'heroTag': heroTag, 'pic': videoItem.cover});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (videoItem.history.epid != '') {
|
||||
|
@ -34,6 +34,9 @@ class VideoReplyController extends GetxController {
|
||||
|
||||
Future queryReplyList({type = 'init'}) async {
|
||||
isLoadingMore = true;
|
||||
if (type == 'init') {
|
||||
currentPage = 0;
|
||||
}
|
||||
var res = await ReplyHttp.replyList(
|
||||
oid: aid!,
|
||||
pageNum: currentPage + 1,
|
||||
|
@ -281,7 +281,8 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
isScrollControlled: true,
|
||||
builder: (BuildContext context) {
|
||||
return VideoReplyNewDialog(
|
||||
oid: IdUtils.bv2av(Get.parameters['bvid']!),
|
||||
oid: _videoReplyController.aid ??
|
||||
IdUtils.bv2av(Get.parameters['bvid']!),
|
||||
root: 0,
|
||||
parent: 0,
|
||||
replyType: ReplyType.video,
|
||||
|
Reference in New Issue
Block a user