mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 15:46:14 +08:00
opt introctr
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,9 +1,16 @@
|
|||||||
|
import 'package:PiliPlus/http/user.dart';
|
||||||
import 'package:PiliPlus/models_new/fav/fav_folder/data.dart';
|
import 'package:PiliPlus/models_new/fav/fav_folder/data.dart';
|
||||||
import 'package:PiliPlus/models_new/video/video_tag/data.dart';
|
import 'package:PiliPlus/models_new/video/video_tag/data.dart';
|
||||||
import 'package:PiliPlus/services/account_service.dart';
|
import 'package:PiliPlus/services/account_service.dart';
|
||||||
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
|
import 'package:PiliPlus/utils/storage.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
abstract class CommonIntroController extends GetxController {
|
abstract class CommonIntroController extends GetxController {
|
||||||
|
String bvid = Get.parameters['bvid']!;
|
||||||
|
|
||||||
// 是否点赞
|
// 是否点赞
|
||||||
RxBool hasLike = false.obs;
|
RxBool hasLike = false.obs;
|
||||||
// 投币数量
|
// 投币数量
|
||||||
@@ -22,5 +29,36 @@ abstract class CommonIntroController extends GetxController {
|
|||||||
|
|
||||||
Future queryVideoInFolder();
|
Future queryVideoInFolder();
|
||||||
|
|
||||||
Future<void> actionFavVideo();
|
Future<void> actionFavVideo({String type = 'choose'});
|
||||||
|
|
||||||
|
late final enableQuickFav =
|
||||||
|
GStorage.setting.get(SettingBoxKey.enableQuickFav, defaultValue: false);
|
||||||
|
|
||||||
|
// 收藏
|
||||||
|
void showFavBottomSheet(BuildContext context, {type = 'tap'}) {
|
||||||
|
if (!accountService.isLogin.value) {
|
||||||
|
SmartDialog.showToast('账号未登录');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 快速收藏 &
|
||||||
|
// 点按 收藏至默认文件夹
|
||||||
|
// 长按选择文件夹
|
||||||
|
if (enableQuickFav) {
|
||||||
|
if (type == 'tap') {
|
||||||
|
actionFavVideo(type: 'default');
|
||||||
|
} else {
|
||||||
|
PageUtils.showFavBottomSheet(context: context, ctr: this);
|
||||||
|
}
|
||||||
|
} else if (type != 'longPress') {
|
||||||
|
PageUtils.showFavBottomSheet(context: context, ctr: this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> queryVideoTags() async {
|
||||||
|
videoTags = null;
|
||||||
|
var result = await UserHttp.videoTags(bvid: bvid);
|
||||||
|
if (result['status']) {
|
||||||
|
videoTags = result['data'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import 'package:PiliPlus/grpc/bilibili/app/viewunite/pgcanymodel.pb.dart'
|
|||||||
import 'package:PiliPlus/grpc/view.dart';
|
import 'package:PiliPlus/grpc/view.dart';
|
||||||
import 'package:PiliPlus/http/constants.dart';
|
import 'package:PiliPlus/http/constants.dart';
|
||||||
import 'package:PiliPlus/http/fav.dart';
|
import 'package:PiliPlus/http/fav.dart';
|
||||||
import 'package:PiliPlus/http/user.dart';
|
|
||||||
import 'package:PiliPlus/http/video.dart';
|
import 'package:PiliPlus/http/video.dart';
|
||||||
import 'package:PiliPlus/models/pgc_lcf.dart';
|
import 'package:PiliPlus/models/pgc_lcf.dart';
|
||||||
import 'package:PiliPlus/models_new/pgc/pgc_info_model/episode.dart';
|
import 'package:PiliPlus/models_new/pgc/pgc_info_model/episode.dart';
|
||||||
@@ -21,15 +20,12 @@ import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
|||||||
import 'package:PiliPlus/utils/feed_back.dart';
|
import 'package:PiliPlus/utils/feed_back.dart';
|
||||||
import 'package:PiliPlus/utils/global_data.dart';
|
import 'package:PiliPlus/utils/global_data.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:PiliPlus/utils/storage.dart';
|
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class PgcIntroController extends CommonIntroController {
|
class PgcIntroController extends CommonIntroController {
|
||||||
// 视频bvid
|
|
||||||
String bvid = Get.parameters['bvid'] ?? '';
|
|
||||||
var seasonId = Get.parameters['seasonId'] != null
|
var seasonId = Get.parameters['seasonId'] != null
|
||||||
? int.tryParse(Get.parameters['seasonId']!)
|
? int.tryParse(Get.parameters['seasonId']!)
|
||||||
: null;
|
: null;
|
||||||
@@ -44,9 +40,6 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
|
|
||||||
final PgcInfoModel pgcItem = Get.arguments['pgcItem'];
|
final PgcInfoModel pgcItem = Get.arguments['pgcItem'];
|
||||||
|
|
||||||
late final enableQuickFav =
|
|
||||||
GStorage.setting.get(SettingBoxKey.enableQuickFav, defaultValue: false);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@@ -61,13 +54,6 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
queryVideoTags();
|
queryVideoTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> queryVideoTags() async {
|
|
||||||
var result = await UserHttp.videoTags(bvid: bvid);
|
|
||||||
if (result['status']) {
|
|
||||||
videoTags = result['data'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取点赞/投币/收藏状态
|
// 获取点赞/投币/收藏状态
|
||||||
Future<void> queryPgcLikeCoinFav() async {
|
Future<void> queryPgcLikeCoinFav() async {
|
||||||
var result = await VideoHttp.pgcLikeCoinFav(epId: epId);
|
var result = await VideoHttp.pgcLikeCoinFav(epId: epId);
|
||||||
@@ -532,24 +518,4 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收藏
|
|
||||||
void showFavBottomSheet(BuildContext context, {type = 'tap'}) {
|
|
||||||
if (!accountService.isLogin.value) {
|
|
||||||
SmartDialog.showToast('账号未登录');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 快速收藏 &
|
|
||||||
// 点按 收藏至默认文件夹
|
|
||||||
// 长按选择文件夹
|
|
||||||
if (enableQuickFav) {
|
|
||||||
if (type == 'tap') {
|
|
||||||
actionFavVideo(type: 'default');
|
|
||||||
} else {
|
|
||||||
PageUtils.showFavBottomSheet(context: context, ctr: this);
|
|
||||||
}
|
|
||||||
} else if (type != 'longPress') {
|
|
||||||
PageUtils.showFavBottomSheet(context: context, ctr: this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class VideoIntroController extends CommonIntroController {
|
class VideoIntroController extends CommonIntroController {
|
||||||
// 视频bvid
|
|
||||||
late String bvid;
|
|
||||||
|
|
||||||
// 视频详情 上个页面传入
|
// 视频详情 上个页面传入
|
||||||
Map videoItem = {};
|
Map videoItem = {};
|
||||||
late final RxMap staffRelations = {}.obs;
|
late final RxMap staffRelations = {}.obs;
|
||||||
@@ -68,7 +65,7 @@ class VideoIntroController extends CommonIntroController {
|
|||||||
|
|
||||||
// 同时观看
|
// 同时观看
|
||||||
bool isShowOnlineTotal = false;
|
bool isShowOnlineTotal = false;
|
||||||
RxString total = '1'.obs;
|
late final RxString total = '1'.obs;
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
String heroTag = '';
|
String heroTag = '';
|
||||||
AiConclusionResult? aiConclusionResult;
|
AiConclusionResult? aiConclusionResult;
|
||||||
@@ -80,8 +77,6 @@ class VideoIntroController extends CommonIntroController {
|
|||||||
late final showArgueMsg = GStorage.showArgueMsg;
|
late final showArgueMsg = GStorage.showArgueMsg;
|
||||||
late final enableAi =
|
late final enableAi =
|
||||||
GStorage.setting.get(SettingBoxKey.enableAi, defaultValue: false);
|
GStorage.setting.get(SettingBoxKey.enableAi, defaultValue: false);
|
||||||
late final enableQuickFav =
|
|
||||||
GStorage.setting.get(SettingBoxKey.enableQuickFav, defaultValue: false);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@@ -90,7 +85,6 @@ class VideoIntroController extends CommonIntroController {
|
|||||||
if (heroTag.isEmpty) {
|
if (heroTag.isEmpty) {
|
||||||
heroTag = Get.arguments['heroTag'];
|
heroTag = Get.arguments['heroTag'];
|
||||||
}
|
}
|
||||||
bvid = Get.parameters['bvid']!;
|
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
if (Get.arguments.isNotEmpty) {
|
if (Get.arguments.isNotEmpty) {
|
||||||
if (Get.arguments.containsKey('videoItem')) {
|
if (Get.arguments.containsKey('videoItem')) {
|
||||||
@@ -112,9 +106,10 @@ class VideoIntroController extends CommonIntroController {
|
|||||||
}
|
}
|
||||||
videoItem['title'] = str;
|
videoItem['title'] = str;
|
||||||
}
|
}
|
||||||
videoItem['stat'] = keys.contains('stat') ? args.stat : null;
|
videoItem
|
||||||
videoItem['pubdate'] = keys.contains('pubdate') ? args.pubdate : null;
|
..['stat'] = keys.contains('stat') ? args.stat : null
|
||||||
videoItem['owner'] = keys.contains('owner') ? args.owner : null;
|
..['pubdate'] = keys.contains('pubdate') ? args.pubdate : null
|
||||||
|
..['owner'] = keys.contains('owner') ? args.owner : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastPlayCid.value = int.parse(Get.parameters['cid']!);
|
lastPlayCid.value = int.parse(Get.parameters['cid']!);
|
||||||
@@ -177,14 +172,6 @@ class VideoIntroController extends CommonIntroController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> queryVideoTags() async {
|
|
||||||
videoTags = null;
|
|
||||||
var result = await UserHttp.videoTags(bvid: bvid);
|
|
||||||
if (result['status']) {
|
|
||||||
videoTags = result['data'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取up主粉丝数
|
// 获取up主粉丝数
|
||||||
Future<void> queryUserStat() async {
|
Future<void> queryUserStat() async {
|
||||||
if (videoItem['staff']?.isNotEmpty == true) {
|
if (videoItem['staff']?.isNotEmpty == true) {
|
||||||
@@ -895,24 +882,4 @@ class VideoIntroController extends CommonIntroController {
|
|||||||
SmartDialog.showToast("当前视频可能暂不支持AI视频总结");
|
SmartDialog.showToast("当前视频可能暂不支持AI视频总结");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收藏
|
|
||||||
void showFavBottomSheet(BuildContext context, {type = 'tap'}) {
|
|
||||||
if (!accountService.isLogin.value) {
|
|
||||||
SmartDialog.showToast('账号未登录');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 快速收藏 &
|
|
||||||
// 点按 收藏至默认文件夹
|
|
||||||
// 长按选择文件夹
|
|
||||||
if (enableQuickFav) {
|
|
||||||
if (type == 'tap') {
|
|
||||||
actionFavVideo(type: 'default');
|
|
||||||
} else {
|
|
||||||
PageUtils.showFavBottomSheet(context: context, ctr: this);
|
|
||||||
}
|
|
||||||
} else if (type != 'longPress') {
|
|
||||||
PageUtils.showFavBottomSheet(context: context, ctr: this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user