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/user/fav_folder.dart';
|
||||||
import 'package:pilipala/models/video_detail_res.dart';
|
import 'package:pilipala/models/video_detail_res.dart';
|
||||||
import 'package:pilipala/pages/video/detail/index.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/feed_back.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
@ -330,75 +331,18 @@ class BangumiIntroController extends GetxController {
|
|||||||
return result;
|
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或番剧分集
|
// 修改分P或番剧分集
|
||||||
Future changeSeasonOrbangu(bvid, cid) async {
|
Future changeSeasonOrbangu(bvid, cid, aid) async {
|
||||||
|
// 重新获取视频资源
|
||||||
VideoDetailController videoDetailCtr =
|
VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
||||||
videoDetailCtr.bvid = bvid;
|
videoDetailCtr.bvid = bvid;
|
||||||
videoDetailCtr.cid = cid;
|
videoDetailCtr.cid = cid;
|
||||||
videoDetailCtr.queryVideoUrl();
|
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
|
// 点赞收藏转发 布局样式2
|
||||||
actionGrid(context, bangumiIntroController),
|
actionGrid(context, bangumiIntroController),
|
||||||
// 番剧分p
|
// 番剧分p
|
||||||
if (!widget.loadingStatus &&
|
if ((!widget.loadingStatus &&
|
||||||
widget.bangumiDetail!.episodes!.isNotEmpty) ...[
|
widget.bangumiDetail!.episodes!.isNotEmpty) ||
|
||||||
|
bangumiItem != null &&
|
||||||
|
bangumiItem!.episodes!.isNotEmpty) ...[
|
||||||
BangumiPanel(
|
BangumiPanel(
|
||||||
pages: widget.bangumiDetail!.episodes!,
|
pages: bangumiItem != null
|
||||||
cid: widget.bangumiDetail!.episodes!.first.cid,
|
? bangumiItem!.episodes!
|
||||||
|
: widget.bangumiDetail!.episodes!,
|
||||||
|
cid: bangumiItem != null
|
||||||
|
? bangumiItem!.episodes!.first.cid
|
||||||
|
: widget.bangumiDetail!.episodes!.first.cid,
|
||||||
sheetHeight: sheetHeight,
|
sheetHeight: sheetHeight,
|
||||||
changeFuc: (bvid, cid) =>
|
changeFuc: (bvid, cid, aid) => bangumiIntroController
|
||||||
bangumiIntroController.changeSeasonOrbangu(bvid, cid),
|
.changeSeasonOrbangu(bvid, cid, aid),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -64,18 +64,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
itemCount: widget.pages.length,
|
itemCount: widget.pages.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
onTap: () async {
|
onTap: () => changeFucCall(widget.pages[index], index),
|
||||||
if (widget.pages[index].badge != null) {
|
|
||||||
SmartDialog.showToast('需要大会员');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await widget.changeFuc!(
|
|
||||||
widget.pages[index].bvid,
|
|
||||||
widget.pages[index].cid,
|
|
||||||
);
|
|
||||||
currentIndex = index;
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
dense: false,
|
dense: false,
|
||||||
title: Text(
|
title: Text(
|
||||||
widget.pages[index].longTitle!,
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
@ -158,18 +161,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () => changeFucCall(widget.pages[i], i),
|
||||||
if (widget.pages[i].badge != null) {
|
|
||||||
SmartDialog.showToast('需要大会员');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await widget.changeFuc!(
|
|
||||||
widget.pages[i].bvid,
|
|
||||||
widget.pages[i].cid,
|
|
||||||
);
|
|
||||||
currentIndex = i;
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 8, horizontal: 10),
|
vertical: 8, horizontal: 10),
|
||||||
|
|||||||
@ -62,6 +62,8 @@ class HistoryItem extends StatelessWidget {
|
|||||||
int cid = result['data'].cid!;
|
int cid = result['data'].cid!;
|
||||||
String pic = result['data'].pic!;
|
String pic = result['data'].pic!;
|
||||||
String heroTag = Utils.makeHeroTag(cid);
|
String heroTag = Utils.makeHeroTag(cid);
|
||||||
|
var epid = result['data'].epId;
|
||||||
|
if (epid != null) {
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/video?bvid=$bvid&cid=$cid&epId=${result['data'].epId}',
|
'/video?bvid=$bvid&cid=$cid&epId=${result['data'].epId}',
|
||||||
arguments: {
|
arguments: {
|
||||||
@ -70,6 +72,13 @@ class HistoryItem extends StatelessWidget {
|
|||||||
'videoType': SearchType.media_bangumi,
|
'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 {
|
} else {
|
||||||
if (videoItem.history.epid != '') {
|
if (videoItem.history.epid != '') {
|
||||||
|
|||||||
@ -34,6 +34,9 @@ class VideoReplyController extends GetxController {
|
|||||||
|
|
||||||
Future queryReplyList({type = 'init'}) async {
|
Future queryReplyList({type = 'init'}) async {
|
||||||
isLoadingMore = true;
|
isLoadingMore = true;
|
||||||
|
if (type == 'init') {
|
||||||
|
currentPage = 0;
|
||||||
|
}
|
||||||
var res = await ReplyHttp.replyList(
|
var res = await ReplyHttp.replyList(
|
||||||
oid: aid!,
|
oid: aid!,
|
||||||
pageNum: currentPage + 1,
|
pageNum: currentPage + 1,
|
||||||
|
|||||||
@ -281,7 +281,8 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return VideoReplyNewDialog(
|
return VideoReplyNewDialog(
|
||||||
oid: IdUtils.bv2av(Get.parameters['bvid']!),
|
oid: _videoReplyController.aid ??
|
||||||
|
IdUtils.bv2av(Get.parameters['bvid']!),
|
||||||
root: 0,
|
root: 0,
|
||||||
parent: 0,
|
parent: 0,
|
||||||
replyType: ReplyType.video,
|
replyType: ReplyType.video,
|
||||||
|
|||||||
Reference in New Issue
Block a user