PageRepository.ets
2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
1.主界面底部五个tab
请求底导数据(无参数):
2.请求首页顶部的tab:
请求顶导数据(参数是:当前选中的底导item的${page}):
3.请求页面组件列表数据(参数是:当前选中的顶导item的${path}):
4.请求每个组件内容列表url(参数是:PageID,groupId, compId)
*/
import { ConfigConstants } from 'wdConstant';
import { WDHttp } from 'wdNetwork';
import { NavBody } from '../bean/NavBody';
import { PageDTO } from '../bean/PageDTO';
const TAG = 'PageRepository';
export class PageRepository {
/**
* 主界面底部五个tab:首页、体育、VIP、广场、我的
*
* @returns ResponseDTO<NavBody>
*/
static fetchNavigationDataApi() {
const appId: string = ConfigConstants.appId;
const terminalId: string = ConfigConstants.terminalId;
const province: string = ConfigConstants.province;
const navigationUrl = `https://app-sc.miguvideo.com/app-management/v4/staticcache/navigation-list/${appId}/${terminalId}/${province}`
return WDHttp.Request.get<WDHttp.ResponseDTO<NavBody>>(navigationUrl)
};
/**
* 请求/获取首页顶部导航tab菜单列表
*
* 参考fetchGroupList函数
*/
static fetchMenuList(pageId: string): Promise<WDHttp.ResponseDTO<PageDTO>> {
return PageRepository.fetchGroupList(pageId)
};
/**
* display-v4接口
* pageLayout接口(请求栏目列表)
*
* @param pageID 页面Id
* @returns ResponseDTO<BodyPage>
*/
static fetchGroupList(pageID: string) {
const pageUrl: string = `${ConfigConstants.BASE_URL_VOD}${ConfigConstants.CONTENT_LIST_PATH}/${pageID}`;
return WDHttp.Request.get<WDHttp.ResponseDTO<PageDTO>>(pageUrl)
};
/**
* display-v4接口
* 获取comp数据接口(请求栏目内容)
*
* @param pageId 页面Id
* @param groupId 区段id
* @param componentId 组件id
* @returns ResponseDTO<BodyComponent>
*/
// static fetchComponentData(pageID: string, groupID: string, compID: string) {
// const pageUrl: string = `${ConfigConstants.BASE_URL_VOD}${ConfigConstants.CONTENT_LIST_PATH}/${pageID}/${groupID}/${compID}`;
// Logger.info(TAG, "getGroupList pageUrl:" + pageUrl);
// let headers: Record<string, string> = {
// 'provinceCode': ConfigConstants.province,
// 'terminalId': ConfigConstants.terminalId,
// 'appId': ConfigConstants.appId,
// };
// let options: MGHttp.RequestOptions = {
// header: headers,
// };
// return MGHttp.Request.get<MGHttp.ResponseDTO<BodyComponent>>(pageUrl, options)
// };
}