mod: 请求参数结构、评论页面初始化
This commit is contained in:
@ -20,10 +20,10 @@ class HomeController extends GetxController {
|
||||
|
||||
// 获取推荐
|
||||
Future queryRcmdFeed(type) async {
|
||||
var res = await VideoHttp.rcmdVideoList({
|
||||
'ps': count,
|
||||
'fresh_idx': _currentPage,
|
||||
});
|
||||
var res = await VideoHttp.rcmdVideoList(
|
||||
ps: count,
|
||||
freshIdx: _currentPage,
|
||||
);
|
||||
if (res['status']) {
|
||||
if (type == 'init') {
|
||||
videoList.value = res['data'];
|
||||
|
@ -19,10 +19,10 @@ class HotController extends GetxController {
|
||||
|
||||
// 获取推荐
|
||||
Future queryHotFeed(type) async {
|
||||
var res = await VideoHttp.hotVideoList({
|
||||
'pn': _currentPage,
|
||||
'ps': _count,
|
||||
});
|
||||
var res = await VideoHttp.hotVideoList(
|
||||
pn: _currentPage,
|
||||
ps: _count,
|
||||
);
|
||||
if (res['status']) {
|
||||
if (type == 'init') {
|
||||
videoList.value = res['data'];
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class VideoDetailController extends GetxController {
|
||||
int tabInitialIndex = 0;
|
||||
// tabs
|
||||
RxList<String> tabs = <String>['简介', '评论'].obs;
|
||||
|
||||
|
@ -44,7 +44,7 @@ class VideoIntroController extends GetxController {
|
||||
|
||||
// 获取视频简介
|
||||
Future queryVideoIntro() async {
|
||||
var result = await VideoHttp.videoIntro(aid);
|
||||
var result = await VideoHttp.videoIntro(aid: aid);
|
||||
if (result['status']) {
|
||||
videoDetail.value = result['data']!;
|
||||
Get.find<VideoDetailController>().tabs.value = [
|
||||
@ -61,7 +61,7 @@ class VideoIntroController extends GetxController {
|
||||
|
||||
// 获取up主粉丝数
|
||||
Future queryUserStat() async {
|
||||
var result = await UserHttp.userStat(videoDetail.value.owner!.mid);
|
||||
var result = await UserHttp.userStat(mid: videoDetail.value.owner!.mid!);
|
||||
if (result['status']) {
|
||||
userStat = result['data'];
|
||||
}
|
||||
|
@ -7,5 +7,5 @@ class ReleatedController extends GetxController {
|
||||
// 推荐视频列表
|
||||
List relatedVideoList = [];
|
||||
|
||||
Future<dynamic> queryRelatedVideo() => VideoHttp.relatedVideoList(aid);
|
||||
Future<dynamic> queryRelatedVideo() => VideoHttp.relatedVideoList(aid: aid);
|
||||
}
|
||||
|
17
lib/pages/video/detail/reply/controller.dart
Normal file
17
lib/pages/video/detail/reply/controller.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/reply.dart';
|
||||
|
||||
class VideoReplyController extends GetxController {
|
||||
// 视频aid
|
||||
String aid = Get.parameters['aid']!;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
queryReplyList();
|
||||
}
|
||||
|
||||
Future queryReplyList() async {
|
||||
var res = await ReplyHttp.replyList(oid: aid, pageNum: 1, type: 1);
|
||||
}
|
||||
}
|
4
lib/pages/video/detail/reply/index.dart
Normal file
4
lib/pages/video/detail/reply/index.dart
Normal file
@ -0,0 +1,4 @@
|
||||
library video_reply_panel;
|
||||
|
||||
export './controller.dart';
|
||||
export './view.dart';
|
17
lib/pages/video/detail/reply/view.dart
Normal file
17
lib/pages/video/detail/reply/view.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class VideoReplyPanel extends StatefulWidget {
|
||||
const VideoReplyPanel({super.key});
|
||||
|
||||
@override
|
||||
State<VideoReplyPanel> createState() => _VideoReplyPanelState();
|
||||
}
|
||||
|
||||
class _VideoReplyPanelState extends State<VideoReplyPanel> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const SliverToBoxAdapter(
|
||||
child: Text('评论'),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/pages/video/detail/reply/index.dart';
|
||||
import 'package:pilipala/pages/video/detail/controller.dart';
|
||||
import 'package:pilipala/pages/video/detail/introduction/index.dart';
|
||||
import 'package:pilipala/pages/video/detail/related/index.dart';
|
||||
@ -19,6 +20,7 @@ class _VideoDetailPageState extends State<VideoDetailPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultTabController(
|
||||
initialIndex: videoDetailController.tabInitialIndex,
|
||||
length: videoDetailController.tabs.length, // tab的数量.
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
@ -137,9 +139,7 @@ class _VideoDetailPageState extends State<VideoDetailPage> {
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
|
||||
context),
|
||||
),
|
||||
const SliverToBoxAdapter(
|
||||
child: Text('评论'),
|
||||
)
|
||||
const VideoReplyPanel()
|
||||
],
|
||||
);
|
||||
})
|
||||
|
Reference in New Issue
Block a user