mod: av替换为bv
This commit is contained in:
@ -22,6 +22,7 @@ class VideoCardH extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
int aid = videoItem.aid;
|
int aid = videoItem.aid;
|
||||||
|
String bvid = videoItem.bvid;
|
||||||
String heroTag = Utils.makeHeroTag(aid);
|
String heroTag = Utils.makeHeroTag(aid);
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
@ -37,7 +38,7 @@ class VideoCardH extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await Future.delayed(const Duration(milliseconds: 200));
|
await Future.delayed(const Duration(milliseconds: 200));
|
||||||
Get.toNamed('/video?aid=$aid&cid=${videoItem.cid}',
|
Get.toNamed('/video?bvid=$bvid&cid=${videoItem.cid}',
|
||||||
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@ -44,7 +44,8 @@ class VideoCardV extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await Future.delayed(const Duration(milliseconds: 200));
|
await Future.delayed(const Duration(milliseconds: 200));
|
||||||
Get.toNamed('/video?aid=${videoItem.id}&cid=${videoItem.cid}',
|
print(videoItem.bvid);
|
||||||
|
Get.toNamed('/video?bvid=${videoItem.bvid}&cid=${videoItem.cid}',
|
||||||
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import 'package:pilipala/http/init.dart';
|
|||||||
|
|
||||||
class ReplyHttp {
|
class ReplyHttp {
|
||||||
static Future replyList({
|
static Future replyList({
|
||||||
required String oid,
|
required int oid,
|
||||||
required int pageNum,
|
required int pageNum,
|
||||||
required int type,
|
required int type,
|
||||||
int sort = 1,
|
int sort = 1,
|
||||||
@ -36,7 +36,7 @@ class ReplyHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future replyReplyList({
|
static Future replyReplyList({
|
||||||
required String oid,
|
required int oid,
|
||||||
required String root,
|
required String root,
|
||||||
required int pageNum,
|
required int pageNum,
|
||||||
required int type,
|
required int type,
|
||||||
|
|||||||
@ -62,10 +62,10 @@ class VideoHttp {
|
|||||||
|
|
||||||
// 视频流
|
// 视频流
|
||||||
static Future videoUrl(
|
static Future videoUrl(
|
||||||
{int? avid, int? bvid, required int cid, int? qn}) async {
|
{int? avid, String? bvid, required int cid, int? qn}) async {
|
||||||
Map<String, dynamic> data = {
|
Map<String, dynamic> data = {
|
||||||
'avid': avid,
|
// 'avid': avid,
|
||||||
// 'bvid': bvid,
|
'bvid': bvid,
|
||||||
'cid': cid,
|
'cid': cid,
|
||||||
// 'qn': qn ?? 80,
|
// 'qn': qn ?? 80,
|
||||||
// 获取所有格式的视频
|
// 获取所有格式的视频
|
||||||
@ -99,8 +99,8 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 视频信息 标题、简介
|
// 视频信息 标题、简介
|
||||||
static Future videoIntro({required String aid}) async {
|
static Future videoIntro({required String bvid}) async {
|
||||||
var res = await Request().get(Api.videoIntro, data: {'aid': aid});
|
var res = await Request().get(Api.videoIntro, data: {'bvid': bvid});
|
||||||
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
||||||
if (result.code == 0) {
|
if (result.code == 0) {
|
||||||
return {'status': true, 'data': result.data!};
|
return {'status': true, 'data': result.data!};
|
||||||
@ -121,8 +121,8 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 相关视频
|
// 相关视频
|
||||||
static Future relatedVideoList({required String aid}) async {
|
static Future relatedVideoList({required String bvid}) async {
|
||||||
var res = await Request().get(Api.relatedList, data: {'aid': aid});
|
var res = await Request().get(Api.relatedList, data: {'bvid': bvid});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
List<HotVideoItemModel> list = [];
|
List<HotVideoItemModel> list = [];
|
||||||
for (var i in res.data['data']) {
|
for (var i in res.data['data']) {
|
||||||
@ -135,8 +135,8 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取点赞状态
|
// 获取点赞状态
|
||||||
static Future hasLikeVideo({required String aid}) async {
|
static Future hasLikeVideo({required String bvid}) async {
|
||||||
var res = await Request().get(Api.hasLikeVideo, data: {'aid': aid});
|
var res = await Request().get(Api.hasLikeVideo, data: {'bvid': bvid});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
} else {
|
} else {
|
||||||
@ -145,8 +145,8 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取投币状态
|
// 获取投币状态
|
||||||
static Future hasCoinVideo({required String aid}) async {
|
static Future hasCoinVideo({required String bvid}) async {
|
||||||
var res = await Request().get(Api.hasCoinVideo, data: {'aid': aid});
|
var res = await Request().get(Api.hasCoinVideo, data: {'bvid': bvid});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
} else {
|
} else {
|
||||||
@ -155,11 +155,11 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 投币
|
// 投币
|
||||||
static Future coinVideo({required String aid, required int multiply}) async {
|
static Future coinVideo({required String bvid, required int multiply}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.coinVideo,
|
Api.coinVideo,
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'aid': aid,
|
'bvid': bvid,
|
||||||
'multiply': multiply,
|
'multiply': multiply,
|
||||||
'select_like': 0,
|
'select_like': 0,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
@ -173,7 +173,7 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取收藏状态
|
// 获取收藏状态
|
||||||
static Future hasFavVideo({required String aid}) async {
|
static Future hasFavVideo({required int aid}) async {
|
||||||
var res = await Request().get(Api.hasFavVideo, data: {'aid': aid});
|
var res = await Request().get(Api.hasFavVideo, data: {'aid': aid});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
@ -183,11 +183,11 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 一键三连
|
// 一键三连
|
||||||
static Future oneThree({required String aid}) async {
|
static Future oneThree({required String bvid}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.oneThree,
|
Api.oneThree,
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'aid': aid,
|
'bvid': bvid,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -199,11 +199,11 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// (取消)点赞
|
// (取消)点赞
|
||||||
static Future likeVideo({required String aid, required bool type}) async {
|
static Future likeVideo({required String bvid, required bool type}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.likeVideo,
|
Api.likeVideo,
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'aid': aid,
|
'bvid': bvid,
|
||||||
'like': type ? 1 : 2,
|
'like': type ? 1 : 2,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
},
|
},
|
||||||
@ -217,7 +217,7 @@ class VideoHttp {
|
|||||||
|
|
||||||
// (取消)收藏
|
// (取消)收藏
|
||||||
static Future favVideo(
|
static Future favVideo(
|
||||||
{required String aid, String? addIds, String? delIds}) async {
|
{required int aid, String? addIds, String? delIds}) async {
|
||||||
var res = await Request().post(Api.favVideo, queryParameters: {
|
var res = await Request().post(Api.favVideo, queryParameters: {
|
||||||
'rid': aid,
|
'rid': aid,
|
||||||
'type': 2,
|
'type': 2,
|
||||||
@ -233,7 +233,7 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查看视频被收藏在哪个文件夹
|
// 查看视频被收藏在哪个文件夹
|
||||||
static Future videoInFolder({required int mid, required String rid}) async {
|
static Future videoInFolder({required int mid, required int rid}) async {
|
||||||
var res = await Request()
|
var res = await Request()
|
||||||
.get(Api.videoInFolder, data: {'up_mid': mid, 'rid': rid});
|
.get(Api.videoInFolder, data: {'up_mid': mid, 'rid': rid});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
@ -305,10 +305,10 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 视频播放进度
|
// 视频播放进度
|
||||||
static Future heartBeat({aid, progress, realtime}) async {
|
static Future heartBeat({bvid, progress, realtime}) async {
|
||||||
var res = await Request().post(Api.heartBeat, queryParameters: {
|
var res = await Request().post(Api.heartBeat, queryParameters: {
|
||||||
'aid': aid,
|
// 'aid': aid,
|
||||||
// 'bvid': '',
|
'bvid': bvid,
|
||||||
// 'cid': '',
|
// 'cid': '',
|
||||||
// 'epid': '',
|
// 'epid': '',
|
||||||
// 'sid': '',
|
// 'sid': '',
|
||||||
|
|||||||
@ -76,6 +76,7 @@ class SearchVideoItemModel {
|
|||||||
cid = json['id'];
|
cid = json['id'];
|
||||||
arcurl = json['arcurl'];
|
arcurl = json['arcurl'];
|
||||||
aid = json['aid'];
|
aid = json['aid'];
|
||||||
|
bvid = json['bvid'];
|
||||||
title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
pic = 'https:${json['pic']}';
|
pic = 'https:${json['pic']}';
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:pilipala/http/user.dart';
|
|||||||
import 'package:pilipala/http/video.dart';
|
import 'package:pilipala/http/video.dart';
|
||||||
import 'package:pilipala/models/user/fav_detail.dart';
|
import 'package:pilipala/models/user/fav_detail.dart';
|
||||||
import 'package:pilipala/models/user/fav_folder.dart';
|
import 'package:pilipala/models/user/fav_folder.dart';
|
||||||
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
|
|
||||||
class FavDetailController extends GetxController {
|
class FavDetailController extends GetxController {
|
||||||
FavFolderItemData? item;
|
FavFolderItemData? item;
|
||||||
@ -20,6 +21,7 @@ class FavDetailController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> queryUserFavFolderDetail() async {
|
Future<dynamic> queryUserFavFolderDetail() async {
|
||||||
|
print('🐯🐯虎');
|
||||||
var res = await await UserHttp.userFavFolderDetail(
|
var res = await await UserHttp.userFavFolderDetail(
|
||||||
pn: 1,
|
pn: 1,
|
||||||
ps: 15,
|
ps: 15,
|
||||||
@ -31,7 +33,7 @@ class FavDetailController extends GetxController {
|
|||||||
|
|
||||||
onCancelFav(int id) async {
|
onCancelFav(int id) async {
|
||||||
var result = await VideoHttp.favVideo(
|
var result = await VideoHttp.favVideo(
|
||||||
aid: id.toString(), addIds: '', delIds: mediaId.toString());
|
aid: id, addIds: '', delIds: mediaId.toString());
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
if (result['data']['prompt']) {
|
if (result['data']['prompt']) {
|
||||||
List<FavDetailItemData> dataList = favDetailData.value.medias!;
|
List<FavDetailItemData> dataList = favDetailData.value.medias!;
|
||||||
|
|||||||
@ -20,10 +20,12 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
|||||||
final FavDetailController _favDetailController =
|
final FavDetailController _favDetailController =
|
||||||
Get.put(FavDetailController());
|
Get.put(FavDetailController());
|
||||||
late StreamController<bool> titleStreamC; // a
|
late StreamController<bool> titleStreamC; // a
|
||||||
|
Future? _futureBuilderFuture;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_futureBuilderFuture = _favDetailController.queryUserFavFolderDetail();
|
||||||
titleStreamC = StreamController<bool>();
|
titleStreamC = StreamController<bool>();
|
||||||
_controller.addListener(
|
_controller.addListener(
|
||||||
() {
|
() {
|
||||||
@ -165,7 +167,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _favDetailController.queryUserFavFolderDetail(),
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
Map data = snapshot.data;
|
Map data = snapshot.data;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ class FavVideoCardH extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
int id = videoItem.id;
|
int id = videoItem.id;
|
||||||
|
String bvid = IdUtils.av2bv(id);
|
||||||
String heroTag = Utils.makeHeroTag(id);
|
String heroTag = Utils.makeHeroTag(id);
|
||||||
return Dismissible(
|
return Dismissible(
|
||||||
movementDuration: const Duration(milliseconds: 300),
|
movementDuration: const Duration(milliseconds: 300),
|
||||||
@ -43,7 +45,7 @@ class FavVideoCardH extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await Future.delayed(const Duration(milliseconds: 200));
|
await Future.delayed(const Duration(milliseconds: 200));
|
||||||
Get.toNamed('/video?aid=$id&cid=${videoItem.cid}',
|
Get.toNamed('/video?bvid=$bvid&cid=${videoItem.cid}',
|
||||||
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/models/common/business_type.dart';
|
import 'package:pilipala/models/common/business_type.dart';
|
||||||
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class HistoryItem extends StatelessWidget {
|
class HistoryItem extends StatelessWidget {
|
||||||
@ -12,6 +13,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
int aid = videoItem.history.oid;
|
int aid = videoItem.history.oid;
|
||||||
|
String bvid = videoItem.history.bvid;
|
||||||
String heroTag = Utils.makeHeroTag(aid);
|
String heroTag = Utils.makeHeroTag(aid);
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
@ -29,7 +31,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Get.toNamed('/video?aid=$aid&cid=${videoItem.history.cid}',
|
Get.toNamed('/video?bvid=$bvid&cid=${videoItem.history.cid}',
|
||||||
arguments: {'heroTag': heroTag, 'pic': videoItem.cover});
|
arguments: {'heroTag': heroTag, 'pic': videoItem.cover});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class VideoDetailController extends GetxController {
|
|||||||
RxList<String> tabs = <String>['简介', '评论'].obs;
|
RxList<String> tabs = <String>['简介', '评论'].obs;
|
||||||
|
|
||||||
// 视频aid
|
// 视频aid
|
||||||
int aid = int.parse(Get.parameters['aid']!);
|
String bvid = Get.parameters['bvid']!;
|
||||||
int cid = int.parse(Get.parameters['cid']!);
|
int cid = int.parse(Get.parameters['cid']!);
|
||||||
|
|
||||||
// 是否预渲染 骨架屏
|
// 是否预渲染 骨架屏
|
||||||
@ -113,7 +113,8 @@ class VideoDetailController extends GetxController {
|
|||||||
|
|
||||||
// 视频链接
|
// 视频链接
|
||||||
queryVideoUrl() async {
|
queryVideoUrl() async {
|
||||||
var result = await VideoHttp.videoUrl(cid: cid, avid: aid);
|
print('🐶🐶🐶');
|
||||||
|
var result = await VideoHttp.videoUrl(cid: cid, bvid: bvid);
|
||||||
// log('result: ${result.toString()}');
|
// log('result: ${result.toString()}');
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
PlayUrlModel data = result['data'];
|
PlayUrlModel data = result['data'];
|
||||||
@ -133,7 +134,7 @@ class VideoDetailController extends GetxController {
|
|||||||
|
|
||||||
void markHeartBeat() async {
|
void markHeartBeat() async {
|
||||||
Duration progress = meeduPlayerController.position.value;
|
Duration progress = meeduPlayerController.position.value;
|
||||||
await VideoHttp.heartBeat(aid: aid, progress: progress.inSeconds);
|
await VideoHttp.heartBeat(bvid: bvid, progress: progress.inSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -8,12 +8,13 @@ import 'package:pilipala/http/video.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/controller.dart';
|
import 'package:pilipala/pages/video/detail/controller.dart';
|
||||||
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
class VideoIntroController extends GetxController {
|
class VideoIntroController extends GetxController {
|
||||||
// 视频aid
|
// 视频bvid
|
||||||
String aid = Get.parameters['aid']!;
|
String bvid = Get.parameters['bvid']!;
|
||||||
|
|
||||||
// 是否预渲染 骨架屏
|
// 是否预渲染 骨架屏
|
||||||
bool preRender = false;
|
bool preRender = false;
|
||||||
@ -69,7 +70,7 @@ class VideoIntroController extends GetxController {
|
|||||||
|
|
||||||
// 获取视频简介
|
// 获取视频简介
|
||||||
Future queryVideoIntro() async {
|
Future queryVideoIntro() async {
|
||||||
var result = await VideoHttp.videoIntro(aid: aid);
|
var result = await VideoHttp.videoIntro(bvid: bvid);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
videoDetail.value = result['data']!;
|
videoDetail.value = result['data']!;
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
|
||||||
@ -104,21 +105,25 @@ class VideoIntroController extends GetxController {
|
|||||||
|
|
||||||
// 获取点赞状态
|
// 获取点赞状态
|
||||||
Future queryHasLikeVideo() async {
|
Future queryHasLikeVideo() async {
|
||||||
var result = await VideoHttp.hasLikeVideo(aid: aid);
|
var result = await VideoHttp.hasLikeVideo(bvid: bvid);
|
||||||
// data num 被点赞标志 0:未点赞 1:已点赞
|
// data num 被点赞标志 0:未点赞 1:已点赞
|
||||||
hasLike.value = result["data"] == 1 ? true : false;
|
hasLike.value = result["data"] == 1 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取投币状态
|
// 获取投币状态
|
||||||
Future queryHasCoinVideo() async {
|
Future queryHasCoinVideo() async {
|
||||||
var result = await VideoHttp.hasCoinVideo(aid: aid);
|
var result = await VideoHttp.hasCoinVideo(bvid: bvid);
|
||||||
hasCoin.value = result["data"]['multiply'] == 0 ? false : true;
|
hasCoin.value = result["data"]['multiply'] == 0 ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取收藏状态
|
// 获取收藏状态
|
||||||
Future queryHasFavVideo() async {
|
Future queryHasFavVideo() async {
|
||||||
var result = await VideoHttp.hasFavVideo(aid: aid);
|
var result = await VideoHttp.hasFavVideo(aid: IdUtils.bv2av(bvid));
|
||||||
hasFav.value = result["data"]['favoured'];
|
if (result['status']) {
|
||||||
|
hasFav.value = result["data"]['favoured'];
|
||||||
|
} else {
|
||||||
|
hasFav.value = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 一键三连
|
// 一键三连
|
||||||
@ -141,7 +146,7 @@ class VideoIntroController extends GetxController {
|
|||||||
child: const Text('点错了')),
|
child: const Text('点错了')),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var result = await VideoHttp.oneThree(aid: aid);
|
var result = await VideoHttp.oneThree(bvid: bvid);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
hasLike.value = result["data"]["like"];
|
hasLike.value = result["data"]["like"];
|
||||||
hasCoin.value = result["data"]["coin"];
|
hasCoin.value = result["data"]["coin"];
|
||||||
@ -162,7 +167,7 @@ class VideoIntroController extends GetxController {
|
|||||||
|
|
||||||
// (取消)点赞
|
// (取消)点赞
|
||||||
Future actionLikeVideo() async {
|
Future actionLikeVideo() async {
|
||||||
var result = await VideoHttp.likeVideo(aid: aid, type: !hasLike.value);
|
var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
// hasLike.value = result["data"] == 1 ? true : false;
|
// hasLike.value = result["data"] == 1 ? true : false;
|
||||||
if (!hasLike.value) {
|
if (!hasLike.value) {
|
||||||
@ -216,7 +221,7 @@ class VideoIntroController extends GetxController {
|
|||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var res = await VideoHttp.coinVideo(
|
var res = await VideoHttp.coinVideo(
|
||||||
aid: aid, multiply: _tempThemeValue);
|
bvid: bvid, multiply: _tempThemeValue);
|
||||||
print(res);
|
print(res);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SmartDialog.showToast('投币成功');
|
SmartDialog.showToast('投币成功');
|
||||||
@ -244,7 +249,7 @@ class VideoIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
var result = await VideoHttp.favVideo(
|
var result = await VideoHttp.favVideo(
|
||||||
aid: aid,
|
aid: IdUtils.bv2av(bvid),
|
||||||
addIds: addMediaIdsNew.join(','),
|
addIds: addMediaIdsNew.join(','),
|
||||||
delIds: delMediaIdsNew.join(','));
|
delIds: delMediaIdsNew.join(','));
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
@ -262,7 +267,7 @@ class VideoIntroController extends GetxController {
|
|||||||
// 分享视频
|
// 分享视频
|
||||||
Future actionShareVideo() async {
|
Future actionShareVideo() async {
|
||||||
var result =
|
var result =
|
||||||
await Share.share('${HttpString.baseUrl}/video/$aid').whenComplete(() {
|
await Share.share('${HttpString.baseUrl}/video/$bvid').whenComplete(() {
|
||||||
print("share completion block ");
|
print("share completion block ");
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
@ -270,7 +275,7 @@ class VideoIntroController extends GetxController {
|
|||||||
|
|
||||||
Future queryVideoInFolder() async {
|
Future queryVideoInFolder() async {
|
||||||
var result = await VideoHttp.videoInFolder(
|
var result = await VideoHttp.videoInFolder(
|
||||||
mid: user.get(UserBoxKey.userMid), rid: aid);
|
mid: user.get(UserBoxKey.userMid), rid: IdUtils.bv2av(bvid));
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
favFolderData.value = result['data'];
|
favFolderData.value = result['data'];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,11 +4,11 @@ import 'package:pilipala/http/video.dart';
|
|||||||
|
|
||||||
class ReleatedController extends GetxController {
|
class ReleatedController extends GetxController {
|
||||||
// 视频aid
|
// 视频aid
|
||||||
String aid = Get.parameters['aid']!;
|
String bvid = Get.parameters['bvid']!;
|
||||||
// 推荐视频列表
|
// 推荐视频列表
|
||||||
List relatedVideoList = [];
|
List relatedVideoList = [];
|
||||||
|
|
||||||
OverlayEntry? popupDialog;
|
OverlayEntry? popupDialog;
|
||||||
|
|
||||||
Future<dynamic> queryRelatedVideo() => VideoHttp.relatedVideoList(aid: aid);
|
Future<dynamic> queryRelatedVideo() => VideoHttp.relatedVideoList(bvid: bvid);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,10 +10,14 @@ import 'package:pilipala/models/video/reply/data.dart';
|
|||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
|
|
||||||
class VideoReplyController extends GetxController {
|
class VideoReplyController extends GetxController {
|
||||||
VideoReplyController(this.aid, this.rpid, this.level);
|
VideoReplyController(
|
||||||
|
this.aid,
|
||||||
|
this.rpid,
|
||||||
|
this.level,
|
||||||
|
);
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
// 视频aid 请求时使用的oid
|
// 视频aid 请求时使用的oid
|
||||||
String? aid;
|
int? aid;
|
||||||
// 层级 2为楼中楼
|
// 层级 2为楼中楼
|
||||||
String? level;
|
String? level;
|
||||||
// rpid 请求楼中楼回复
|
// rpid 请求楼中楼回复
|
||||||
@ -95,7 +99,7 @@ class VideoReplyController extends GetxController {
|
|||||||
Future submitReplyAdd() async {
|
Future submitReplyAdd() async {
|
||||||
var result = await VideoHttp.replyAdd(
|
var result = await VideoHttp.replyAdd(
|
||||||
type: ReplyType.video,
|
type: ReplyType.video,
|
||||||
oid: int.parse(aid!),
|
oid: aid!,
|
||||||
root: replyLevel == '0'
|
root: replyLevel == '0'
|
||||||
? 0
|
? 0
|
||||||
: replyLevel == '1'
|
: replyLevel == '1'
|
||||||
|
|||||||
@ -7,16 +7,17 @@ import 'package:pilipala/common/skeleton/video_reply.dart';
|
|||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
|
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
|
||||||
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'widgets/reply_item.dart';
|
import 'widgets/reply_item.dart';
|
||||||
|
|
||||||
class VideoReplyPanel extends StatefulWidget {
|
class VideoReplyPanel extends StatefulWidget {
|
||||||
int oid;
|
String? bvid;
|
||||||
int rpid;
|
int rpid;
|
||||||
String? level;
|
String? level;
|
||||||
Key? key;
|
Key? key;
|
||||||
VideoReplyPanel({
|
VideoReplyPanel({
|
||||||
this.oid = 0,
|
this.bvid,
|
||||||
this.rpid = 0,
|
this.rpid = 0,
|
||||||
this.level,
|
this.level,
|
||||||
super.key,
|
super.key,
|
||||||
@ -42,17 +43,19 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
int oid = widget.bvid != null ? IdUtils.bv2av(widget.bvid!) : 0;
|
||||||
super.initState();
|
super.initState();
|
||||||
replyLevel = widget.level ?? '1';
|
replyLevel = widget.level ?? '1';
|
||||||
if (widget.level != null && widget.level == '2') {
|
if (widget.level != null && widget.level == '2') {
|
||||||
_videoReplyController = Get.put(
|
_videoReplyController = Get.put(
|
||||||
VideoReplyController(
|
VideoReplyController(oid, widget.rpid.toString(), '2'),
|
||||||
widget.oid.toString(), widget.rpid.toString(), '2'),
|
|
||||||
tag: widget.rpid.toString());
|
tag: widget.rpid.toString());
|
||||||
_videoReplyController.rPid = widget.rpid;
|
_videoReplyController.rPid = widget.rpid;
|
||||||
} else {
|
} else {
|
||||||
_videoReplyController = Get.put(
|
int oid = Get.parameters['bvid'] != null
|
||||||
VideoReplyController(Get.parameters['aid']!, '', '1'),
|
? IdUtils.bv2av(Get.parameters['bvid']!)
|
||||||
|
: 0;
|
||||||
|
_videoReplyController = Get.put(VideoReplyController(oid, '', '1'),
|
||||||
tag: Get.arguments['heroTag']);
|
tag: Get.arguments['heroTag']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,15 +216,18 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
builder: (builder) {
|
builder: (builder) {
|
||||||
return VideoReplyNewDialog(
|
return VideoReplyNewDialog(
|
||||||
replyLevel: '0',
|
replyLevel: '0',
|
||||||
oid: int.parse(Get.parameters['aid']!),
|
oid: IdUtils.bv2av(Get.parameters['bvid']!),
|
||||||
root: 0,
|
root: 0,
|
||||||
parent: 0,
|
parent: 0,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).then((value) => {
|
).then(
|
||||||
// 完成评论,数据添加
|
(value) => {
|
||||||
_videoReplyController.replyList.add(value['data'])
|
// 完成评论,数据添加
|
||||||
});
|
if (value != null && value['data'])
|
||||||
|
{_videoReplyController.replyList.add(value['data'])}
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
tooltip: '发表评论',
|
tooltip: '发表评论',
|
||||||
child: const Icon(Icons.reply),
|
child: const Icon(Icons.reply),
|
||||||
|
|||||||
@ -8,7 +8,7 @@ class VideoReplyReplyController extends GetxController {
|
|||||||
VideoReplyReplyController(this.aid, this.rpid);
|
VideoReplyReplyController(this.aid, this.rpid);
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
// 视频aid 请求时使用的oid
|
// 视频aid 请求时使用的oid
|
||||||
String? aid;
|
int? aid;
|
||||||
// rpid 请求楼中楼回复
|
// rpid 请求楼中楼回复
|
||||||
String? rpid;
|
String? rpid;
|
||||||
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs;
|
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs;
|
||||||
@ -29,13 +29,14 @@ class VideoReplyReplyController extends GetxController {
|
|||||||
super.onInit();
|
super.onInit();
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上拉加载
|
// 上拉加载
|
||||||
Future onLoad() async {
|
Future onLoad() async {
|
||||||
queryReplyList(type: 'onLoad');
|
queryReplyList(type: 'onLoad');
|
||||||
}
|
}
|
||||||
|
|
||||||
Future queryReplyList({type = 'init'}) async {
|
Future queryReplyList({type = 'init'}) async {
|
||||||
if(type == 'init'){
|
if (type == 'init') {
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
}
|
}
|
||||||
isLoadingMore = true;
|
isLoadingMore = true;
|
||||||
|
|||||||
@ -31,8 +31,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_videoReplyReplyController = Get.put(
|
_videoReplyReplyController = Get.put(
|
||||||
VideoReplyReplyController(
|
VideoReplyReplyController(widget.oid, widget.rpid.toString()),
|
||||||
widget.oid.toString(), widget.rpid.toString()),
|
|
||||||
tag: widget.rpid.toString());
|
tag: widget.rpid.toString());
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
|||||||
@ -46,15 +46,15 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
_meeduPlayerController = videoDetailController.meeduPlayerController;
|
_meeduPlayerController = videoDetailController.meeduPlayerController;
|
||||||
_playerEventSubs = _meeduPlayerController!.onPlayerStatusChanged.listen(
|
_playerEventSubs = _meeduPlayerController!.onPlayerStatusChanged.listen(
|
||||||
(PlayerStatus status) {
|
(PlayerStatus status) {
|
||||||
videoDetailController.markHeartBeat();
|
// videoDetailController.markHeartBeat();
|
||||||
if (status == PlayerStatus.playing) {
|
if (status == PlayerStatus.playing) {
|
||||||
Wakelock.enable();
|
Wakelock.enable();
|
||||||
isPlay = false;
|
isPlay = false;
|
||||||
isShowCover = false;
|
isShowCover = false;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
videoDetailController.loopHeartBeat();
|
// videoDetailController.loopHeartBeat();
|
||||||
} else {
|
} else {
|
||||||
videoDetailController.timer!.cancel();
|
// videoDetailController.timer!.cancel();
|
||||||
isPlay = true;
|
isPlay = true;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
Wakelock.disable();
|
Wakelock.disable();
|
||||||
|
|||||||
Reference in New Issue
Block a user