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