feat: 首页,播放页,搜索页,收藏UI

This commit is contained in:
chengsiwen committed 2026-06-29 18:22:02 +08:00
1 parent 197c3e9b88
commit e59ac2177b
19 files changed
+475 -81

No files matched your search

+73 -1
View File
@@ -3,6 +3,8 @@ import 'package:skywood/global/request/api_const.dart';
import 'package:skywood/global/request/app_request.dart';
import 'package:skywood/global/tool/sky_log.dart';
import 'package:skywood/utils/models/drama/skywood_category.dart';
import 'package:skywood/utils/models/drama/skywood_detail.dart';
import 'package:skywood/utils/models/drama/skywood_drama.dart';
import 'package:skywood/utils/models/drama/skywood_home.dart';
class PlayClient {
@@ -23,7 +25,7 @@ class PlayClient {
static Future<List<SkywoodCategory>> getCategoriesList() {
return AppRequest.get(ApiStringPlay.getCategoriesList).then((value) {
SkyLog.print('vvvvv: ${value.data}');
// SkyLog.print('vvvvv: ${value.data}');
if (!value.isSuccess) return [];
Map<String, dynamic> data = value.data['data'];
@@ -34,8 +36,78 @@ class PlayClient {
// id 28 不显示,删除
categoryList = list.map((e) => SkywoodCategory.fromJson(e)).toList();
categoryList.removeWhere((element) => element.id == 28);
categoryList.removeWhere((element) => element.name.length >= 10);
}
return categoryList;
});
}
// getSearchHots
static Future<List<SkywoodDrama>> getSearchHots() {
return AppRequest.get(ApiStringPlay.getSearchHots).then((value) {
if (value.isSuccess) {
SkyLog.print('getSearchHots: ${value.data}');
List list = parseDataForList(value.data);
return list.map((e) => SkywoodDrama.fromJson(e)).toList();
}
return [];
});
}
//getCollections
static Future<List> getCollections({
int page = 1, int pageSize = 10
}) {
Map<String, dynamic> params = _setPage(page: page, pageSize: pageSize);
return AppRequest.get(ApiStringPlay.getCollections, queryParameters: params).then((value) {
if (value.isSuccess) {
SkyLog.print('getCollections: ${value.data}');
}
return [];
});
}
// getHistory
static Future<List> getHistory({
int page = 1, int pageSize = 10
}) {
Map<String, dynamic> params = _setPage(page: page, pageSize: pageSize);
return AppRequest.get(ApiStringPlay.getHistories, queryParameters: params).then((value) {
if (value.isSuccess) {
SkyLog.print('getHistory: ${value.data}');
}
return [];
});
}
// getVideoDetail
static Future<SkywoodDetail?> getVideoDetail({
required int shortPlayId,
required int shortPlayVideoId,
}) {
Map<String, dynamic> params = {};
params['short_play_id'] = shortPlayId;
params['short_play_video_id'] = shortPlayVideoId;
return AppRequest.get(ApiStringPlay.getVideoDetail, queryParameters: params).then((value) {
if (value.isSuccess) {
SkyLog.print('getVideoDetail: ${value.data}');
}
return null;
});
}
static Map<String, dynamic> _setPage({int page = 1, int pageSize = 10}) {
return {
'current_page': page,
'page_size': pageSize,
};
}
static List parseDataForList(Map<String, dynamic> data) {
Map<String, dynamic> map = data['data'];
List? listData = map['list'];
return listData ?? [];
}
}
+5 -5
View File
@@ -63,9 +63,9 @@ class ApiStringPlay {
static const String getVideoDetail = "/getVideoDetails";
static const String getDetailsRecommand = "/getDetailsRecommand";
// getHomeModules GET /home/all-modules 首页全部模块数据
/// getHomeModules GET /home/all-modules 首页全部模块数据
// getRankingList POST /homeRanking 首页榜单,body 带 type,支持 most_trending/top_searched/new_releases
// getCategoriesList GET /getCategories 分类列表
/// getCategoriesList GET /getCategories 分类列表
// getCategoriesDetail GET /videoList 分类详情/剧列表,分页 + extraParams
// getWaterflowList POST /newShortPlay 首页瀑布流,分页 + extraParams
static const String getHomeModules = "/home/all-modules";
@@ -74,7 +74,7 @@ class ApiStringPlay {
static const String getCategoriesDetail = "/videoList";
static const String getWaterflowList = "/newShortPlay";
// getSearchHots GET /search/hots 搜索热门列表
/// getSearchHots GET /search/hots 搜索热门列表
// getSearch GET /search 关键词搜索,query: search
// collect POST /collect 收藏,body: short_play_id, video_id
// cancelCollect POST /cancelCollect 取消收藏,body: short_play_id
@@ -88,8 +88,8 @@ class ApiStringPlay {
static const String getSearch = "/search";
static const String collect = "/collect";
static const String cancelCollect = "/cancelCollect";
static const String getMyCollections = "/myCollections";
static const String getMyHistorys = "/myHistorys";
static const String getCollections = "/myCollections";
static const String getHistories = "/myHistorys";
static const String getNoticeNum = "/noticeNum";
static const String versionControl = "/customer/versionControl";
static const String getLanguges = "/languges";