mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: copy/move toview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -127,6 +127,10 @@ class Api {
|
||||
|
||||
static const String moveFav = '/x/v3/fav/resource/move';
|
||||
|
||||
static const String copyToview = '/x/v2/history/toview/copy';
|
||||
|
||||
static const String moveToview = '/x/v2/history/toview/move';
|
||||
|
||||
// 视频详情页 相关视频
|
||||
static const String relatedList = '/x/web-interface/archive/related';
|
||||
|
||||
|
||||
@@ -678,13 +678,20 @@ class VideoHttp {
|
||||
|
||||
static Future copyOrMoveFav({
|
||||
required bool isCopy,
|
||||
required bool isFav,
|
||||
required dynamic srcMediaId,
|
||||
required dynamic tarMediaId,
|
||||
dynamic mid,
|
||||
required List resources,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
isCopy ? Api.copyFav : Api.moveFav,
|
||||
isFav
|
||||
? isCopy
|
||||
? Api.copyFav
|
||||
: Api.moveFav
|
||||
: isCopy
|
||||
? Api.copyToview
|
||||
: Api.moveToview,
|
||||
data: {
|
||||
if (srcMediaId != null) 'src_media_id': srcMediaId,
|
||||
'tar_media_id': tarMediaId,
|
||||
|
||||
@@ -128,6 +128,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
context: context,
|
||||
isCopy: true,
|
||||
ctr: _favDetailController,
|
||||
mediaId: _favDetailController.mediaId,
|
||||
),
|
||||
child: Text(
|
||||
'复制到',
|
||||
@@ -147,6 +148,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
context: context,
|
||||
isCopy: false,
|
||||
ctr: _favDetailController,
|
||||
mediaId: _favDetailController.mediaId,
|
||||
),
|
||||
child: Text(
|
||||
'移动到',
|
||||
|
||||
@@ -12,9 +12,12 @@ import 'package:PiliPlus/http/user.dart';
|
||||
class LaterController extends MultiSelectController {
|
||||
RxInt count = (-1).obs;
|
||||
|
||||
dynamic mid;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
mid = GStorage.userInfo.get('userInfoCache')?.mid;
|
||||
queryData();
|
||||
}
|
||||
|
||||
@@ -170,7 +173,7 @@ class LaterController extends MultiSelectController {
|
||||
'sourceType': 'watchLater',
|
||||
'count': list.length,
|
||||
'favTitle': '稍后再看',
|
||||
'mediaId': GStorage.userInfo.get('userInfoCache')?.mid,
|
||||
'mediaId': mid,
|
||||
'desc': false,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/widgets/icon_button.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/pages/history/view.dart' show AppBarWidget;
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/common/skeleton/video_card_h.dart';
|
||||
@@ -80,10 +81,50 @@ class _LaterPageState extends State<LaterPage> {
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity: VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () => _laterController.handleSelect(true),
|
||||
child: const Text('全选'),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity: VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () => Utils.onCopyOrMove(
|
||||
context: context,
|
||||
isCopy: true,
|
||||
ctr: _laterController,
|
||||
mediaId: null,
|
||||
),
|
||||
child: Text(
|
||||
'复制到',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity: VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () => Utils.onCopyOrMove(
|
||||
context: context,
|
||||
isCopy: false,
|
||||
ctr: _laterController,
|
||||
mediaId: null,
|
||||
),
|
||||
child: Text(
|
||||
'移动到',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity: VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () => _laterController.onDelChecked(context),
|
||||
child: Text(
|
||||
'移除',
|
||||
|
||||
@@ -18,6 +18,7 @@ import 'package:PiliPlus/models/common/search_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/models/live/item.dart';
|
||||
import 'package:PiliPlus/models/user/fav_folder.dart';
|
||||
import 'package:PiliPlus/pages/later/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/fav_panel.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/group_panel.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
@@ -46,7 +47,7 @@ class Utils {
|
||||
required BuildContext context,
|
||||
required bool isCopy,
|
||||
required dynamic ctr,
|
||||
dynamic mediaId,
|
||||
required dynamic mediaId,
|
||||
}) {
|
||||
VideoHttp.allFavFolders(ctr.mid).then((res) {
|
||||
if (context.mounted &&
|
||||
@@ -99,10 +100,13 @@ class Utils {
|
||||
SmartDialog.showLoading();
|
||||
VideoHttp.copyOrMoveFav(
|
||||
isCopy: isCopy,
|
||||
isFav: ctr is! LaterController,
|
||||
srcMediaId: mediaId,
|
||||
tarMediaId: checkedId,
|
||||
resources: resources
|
||||
.map((item) => '${item.id}:${item.type}')
|
||||
.map((item) => ctr is LaterController
|
||||
? item.aid
|
||||
: '${item.id}:${item.type}')
|
||||
.toList(),
|
||||
mid: isCopy ? ctr.mid : null,
|
||||
).then((res) {
|
||||
|
||||
Reference in New Issue
Block a user