view later (#419)

This commit is contained in:
My-Responsitories
2025-03-10 18:46:07 +08:00
committed by GitHub
parent 59797a2f5f
commit 99cdec62a1
4 changed files with 24 additions and 29 deletions

View File

@@ -59,6 +59,8 @@ class VideoIntroController extends GetxController
RxBool hasCoin = false.obs; RxBool hasCoin = false.obs;
// 是否收藏 // 是否收藏
RxBool hasFav = false.obs; RxBool hasFav = false.obs;
// 是否稍后再看
RxBool hasLater = false.obs;
bool isLogin = false; bool isLogin = false;
Rx<FavFolderData> favFolderData = FavFolderData().obs; Rx<FavFolderData> favFolderData = FavFolderData().obs;
List? favIds; List? favIds;
@@ -308,6 +310,14 @@ class VideoIntroController extends GetxController
} }
} }
Future viewLater() async {
var res = await (hasLater.value
? UserHttp.toViewDel(aids: [IdUtils.bv2av(bvid)])
: await UserHttp.toViewLater(bvid: bvid));
if (res['status']) hasLater.value = !hasLater.value;
SmartDialog.showToast(res['msg']);
}
void coinVideo(int coin, [bool selectLike = false]) async { void coinVideo(int coin, [bool selectLike = false]) async {
if (videoDetail.value.stat?.coin == null) { if (videoDetail.value.stat?.coin == null) {
// not init // not init

View File

@@ -889,12 +889,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
text: "点踩", text: "点踩",
), ),
), ),
// ActionItem(
// icon: const Icon(FontAwesomeIcons.clock),
// onTap: () => videoIntroController.actionShareVideo(),
// selectStatus: false,
// loadingStatus: loadingStatus,
// text: '稍后再看'),
Obx( Obx(
() => ActionItem( () => ActionItem(
key: _coinKey, key: _coinKey,
@@ -927,16 +921,16 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
needAnim: true, needAnim: true,
), ),
), ),
ActionItem( Obx(
icon: const Icon(FontAwesomeIcons.comment), () => ActionItem(
onTap: () => videoDetailCtr.tabCtr icon: const Icon(FontAwesomeIcons.clock),
.animateTo(videoDetailCtr.tabCtr.index == 1 ? 0 : 1), selectIcon: const Icon(FontAwesomeIcons.solidClock),
selectStatus: false, onTap: () => handleState(videoIntroController.viewLater),
loadingStatus: widget.loadingStatus, selectStatus: videoIntroController.hasLater.value,
semanticsLabel: '评论', loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus semanticsLabel: '再看',
? Utils.numFormat(videoDetail.stat!.reply!) text: '再看',
: '评论', ),
), ),
ActionItem( ActionItem(
icon: const Icon(FontAwesomeIcons.shareFromSquare), icon: const Icon(FontAwesomeIcons.shareFromSquare),

View File

@@ -1058,9 +1058,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
onSelected: (String type) async { onSelected: (String type) async {
switch (type) { switch (type) {
case 'later': case 'later':
var res = await UserHttp.toViewLater( await videoIntroController.viewLater();
bvid: videoDetailController.bvid);
SmartDialog.showToast(res['msg']);
break; break;
case 'report': case 'report':
if (videoDetailController.userInfo == null) { if (videoDetailController.userInfo == null) {

View File

@@ -881,13 +881,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
onSelected: (String type) async { onSelected: (String type) async {
switch (type) { switch (type) {
case 'later': case 'later':
var res = await UserHttp await videoIntroController
.toViewLater( .viewLater();
bvid:
videoDetailController
.bvid);
SmartDialog.showToast(
res['msg']);
break; break;
case 'report': case 'report':
if (videoDetailController if (videoDetailController
@@ -1449,9 +1444,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
onSelected: (String type) async { onSelected: (String type) async {
switch (type) { switch (type) {
case 'later': case 'later':
var res = await UserHttp.toViewLater( await videoIntroController.viewLater();
bvid: videoDetailController.bvid);
SmartDialog.showToast(res['msg']);
break; break;
case 'report': case 'report':
if (videoDetailController.userInfo == null) { if (videoDetailController.userInfo == null) {